diff --git a/docs/changelog.rst b/docs/changelog.rst index b2fbbde3..9e678cff 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -86,6 +86,9 @@ one new. - Add support for starred playlists, both your own and those owned by other users. (Fixes: :issue:`326`) +- Fix crash when a new playlist is added by another Spotify client. (Fixes: + :issue:`387`) + **MPD frontend** - Playlists with identical names are now handled properly by the MPD frontend diff --git a/mopidy/backends/spotify/translator.py b/mopidy/backends/spotify/translator.py index d7870c90..60961cf8 100644 --- a/mopidy/backends/spotify/translator.py +++ b/mopidy/backends/spotify/translator.py @@ -1,9 +1,13 @@ from __future__ import unicode_literals +import logging + import spotify from mopidy.models import Artist, Album, Track, Playlist +logger = logging.getLogger('mopidy.backends.spotify') + artist_cache = {} album_cache = {} @@ -66,7 +70,11 @@ def to_mopidy_track(spotify_track, bitrate=None): def to_mopidy_playlist(spotify_playlist, bitrate=None, username=None): if spotify_playlist is None or spotify_playlist.type() != 'playlist': return - uri = str(spotify.Link.from_playlist(spotify_playlist)) + try: + uri = str(spotify.Link.from_playlist(spotify_playlist)) + except spotify.SpotifyError as e: + logger.debug('Spotify playlist translation error: %s', e) + return if not spotify_playlist.is_loaded(): return Playlist(uri=uri, name='[loading...]') name = spotify_playlist.name()