Lyrics module now handles non-ascii chars

This commit is contained in:
Remy
2011-08-21 15:01:13 -07:00
parent ff432a19e2
commit bec434ef3d

View File

@@ -7,8 +7,8 @@ from headphones import logger
def getLyrics(artist, song):
params = { "artist": artist,
"song": song,
params = { "artist": artist.encode('utf-8'),
"song": song.encode('utf-8'),
"fmt": 'xml'
}
@@ -43,7 +43,7 @@ def getLyrics(artist, song):
m = re.compile('''<div class='lyricbox'><div class='rtMatcher'>.*?</div>(.*?)<!--''').search(lyricspage)
if not m:
logger.warn('Cannot find lyrics on: %s' % lyricsurl)
logger.warn('Cannot find lyrics on: %s (might be instrumental)' % lyricsurl)
return
lyrics = convert_html_entities(m.group(1)).replace('<br />', '\n')