-
-
Save DomiR/fe0ae4fced59f314796d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ITTrackKindFile = 1; | |
var iTunesApp = WScript.CreateObject("iTunes.Application"); | |
var deletedTracks = 0; | |
var mainLibrary = iTunesApp.LibraryPlaylist; | |
var tracks = mainLibrary.Tracks; | |
var numTracks = tracks.Count; | |
var i; | |
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 == "") | |
{ | |
// yes, delete it | |
currTrack.Delete(); | |
deletedTracks++; | |
} | |
} | |
numTracks--; | |
} | |
if (deletedTracks > 0) | |
{ | |
if (deletedTracks == 1) | |
{ | |
WScript.Echo("Removed 1 dead track."); | |
} | |
else | |
{ | |
WScript.Echo("Removed " + deletedTracks + " dead tracks."); | |
} | |
} | |
else | |
{ | |
WScript.Echo("No dead tracks were found."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment