Archive for May, 2010

iTunes Cover Art extraction script for Windows

I’ve recently started using iTunes to organize my music library, but I use TVersity and WMP (via UPnP A/V) to play it back. I needed a way to export iTunes cover artwork to Folder.jpg so WMP & TVersity could pick it up. After digging around for a while, I couldn’t really find a solution so I broke open my text editor and put together a little something to do the job. It’s a JavaScript file that uses the iTunes COM object.

As far as I know, iTunes must be running for this to work and I think you need to have your entire music library open for it to see all files. I’m not 100% sure about that, but just do it anyway. :o

Note: Please consolidate and organize your music library first. This script puts the Folder.jpg in the same folder as the track itself, so if you’ve got tracks scattered everywhere, you’re going to have a lot of Folder.jpg files everywhere.

Download this script here

The following is the contents of the script for those who just want to see the code and derive their own works.

/*
    File: ExportItunesArtwork.js 
 
    Version: 1.0 
 
    Copyright © 2010 Edward Presutti (intellidick.com), All Rights Reserved
*/ 
 
/* iTunes delcarations */
var ITTrackKindFile		= 1;
 
var ITArtworkFormatUnknown	= 0;
var ITArtworkFormatJPEG		= 1;
var ITArtworkFormatPNG		= 2;
var ITArtworkFormatBMP		= 3;
 
var	iTunesApp = WScript.CreateObject("iTunes.Application");
var	mainLibrary = iTunesApp.LibraryPlaylist;
var	tracks = mainLibrary.Tracks;
var	numTracks = tracks.Count;
var	fso = WScript.CreateObject("Scripting.FileSystemObject");
 
while (numTracks != 0)
{
	var	currTrack = tracks.Item(numTracks);	
 
	// is this a file track?
	if (currTrack.Kind == ITTrackKindFile)
	{
		// yes, does it have an empty location?
		if (currTrack.Location != "")
		{
			// no, let's get some artwork
			var artwork = currTrack.Artwork;
			var numArt = artwork.Count;
 
			while (numArt != 0)
			{
				var art = artwork.Item(numArt);
				// WScript.Echo("Album : " + currTrack.Album + ", Artwork Description : " + art.Description);
				var f = fso.GetFile(currTrack.Location);
				// WScript.Echo("Path : " + f.ParentFolder);
				var extension;
				switch (art.Format)
				{
					case ITArtworkFormatJPEG:
						extension = ".jpg";
						break;
					case ITArtworkFormatPNG:
						extension = ".png";
						break;
					case ITArtworkFormatBMP:
						extension = ".bmp";
						break;
				}
 
				if (art.Format != ITArtworkFormatUnknown)
				{
					var fname = f.ParentFolder + "\\" + "Folder" + extension;
					if (!(fso.FileExists(fname)))
					{
						WScript.Echo("Saving artwork : " + fname);
						art.SaveArtworkToFile(fname);
					}
				}
 
				numArt--;
			}
 
		}
	}
 
	numTracks--;
}

, , , , , , , ,

10 Comments

Super Street Fighter 4, time to get funky!

Here lately, i’ve been on a gaming kick. Mostly because work has been killing me and I have a large amount of stress I have to get rid of. A good game is decent for stress relief and i’ve definitely been enjoying it. I’ll never be as hardcore of a gamer as I once was, but it’s fun to play again. Xbox Live has really brought the fun back into it as well. I can play with my friends from around the country and not have to worry about setting up TeamSpeak, Ventrillo, etc and all of the drivers and patches you need to play PC games.

Thanks to Geoff over at 3rdmoon, i’m now playing Super Street Fighter 4. All I can say is “Good job Capcom!” What a fun game. I’ve really been enjoying it. It’s got that old school SF2 feeling but all of the new combos and such that make it so much fun. It’s comical and cartoony, but the style works. The challenges are solid and the gameplay is intense. Definitely a winner!

Seeing as the fighting genre is one of my favorites, I decided to go ahead and splurge on a nice arcade quality fighting stick. Conveniently enough, MadCatz makes one… check it out whenever you get a chance! I just snagged one and if you’re in the market, you might consider getting one. Footnote from Geoff though, there are two versions of this stick. The cheap one uses much lower quality buttons/joysticks and they’re breaking left and right. The more expensive “tournament” ones use high quality Sanwa arcade parts. Definitely the way to go!

Here are some pictures…

, ,

No Comments