Fix crash for Spotify users with playlist folders
This commit is contained in:
parent
85d4dde338
commit
a14f114d2a
@ -21,6 +21,10 @@ No description yet.
|
|||||||
- Support high bitrate (320k) audio. See
|
- Support high bitrate (320k) audio. See
|
||||||
:attr:`mopidy.settings.SPOTIFY_HIGH_BITRATE` for details.
|
:attr:`mopidy.settings.SPOTIFY_HIGH_BITRATE` for details.
|
||||||
|
|
||||||
|
- Catch and log error caused by playlist folder boundaries being threated as
|
||||||
|
normal playlists. More permanent fix requires support for checking playlist
|
||||||
|
types in pyspotify.
|
||||||
|
|
||||||
- Last.fm frontend:
|
- Last.fm frontend:
|
||||||
|
|
||||||
- If you use the Last.fm frontend, you need to upgrade to pylast 0.5.
|
- If you use the Last.fm frontend, you need to upgrade to pylast 0.5.
|
||||||
|
|||||||
@ -54,6 +54,7 @@ class LibspotifySessionManager(SpotifySessionManager, BaseThread):
|
|||||||
for spotify_playlist in session.playlist_container():
|
for spotify_playlist in session.playlist_container():
|
||||||
playlists.append(
|
playlists.append(
|
||||||
LibspotifyTranslator.to_mopidy_playlist(spotify_playlist))
|
LibspotifyTranslator.to_mopidy_playlist(spotify_playlist))
|
||||||
|
playlists = filter(None, playlists)
|
||||||
self.core_queue.put({
|
self.core_queue.put({
|
||||||
'command': 'set_stored_playlists',
|
'command': 'set_stored_playlists',
|
||||||
'playlists': playlists,
|
'playlists': playlists,
|
||||||
|
|||||||
@ -1,11 +1,14 @@
|
|||||||
import datetime as dt
|
import datetime as dt
|
||||||
|
import logging
|
||||||
|
|
||||||
from spotify import Link
|
from spotify import Link, SpotifyError
|
||||||
|
|
||||||
from mopidy import settings
|
from mopidy import settings
|
||||||
from mopidy.backends.libspotify import ENCODING
|
from mopidy.backends.libspotify import ENCODING
|
||||||
from mopidy.models import Artist, Album, Track, Playlist
|
from mopidy.models import Artist, Album, Track, Playlist
|
||||||
|
|
||||||
|
logger = logging.getLogger('mopidy.backends.libspotify.translator')
|
||||||
|
|
||||||
class LibspotifyTranslator(object):
|
class LibspotifyTranslator(object):
|
||||||
@classmethod
|
@classmethod
|
||||||
def to_mopidy_artist(cls, spotify_artist):
|
def to_mopidy_artist(cls, spotify_artist):
|
||||||
@ -47,8 +50,15 @@ class LibspotifyTranslator(object):
|
|||||||
def to_mopidy_playlist(cls, spotify_playlist):
|
def to_mopidy_playlist(cls, spotify_playlist):
|
||||||
if not spotify_playlist.is_loaded():
|
if not spotify_playlist.is_loaded():
|
||||||
return Playlist(name=u'[loading...]')
|
return Playlist(name=u'[loading...]')
|
||||||
return Playlist(
|
# FIXME Replace this try-except with a check on the playlist type,
|
||||||
uri=str(Link.from_playlist(spotify_playlist)),
|
# which is currently not supported by pyspotify, to avoid handling
|
||||||
name=spotify_playlist.name().decode(ENCODING),
|
# playlist folder boundaries like normal playlists.
|
||||||
tracks=[cls.to_mopidy_track(t) for t in spotify_playlist],
|
try:
|
||||||
)
|
return Playlist(
|
||||||
|
uri=str(Link.from_playlist(spotify_playlist)),
|
||||||
|
name=spotify_playlist.name().decode(ENCODING),
|
||||||
|
tracks=[cls.to_mopidy_track(t) for t in spotify_playlist],
|
||||||
|
)
|
||||||
|
except SpotifyError, e:
|
||||||
|
logger.warning(u'Failed translating Spotify playlist '
|
||||||
|
'(probably a playlist folder boundary): %s', e)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user