I just wanted to point out a small bug. I'm not sure how you're querying AZ Lyrics, but it's reporting "Failed" for tracks whose lyrics are present in that database. Additionally, if I use the built-in AZ Lyrics it reports "Failed", but if I use my python AZ Lyrics script, it works fine.
Here's how I've been accessing that database:
# -*- coding: utf-8 -*-
import encodings.utf_8
import urllib
from xml.dom import minidom
from grabber import LyricProviderBase
class AZLyrics(LyricProviderBase):
def GetName(self):
return "A-Z Lyrics"
def GetVersion(self):
return "1"
def GetURL(self):
return "http://www.azlyrics.com"
def Query(self, handles, status, abort):
result = []
for handle in handles:
status.Advance()
if abort.Aborting():
return result
artist = handle.Format("[%artist%]")
title = handle.Format("[%title%]")
try:
string = urllib.urlopen("http://search.azlyrics.com/search.php?q=%s+%s" % (urllib.quote(artist), urllib.quote(title))).read()
result_start = string.find("<b>1.</b>")
url_start = string.find("<a href=\"", result_start) + 9
url_end = string.find("\"", url_start)
url = string[url_start:url_end]
lyrics_string = urllib.urlopen(url).read()
lyrics_string = lyrics_string[lyrics_string.find("<!-- END OF RINGTONE 1 -->") + 26:lyrics_string.find("<!-- RINGTONE 2 -->")]
lyric = lyrics_string[lyrics_string.find("<br>") + 15:lyrics_string.find("<br><br><br><br>") - 1]
lyric = lyric.replace("<br />","")
result.append(lyric)
except Exception, e:
traceback.print_exc(file=sys.stdout)
result.append('')
continue
return result
if __name__ == "__main__":
LyricProviderInstance = AZLyrics()
I'm not sure what the differences are, but I felt it's worth mentioning.