Can somebody with Regex experience see if they can create a VGMdb source script? VGMdb is a database of video game music and it'd be really handy to have a working Album Art Downloader plugin that could utilize the site's search and artwork features. I posted over on their forums but didn't get any responses. I'd be willing to test if anybody is willing to give it a shot.
My original post over at VGMdb: http://vgmdb.net/forums/showthread.php?t=4845
I just downloaded a nifty little open source app for Windows called Album Art Downloader. It's an easy-to-use program that lets you, yeah you guessed it, download album art for all your digital music files. You can either search manually or it can scan a specific music folder or your foobar2000 library/playlists for albums that are missing artwork. Not only that, but this thing lets you write custom search scripts so you can basically use any searchable web site as a source for the artwork. Guess what I'm gonna ask next? I need to know if it's possible for someone to write a script so we can use VGMdb as an artwork source within the program.
Here's a sample of one of the search scripts (for some site called MusicMight). Can anyone decipher how it's getting the search results and displaying them within the program? This would be so epic if someone got this to work.
import System
import System.Text.RegularExpressions
import AlbumArtDownloader.Scripts
import util
class MusicMight(AlbumArtDownloader.Scripts.IScript):
Name as string:
get: return "MusicMight"
Version as string:
get: return "0.3"
Author as string:
get: return "Alex Vallat"
def Search(artist as string, album as string, results as IScriptResults):
if String.IsNullOrEmpty(album):
return //Only searching on album is supported
album = StripCharacters("&.'\";:?!", album)
//Retrieve the search results page
searchResultsHtml as string = GetPage("http://www.musicmight.com/search?t=recording&q=" + EncodeUrl(album))
matches = Regex("<a\\s[^>]*?href\\s*=\\s*'(?<url>[^']+)'[^>]*?>\\s*<img\\s[^>]+?src\\s*=\\s*'http://s3\\.amazonaws\\.com//mmimagesm/(?<img>[^']+)'[^>]*?>(?<title>.*?)</td>", RegexOptions.IgnoreCase | RegexOptions.Singleline).Matches(searchResultsHtml)
if matches.Count == 0: //Try single page result
matches = Regex("\"http://s3\\.amazonaws\\.com//mmimagelg/(?<img>[^\"]+)\"[^>]*?>.*?<h4><span id=\"artistTitle\">(?:(?:<[^>4]+>)(?<title>[^<]+)?)+</h4>", RegexOptions.IgnoreCase | RegexOptions.Singleline).Matches(searchResultsHtml)
results.EstimatedCount = matches.Count
for match as Match in matches:
img = match.Groups["img"].Value
title = ""
for capture as Capture in match.Groups["title"].Captures:
title += capture.Value
title = title.Replace("<br />", "").Replace("</a>", "").Replace("•", "-");
url as string = null
if match.Groups["url"].Success:
url = "http://www.musicmight.com" + match.Groups["url"].Value
results.Add("http://s3.amazonaws.com//mmimagesm/" + img, title, url, -1, -1, "http://s3.amazonaws.com//mmimagelg/" + img, CoverType.Front);
def RetrieveFullSizeImage(fullSizeCallbackParameter):
return fullSizeCallbackParameter;
Basically it looks like it goes to the search page http://vgmdb.net/search?q=blah and then parses out the results using Regex. Once that Regex line kicks in, that's where I get lost, haha. Maybe this is best for someone with Regex experience?
Here's an example of the search results within the program itself. These results here are kinda questionable and pretty unorganized since I had every search site selected. If we were to just use VGMdb for this same search, these results would be immaculate. Note that you can either have the program show you these results and then you save each one manually OR it can just save the first result (for each type.. front, back, disc, etc) automatically in the folder you choose:
[a href="http://img204.imageshack.us/img204/8302/55875305.png" target="_blank"]
Thanks guys!