September 12

iTunes – No Artwork To Playlist

over the years, I’ve written a few custom scripts to do my electronic dirty work. some of these are iTunes scripts, and I think others will find them useful as well. copy the following code into a new text file, and rename its extension to “.js”

/* by Calen Fretts */ var ITTrackKindFile = 1; var iTunesApp = WScript.CreateObject("iTunes.Application"); var tracks = iTunesApp.LibraryPlaylist.Tracks; var numTracks = tracks.Count; var matchTracks = 0; var myNewPlaylistName = "---------NO ARTWORK"; var myNewPlaylist = iTunesApp.CreatePlaylist(myNewPlaylistName); WScript.Echo("Finding tracks with no artwork..."); while (numTracks != 0) { var currTrack = tracks.Item(numTracks); // is this a track? if (currTrack.Kind == ITTrackKindFile) { if (currTrack.Artwork.Count == 0) { var bSuccess = myNewPlaylist.AddTrack(currTrack); matchTracks++; } } numTracks--; } if (matchTracks == 0) { myNewPlaylist.Delete(); WScript.Echo("No tracks found."); } else { WScript.Echo("Found " + matchTracks + " tracks. Added to playlist '" + myNewPlaylistName + "'."); }

if you post this code anywhere else, please be sure to give me credit by linking back to this site. got improvements? leave a comment!


Tags: , , ,
Copyright © 2014. All rights reserved.

Posted September 12, 2008 by calenfretts in category "geek", "iTunes