[rhythmbox] lyrics: update TerraParser to match current layout



commit 842f1ecb9d34a22930dd1a8af20eb4284b678d89
Author: Gayan Weerakutti <gayan linuxdeveloper space>
Date:   Mon May 16 17:21:28 2016 +0530

    lyrics: update TerraParser to match current layout
    
    https://bugzilla.gnome.org/show_bug.cgi?id=721926

 plugins/lyrics/TerraParser.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/plugins/lyrics/TerraParser.py b/plugins/lyrics/TerraParser.py
index e5e710f..e915e44 100644
--- a/plugins/lyrics/TerraParser.py
+++ b/plugins/lyrics/TerraParser.py
@@ -99,18 +99,18 @@ class TerraParser (object):
                def unspace(x):
                        return " ".join(x.split())
                def untag(x):
-                       return re.sub('<.*?>', '', x)
+                       return re.sub('<.*?>', '\n', x)
 
                source = re.split('<div id="letra">', source)[1]
                source = re.split('</?div.*?>', source)
                # source[1] = artist+title
-               # source[2] = lyrics
+               # source[3] = lyrics
 
                header = "".join(source[1].splitlines())
                # <h1><a>title</a></h1> <h2><a>artist</a></h2>
                bits = re.findall('<h.>(.*?)</h.>', header)
                artistitle = unspace(untag(" - ".join(bits)))
 
-               lyrics = unescape_entities(artistitle) + "\n" + unescape_entities(untag(source[2]))
+               lyrics = unescape_entities(artistitle) + "\n" + unescape_entities(untag(source[3]))
                lyrics += "\n\nEsta letra foi disponibilizada pelo site\nhttp://letras.mus.br";
                return lyrics


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]