Replace not decodable characters returned from Spotify instead of crashing
This commit is contained in:
parent
fc9875bf3d
commit
0e098e9b60
@ -26,6 +26,9 @@ No description yet.
|
||||
|
||||
- Improve :option:`--list-settings` output. (Fixes: :issue:`91`)
|
||||
|
||||
- Replace not decodable characters returned from Spotify instead of throwing an
|
||||
exception, as we won't try to figure out the encoding of non-UTF-8-data.
|
||||
|
||||
|
||||
v0.4.1 (2011-05-06)
|
||||
===================
|
||||
|
||||
@ -16,7 +16,7 @@ class SpotifyTranslator(object):
|
||||
return Artist(name=u'[loading...]')
|
||||
return Artist(
|
||||
uri=str(Link.from_artist(spotify_artist)),
|
||||
name=spotify_artist.name().decode(ENCODING),
|
||||
name=spotify_artist.name().decode(ENCODING, 'replace'),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@ -24,7 +24,7 @@ class SpotifyTranslator(object):
|
||||
if spotify_album is None or not spotify_album.is_loaded():
|
||||
return Album(name=u'[loading...]')
|
||||
# TODO pyspotify got much more data on albums than this
|
||||
return Album(name=spotify_album.name().decode(ENCODING))
|
||||
return Album(name=spotify_album.name().decode(ENCODING, 'replace'))
|
||||
|
||||
@classmethod
|
||||
def to_mopidy_track(cls, spotify_track):
|
||||
@ -38,7 +38,7 @@ class SpotifyTranslator(object):
|
||||
date = None
|
||||
return Track(
|
||||
uri=uri,
|
||||
name=spotify_track.name().decode(ENCODING),
|
||||
name=spotify_track.name().decode(ENCODING, 'replace'),
|
||||
artists=[cls.to_mopidy_artist(a) for a in spotify_track.artists()],
|
||||
album=cls.to_mopidy_album(spotify_track.album()),
|
||||
track_no=spotify_track.index(),
|
||||
@ -57,7 +57,7 @@ class SpotifyTranslator(object):
|
||||
try:
|
||||
return Playlist(
|
||||
uri=str(Link.from_playlist(spotify_playlist)),
|
||||
name=spotify_playlist.name().decode(ENCODING),
|
||||
name=spotify_playlist.name().decode(ENCODING, 'replace'),
|
||||
# FIXME if check on link is a hackish workaround for is_local
|
||||
tracks=[cls.to_mopidy_track(t) for t in spotify_playlist
|
||||
if str(Link.from_track(t, 0))],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user