[rhythmbox] lyrics: fix the winampcn.com parser
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] lyrics: fix the winampcn.com parser
- Date: Sun, 14 Oct 2012 06:53:16 +0000 (UTC)
commit e403650cc32ff279908ad46eb5ea99e1d893dd59
Author: Jonathan Matthew <jonathan d14n org>
Date: Sun Oct 14 16:52:17 2012 +1000
lyrics: fix the winampcn.com parser
url encoding a full url is generally a bad idea.
plugins/lyrics/WinampcnParser.py | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/plugins/lyrics/WinampcnParser.py b/plugins/lyrics/WinampcnParser.py
index 2a4a9f2..7ea139b 100644
--- a/plugins/lyrics/WinampcnParser.py
+++ b/plugins/lyrics/WinampcnParser.py
@@ -57,6 +57,7 @@ class WinampcnParser(object):
def got_lyrics(self, xmltext, callback, *data):
# retrieve xml content
if xmltext is None:
+ print "no response"
callback (None, *data)
return
@@ -68,15 +69,16 @@ class WinampcnParser(object):
lrcurl = root.getElementsByTagName('LyricUrl')[0].childNodes[0].data
if lrcurl is None:
+ print "no lyric urls"
callback (xmltext, *data)
return
# download the lyrics file
- lrcurl_encode = urllib.quote(detect_charset(lrcurl).encode('gbk'))
- lrcurl_encode = lrcurl_encode.replace('%3A', ':');
+ lrcurl = lrcurl.replace('%3A', ':');
+ print "url: %s" % lrcurl
loader = rb.Loader()
- loader.get_url (lrcurl_encode, self.parse_lyrics, callback, *data)
+ loader.get_url (lrcurl, self.parse_lyrics, callback, *data)
except:
callback (None, *data)
@@ -84,6 +86,7 @@ class WinampcnParser(object):
def parse_lyrics(self, lyrics, callback, *data):
if lyrics is None:
+ print "no lyrics"
callback (None, *data)
return
@@ -93,6 +96,7 @@ class WinampcnParser(object):
lrcplaintext = re.sub('\[.*?\]', '', lrcplaintext)
lrcplaintext = lrcplaintext.decode('gbk').encode('UTF-8')
except:
+ print "unable to decode lyrics"
callback (lrcplaintext, *data)
return
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]