Best would be, if Leo's Lyrics would respond... Hitchhiker... have you any nes? Maybe you can ask the one that maintains the servers if he can ask if it would be possible to use their API?
I sent a message to the guy who maintains the server a week ago, but haven't received a response. I'll try posting on the main forum and see if someone can help.
However, it might not be necessary for him to reply. See, this script works on my computer:
# -*- coding: utf-8 -*-
import encodings.utf_8
import urllib
from xml.dom import minidom
from grabber import LyricProviderBase
class LeosLyrics(LyricProviderBase):
def GetName(self):
return "Leo's Lyrics"
def GetVersion(self):
return "0.3"
def GetURL(self):
return "http://www.leoslyrics.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://api.leoslyrics.com/api_search.php?auth=LeosLyrics5&artist=%s&songtitle=%s" % (urllib.quote(artist), urllib.quote(title))).read()
doc = minidom.parseString(string)
child = doc.getElementsByTagName("searchResults")[0]
hid = None
for e in child.getElementsByTagName("result"):
if e.getAttribute("exactMatch") == "true":
hid = e.getAttribute("hid").encode('utf_8')
break
if hid == None:
result.append('')
continue
string = urllib.urlopen("http://api.leoslyrics.com/api_lyrics.php?auth=LeosLyrics5&hid=%s" % hid).read()
doc = minidom.parseString(string)
child = doc.getElementsByTagName("lyric")[0]
text = child.getElementsByTagName("text")[0]
lyric = text.childNodes[0].data.encode('utf_8')
result.append(lyric)
except Exception, e:
traceback.print_exc(file=sys.stdout)
result.append('')
continue
return result
if __name__ == "__main__":
LyricProviderInstance = LeosLyrics()
In fact, it often returns successful results that the built-in providers miss. This is a very valuable database. However, the catch to getting this script to work is that the following line must be added to the user's hosts file:
77.79.210.222 api.leoslyrics.com
Essentially, this redirects traffic sent to the api.leoslyrics.com host name to the 77.79.210.222 IP address without querying the DNS server. Now, it's unreasonable to require every user who uses this component to modify their personal hosts files, however, if there is a way to bypass the DNS server when fetching the lyrics that can be programmed directly into the component, this would be a worthwhile fix. Unfortunately, I'm not nearly experienced enough in programming to know how to do this.
So, it's something to think about, and it's your choice as to what you want to implement. However, if this server were added to the built-in providers, speaking from experience, my success rate when using "Search All" would double.
-----
Oh, and on a side note, I'm an idiot. LyricWiki didn't appear on my context menu because I hid it in the preferences. I did this back when it broke a long time ago, and the preference carried over to your version. So, no problem here.