jsmathers;283137 Wrote: 
> I also use a java script to save iTunes artwork to a file. Google for
> "iTunes COM SDK" for more info.  My script basically does the same as
> andlauer's, but I added a few options you can set. The
> bOptIgnoreBadArtworkComment option allows you to add a "Don't use iTunes
> artwork" comment to the mp3 if the iTunes artwork is wrong or low
> resolution and it won't save the artwork for that file. Of course you
> could also just clear the bad downloaded artwork in iTunes, but then
> you'll have to do this again if you ever rescan your iTunes library. 
> The other options are pretty self-explanatory.
> 
> Download the attached text file and rename it to
> "SaveItunesArtworkToFile.js".  Make sure iTunes is open and double-click
> the js file to run the script.  Here is the code from the script for
> reference...
> -----------------
> // Script options
> var bOptSaveEmbeddedArtwork = false;
> var bOptIgnoreBadArtworkComment = false;
> var bOptOverwriteArtworkFile = false;
> var bOptCreateArtworkThumbs = false;
> 
> var iTunesApp = WScript.CreateObject("iTunes.Application");
> 
> var tracks = iTunesApp.LibraryPlaylist.Tracks;
> 
> // NOTE: Change to "Test" playlist for testing
> //var tracks =
> iTunesApp.LibrarySource.Playlists.ItemByName("Test").Tracks;
> 
> // NOTE: Instead of looking for "Don't use iTunes artwork" comment, can
> also create smart playlist
> //var tracks = iTunesApp.LibrarySource.Playlists.ItemByName("Use iTunes
> Artwork").Tracks;
> 
> var numTracks = tracks.Count;
> var currTrack;
> var count = 0;
> var fso = new ActiveXObject("Scripting.FileSystemObject");
> var shell = new ActiveXObject("WScript.Shell");
> 
> var albumArray = new Array();
> 
> for (var i = 1; i <= numTracks; i++)
> {
> currTrack = tracks.Item(i);
> var album = currTrack.Album;
> 
> if ((album != undefined) && (album != ""))
> if (albumArray[album] == undefined)
> albumArray[album] = currTrack;
> }
> 
> for (var albumNameKey in albumArray)
> {
> try
> {
> currTrack = albumArray[albumNameKey];
> 
>       if (currTrack.Artwork.Count == 0)
> continue;
> 
> var artItem = currTrack.Artwork.Item(1);
> 
> if (!bOptSaveEmbeddedArtwork)
> if (!artItem.IsDownloadedArtwork)
> continue;
> 
>       // Look for a comment indicating if we should NOT save artwork
> // (separate multiple comments with a semi-colon)
> if (!bOptIgnoreBadArtworkComment)
> {
> var bSaveArtwork = true;
>           var comments = currTrack.Comment.split(";");
>           for (var j = 0; j < comments.length; j++)
> if (comments[j] == "Don't use iTunes artwork")
> {
> bSaveArtwork = false;
> break;
> }
> 
> if (!bSaveArtwork)
> continue;
> }
> 
> var type;
> if (artItem.Format == 0)
> continue;
>       else if (artItem.Format == 1)
> type = "jpg";
> else if(artItem.Format == 2)
> type = "png";
> else if(artItem.Format == 3)
> type = "bmp";
> else
> continue;
> 
> // Save artwork in same directory as track
> var loc = currTrack.Location;
> var parentFolder = loc.substr(0,loc.lastIndexOf("\\")) + "\\";
> var artworkPath =  parentFolder + "cover." + type;
> 
> // Don't save artwork if already exists
> if (!bOptOverwriteArtworkFile)
> if (fso.FileExists(artworkPath))
> continue;
> 
> artItem.SaveArtworkToFile(artworkPath);  
> count++;
> 
> // Create artwork thumbnails using ImageMagick convert
> (www.imagemagick.org)
> if (bOptCreateArtworkThumbs)
> {
> shell.Run("C:\\convert.exe -thumbnail 300x300 \"" +
> artworkPath + "\" \"" + parentFolder + "cover_sm." + type + "\"", 0);
> shell.Run("C:\\convert.exe -thumbnail 150x150 \"" +
> artworkPath + "\" \"" + parentFolder + "cover_tn2." + type + "\"", 0);
> shell.Run("C:\\convert.exe -thumbnail 100x100 \"" +
> artworkPath + "\" \"" + parentFolder + "cover_tn." + type + "\"", 0);
> }
> }
> catch(er)
> {
> WScript.Echo(er);
> }
> }
> 
> WScript.Echo ("Saved artwork for " + count + " tracks.");

This worked great to put the art work into my mp3 folder but is there a
way for it to also copy them to my identical flac folder?

Thanks, DeWayne


-- 
DeWayne
------------------------------------------------------------------------
DeWayne's Profile: http://forums.slimdevices.com/member.php?userid=4345
View this thread: http://forums.slimdevices.com/showthread.php?t=44344

_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/discuss

Reply via email to