lyrics safely decoded from bytes

This commit is contained in:
Adrian Sampson 2012-03-10 12:33:19 +00:00
parent 2d3c9d9f9a
commit 5befad8ba0
2 changed files with 4 additions and 0 deletions

View file

@ -455,6 +455,8 @@ class MediaField(object):
if self.out_type == bool:
# store bools as 1,0 instead of True,False
out = unicode(int(out))
elif isinstance(out, str):
out = out.decode('utf8', 'ignore')
else:
out = unicode(out)
elif style.as_type == int:

View file

@ -124,6 +124,8 @@ def get_lyrics(artist, title):
for backend in BACKENDS:
lyrics = backend(artist, title)
if lyrics:
if isinstance(lyrics, str):
lyrics = lyrics.decode('utf8', 'ignore')
return lyrics