VGMdb
Go Back   VGMdb Forums > VGMdb Site Related > Questions and Comments
Register FAQ Calendar Today's Posts Mark Forums Read Search

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old Jun 13, 2010, 08:39 AM
the_miker's Avatar
the_miker the_miker is offline
Senior Member
 
Join Date: Nov 2007
Posts: 191
Default Album Art Downloader - VGMdb Source Script?

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.

Code:
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("&bull;", "-");

			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:



So yeah, if anyone can figure something out, that would be awesome. I'd be willing to beta test and possibly donate a coffee or three to anyone willing to take a stab at this.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Greasemonkey script : Display collection as table dma Miscellaneous Discussion 13 Aug 23, 2020 07:12 AM
New feature: music source pepak Questions and Comments 17 Mar 24, 2012 07:28 AM
How do I get my name(an artist) on an album to link to my VGMdb profile? BONKERS Questions and Comments 4 Mar 16, 2012 08:54 AM
GoldenEye: Source Official Sound Track SolFlint Album Discussions 3 Dec 18, 2011 04:52 PM
N/A: 3rd Source Collection knighTeen87 Album Discussions 3 Jul 13, 2009 09:03 AM