Thanks for all the suggestions of cover sources.
I'm just posting to let you know I haven't abandoned this, just been busy with other stuff. I had some time today so I started playing with scripting. I thought python looked quite good, so I've created a coversource DLL that uses a python script to retrieve covers. It needs a bit of work before I can release it, but that will happen sometime soon.
I don't actually know python, but after a bit of playing around I found it to be quite a fun language, and very intuitive to use. Just to show you how easy it is, this script, when run by the python coversource provides all the functionality of Walmart.dll in a few lines:
import urllib
import re
# GetThumbs(): 'artist' & 'album' are unicode strings
# must return a list of elements in this format:
# (all returned strings can be standard or unicode)
# [string: name,string: url to thumbnail OR buffer containing image data (prefixed with 'data://'): thumbnail data,anything: callback data]
# The callback data will be passed to DownloadArt if/when it is called
def GetThumbs(artist,album):
out=[]
params = urllib.urlencode({'search_query': artist + "+" + album})
f = urllib.urlopen("http://www.walmart.com/catalog/search-ng.gsp?Continue.x=0&Continue.y=0&Continue=Find&ics=20&ico=0&search_constraint=4104&" + params)
rfirst = re.compile("<a\\shref=\"/catalog/product\\.do\\?product_id=[0-9]+\"><img\\ssrc=\"([^\"]+)60X60.gif\"[^>]+alt=\"([^\"]*)\"[^>]*>",re.MULTILINE)
text = buffer(f.read())
iterator = rfirst.finditer(text)
for match in iterator:
out.append([match.group(2),u"150x150",match.group(1)+"150X150.jpg",match.group(1)])
return out
# alternate 'for' loop contents:
# f = urllib.urlopen(match.group(1)+"150X150.jpg")
# out.append([match.group(2),u"150x150","data://"+f.read(),match.group(1)])
# GetCover(): 'userdata' is the last item in the array representing
# the desired thumbnail in the list you returned in GetThumbs()
# must return either the URL of the full-size art
# or, the actual image data (prefixed with 'data://') as before
def GetCover(param):
return param + "500X500.jpg"
[!--sizeo:1--][span style=\"font-size:8pt;line-height:100%\"][!--/sizeo--]moderation: Converted code to codebox to preserve forum layout.[/size]