You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The relinked track has id "39S0DVDKeneEjsq4pV45PT" rather than "4nqN0p0FjfH39G3hxeuKad" and causes the following exception:
ERROR 2018-01-14 14:17:25,204 [11350:Core-15] mopidy.core.library
SpotifyBackend backend caused an exception.
Traceback (most recent call last):
File "/home/nick/Dev/mopidy-dev/mopidy/mopidy/core/library.py", line 19, in _backend_error_handling
yield
File "/home/nick/Dev/mopidy-dev/mopidy/mopidy/core/library.py", line 174, in get_images
if future.get() is None:
File "/home/nick/.virtualenvs/mopidy/local/lib/python2.7/site-packages/pykka/threading.py", line 52, in get
compat.reraise(*self._data['exc_info'])
File "/home/nick/.virtualenvs/mopidy/local/lib/python2.7/site-packages/pykka/compat.py", line 12, in reraise
exec('raise tp, value, tb')
File "/home/nick/.virtualenvs/mopidy/local/lib/python2.7/site-packages/pykka/actor.py", line 201, in _actor_loop
response = self._handle_receive(message)
File "/home/nick/.virtualenvs/mopidy/local/lib/python2.7/site-packages/pykka/actor.py", line 295, in _handle_receive
return callee(*message['args'], **message['kwargs'])
File "/home/nick/Dev/mopidy-dev/mopidy-spotify/mopidy_spotify/library.py", line 29, in get_images
return images.get_images(self._backend._web_client, uris)
File "/home/nick/Dev/mopidy-dev/mopidy-spotify/mopidy_spotify/images.py", line 39, in get_images
result.update(_process_uris(web_client, uri_type, batch))
File "/home/nick/Dev/mopidy-dev/mopidy-spotify/mopidy_spotify/images.py", line 75, in _process_uris
uri = ids_to_uris[item['id']]
The above example track should demonstrate the problem regardless of where you are (i.e. all "markets") since it's apparently no longer available anywhere. The fix is probably just a case of using the id field from the linked_from section if it is defined.
The text was updated successfully, but these errors were encountered:
Following seems to do the trick, can make a proper PR later today.
diff --git a/mopidy_spotify/images.py b/mopidy_spotify/images.py
index 9d8b90b..7bcfee2 100644
--- a/mopidy_spotify/images.py
+++ b/mopidy_spotify/images.py
@@ -77,7 +77,12 @@ def _process_uris(web_client, uri_type, uris):
for item in data.get(uri_type + "s", []):
if not item:
continue
- uri = ids_to_uris[item["id"]]
+
+ if "linked_from" in item:
+ uri = ids_to_uris[item["linked_from"]["id"]]
+ else:
+ uri = ids_to_uris[item["id"]]
+
if uri["key"] not in _cache:
if uri_type == "track":
album_key = _parse_uri(item["album"]["uri"])["key"]
When a track is relinked, a different
id
is returned than what was used in the request.Getting the images for "spotify:track:4nqN0p0FjfH39G3hxeuKad" contains the following in the response:
The relinked track has
id
"39S0DVDKeneEjsq4pV45PT" rather than "4nqN0p0FjfH39G3hxeuKad" and causes the following exception:The above example track should demonstrate the problem regardless of where you are (i.e. all "markets") since it's apparently no longer available anywhere. The fix is probably just a case of using the
id
field from thelinked_from
section if it is defined.The text was updated successfully, but these errors were encountered: