Hi,

Something really strange happened with their markup lately, so thank you for
sharing your patch. Though, I used this
one<https://github.com/KL-7/sonata/commit/60a1a922cda59dccf859453ed44a60f10fbcd923>for
myself. It avoids splitting string with the tag that contains
simultaneously escaped '<' and unescaped '>' as it looks a bit unstable for
me.

On Tue, Apr 26, 2011 at 7:08 PM, Lazaros Koromilas <[email protected]>wrote:

> Lyrics fetching was not functional lately,
> some changes in the markup apparently.
> This patch fixes it.
>
> diff --git a/sonata/lyricwiki.py b/sonata/lyricwiki.py
> index 0cd07fc..d4055c1 100644
> --- a/sonata/lyricwiki.py
> +++ b/sonata/lyricwiki.py
> @@ -42,10 +42,9 @@ class LyricWiki(object):
>             if content[:len(redir_tag)].lower() == redir_tag:
>                 addr =
> "http://lyricwiki.org/index.php?title=%s&action=edit"; %
> urllib.quote(content.split("[[")[1].split("]]")[0])
>                 lyricpage = urllib.urlopen(addr).read()
> -                content = re.split("<textarea[^>]*>",
> lyricpage)[1].split("</textarea>")[0]
> -                content = content.strip()
> -            lyrics =
> content.split("&lt;lyrics&gt;")[1].split("&lt;/lyrics&gt;")[0]
> -            if lyrics.strip() != "&lt;!-- PUT LYRICS HERE (and delete
> this entire line) --&gt;":
> +                lyrics = re.split("&lt;lyrics>",
> lyricpage)[1].split("&lt;/lyrics>")[0]
> +            if lyrics.find("PUT LYRICS HERE") == -1:
> +                lyrics = lyrics.strip()
>                 lyrics = misc.unescape_html(lyrics)
>                 lyrics = misc.wiki_to_html(lyrics)
>                 lyrics = lyrics.decode("utf-8")
> _______________________________________________
> Sonata-users mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/sonata-users
>



-- 
Kirill
_______________________________________________
Sonata-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/sonata-users

Reply via email to