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

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old Jul 5, 2010, 10:45 AM
the_miker's Avatar
the_miker the_miker is offline
Senior Member
 
Join Date: Nov 2007
Posts: 191
Talking

Here's a little update for those of you interested..

AlexVallat, the creator of Album Art Downloader, wrote a VGMdb script himself over the weekend and I helped him test it. It's now an "official" script which means you can get it using the "Get more scripts" link in the actual program, and all future versions of the program will have it bundled right in.

Here's the thread over at Hydrogenaudio (starting at my initial request post) and here's the direct download link for the script itself. He's probably going to make an official post here on VGMdb at some point as well.

As you'll read in the HA thread, I tagged my entire collection over the weekend and it was pretty painless thanks to this script. It did take a few hours, but given the size of my collection, that's to be expected. The neatest part about the script is that it has a spot you can edit to put in your VGMdb login credentials which basically "logs the program in" and gets the full-size artwork. Definitely make sure you fill those in or else it'll just download the small artwork that unregistered visitors of the site see.
Reply With Quote
  #3  
Old Jul 5, 2010, 04:11 PM
Secret Squirrel's Avatar
Secret Squirrel Secret Squirrel is offline
VGMdb Administrator
 
Join Date: May 2007
Location: Cleveland, OH
Posts: 8,295
Default

This is a neat tool, and I played around with it some when you first asked about it, but didn't have time to code anything up.

I have reservations about tools that encourage "Untargeted" searches. To show you what I mean, I went to our advanced search page and looked at our most recent searches.

Quote:
albumtitles -- Charmed, Life • composer -- Idol,, Billy • sort by album titles
albumtitles -- Whiplash, Smile • composer -- Idol,, Billy • sort by album titles
albumtitles -- Rebel, Yell • composer -- Idol,, Billy • sort by album titles
albumtitles -- Discesa, AglInferi, Dun, Giovane, Amante • composer -- Bacio, Della, Medusa • sort by album titles
sort by album titles
albumtitles -- Waterfall • sort by album titles
albumtitles -- The, Marvel, World, Icarus • composer -- Icarus • sort by album titles
albumtitles -- Assume, Crash, Position • composer -- Konono, N°1 • sort by album titles
albumtitles -- ARA • composer -- LAmazon, Ram, Arkestra • sort by album titles
albumtitles -- Bird, Cherry, Grove • composer -- Anne, Lene, Hagglund • sort by album titles
In other words, the majority of the use of our Advanced Search feature now comes from people looking for licensed music, not VGM. We've got a good server, but we don't have the deep pockets that some of the big commercial sites have, and this is still load that is really a waste for us. Those searchers don't want VGM results, but it's easier to just blindly search everything.

Also, the recent search window is now completely useless.
Reply With Quote
  #4  
Old Jul 5, 2010, 04:21 PM
Gigablah's Avatar
Gigablah Gigablah is offline
VGMdb Administrator
 
Join Date: May 2007
Posts: 2,403
Default

People who search licensed music most probably don't have a VGMdb login and thus will get only the small thumbnail, so bandwidth should be fine.

I wonder if we could detect the user-agent and prevent searches originating from that script from being recorded in the history?
Reply With Quote
  #5  
Old Jul 6, 2010, 12:11 AM
AlexV AlexV is offline
Junior Member
 
Join Date: Jul 2010
Posts: 4
Default

Sorry, I didn't consider the impact on the recent searches feature - I'm used to searches which return no results being a low-impact thing.

There is no user agent set by the script, but I can add one. Or, if it would be more convenient, I could add a parameter to the search data to specify "don't include in recent".

If there's any change I can make to help, please let me know and I'll push out an updated script through the automatic-updates functionality.

Alex
Reply With Quote
  #6  
Old Jul 6, 2010, 01:09 AM
Gigablah's Avatar
Gigablah Gigablah is offline
VGMdb Administrator
 
Join Date: May 2007
Posts: 2,403
Default

Oh hey there!

Yeah, I suppose keeping it simple is best. Just add a parameter &src=aad or whatever you want to identify as, drop us a note when it's done and I'll start filtering the history. Thanks a bunch!
Reply With Quote
  #7  
Old Jul 6, 2010, 10:34 AM
AlexV AlexV is offline
Junior Member
 
Join Date: Jul 2010
Posts: 4
Default

OK, here is a candidate replacement script that includes the parameter &src=aad as part of the post data sent to http://vgmdb.net/search

vgmdb.boo

If you can verify that it is easily to detect and handle from your back end code (I did a search for an album called "Test" using it, if you want to check log data or something), then I'll push it out as an update to the current one.

Alternatively, if you make whatever change is most convenient server side, you can let me know and I'll test it myself to verify searches don't show up on the recent list.

Regards,

Alex
Reply With Quote
  #8  
Old Jul 7, 2010, 10:38 AM
Secret Squirrel's Avatar
Secret Squirrel Secret Squirrel is offline
VGMdb Administrator
 
Join Date: May 2007
Location: Cleveland, OH
Posts: 8,295
Default

Hey, AlexV.

Thanks for the change. I'll put a check for that parameter into the code tonight. There's no reason that it won't work, so you could go ahead and push that into the latest update.
Reply With Quote
  #9  
Old Jul 7, 2010, 01:52 PM
Secret Squirrel's Avatar
Secret Squirrel Secret Squirrel is offline
VGMdb Administrator
 
Join Date: May 2007
Location: Cleveland, OH
Posts: 8,295
Default

I implemented this and tested it out with the new vgmdb.boo, and it's working. Thank you for the fix.
Reply With Quote
  #10  
Old Jul 7, 2010, 10:57 PM
AlexV AlexV is offline
Junior Member
 
Join Date: Jul 2010
Posts: 4
Default

Great, I've pushed out the update, hopefully your recent searches list should clear up over the next day or so as users of the script update.

By the way, if you ever decide to implement a public API, give me a shout and I'll redo the script to use that.

Alex
Reply With Quote
  #11  
Old Mar 19, 2011, 10:56 AM
dustloop dustloop is offline
Junior Member
 
Join Date: Mar 2011
Posts: 1
Default

With this script is it possible for it to be edited so albums with various artists will still be found??

Like Parasite Eve I & II boxset and the Vagrant Story soundtrack are both on the site but Album Art Downloader wont find and download the art.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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