Closed jason-a69 closed 2 years ago
That error is weird. It's complaining that the value in artist['artist'] is of type list, when it should always be of type string. It's getting that data from your Kodi library. In that bit of code it is going through the list of artists that are specified in your Kodi audio library to see if any match the artists returned from last.fm.
Is it possible for you to edit the default.py file and add print artist['artist']
in the line before the if statement (line #134)?
I'll give that a go on Monday, I'm away from my pi until then. Thanks for taking a look
It's my fault, I found some dodgy artist data in my library
12:07:58 T:1642067008 NOTICE: [u'Cond. Denis King', u'The South Bank Orchestra Cond. By Denis King']
What I did was to put in a test to make sure artist['artist'] is a string So the code looks like this
for artist in artists:
if isinstance(artist['artist'], str) or isinstance(artist['artist'], unicode):
if 'artist' in artist and artist['artist'].encode('ascii', 'ignore') == trackartist:
artistid = artist['id']
break
For some strange reason, I still cannot get it to work with Angie by The Rolling Stones :(
I get this
08:11:46 T:1563423808 NOTICE: script.similartracks: DEBUG: Last.fm URL: http://ws.audioscrobbler.com/2.0/?format=json&track=Angie&autocorrect=1&artist=The+Rolling+Stones+&api_key=XXXXXX&method=track.getsimilar 08:11:46 T:1563423808 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
So...one step forwards and another step back!
That error would seem to indicate that the JSON response from Last.fm didn't contain either the 'similartracks' or 'track' key, which it should. I know Last.fm have been messing around with the API, so that could explain the reason for the funny JSON. Just to be on the safe side I'll add a check to the code.
Probably best to check the variables that are not under your control.
Hi Brian,
I was successfully running this script with MP3s.
I loaded up my FLAC files and it failed, the debug is below (I changed the api_key)
16:15:52 T:1488651328 NOTICE: script.similartracks: DEBUG: Looking for similar tracks to The Rolling Stones - Around And Around 16:15:52 T:1488651328 NOTICE: script.similartracks: DEBUG: Last.fm URL: http://ws.audioscrobbler.com/2.0/?format=json&track=Around+And+Around&autocorrect=1&artist=The+Rolling+Stones&api_key=xxxxxxxxxxxxxxxxxxxxxxxxx&method=track.getsimilar 16:15:54 T:1488651328 NOTICE: script.similartracks: DEBUG: Last.fm returned 100 similar tracks 16:15:57 T:1488651328 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
My artist and my track artists are both populated in this case and set to the same value. I do not mind doing some testing to help resolve this issue.
Many thanks
Jason