var iTunesApp = WScript.CreateObject("iTunes.Application");
var mainLibrary = iTunesApp.LibraryPlaylist;
var mainLibrarySource = iTunesApp.LibrarySource;
var tracks = mainLibrary.Tracks;
var numTracks = tracks.Count;
var i;
var j;
WScript.Echo("copying RATINGS to comments & BMP");
// FIXME take a -v parameter eventually
var verbose = false;
// first, make an array indexed by album name
var albumArray = new Array();
WScript.Echo(numTracks);
j=0;
for (i = 1; i <= numTracks; i++)
{
var CurrTrack = tracks.Item(i);
var rating= CurrTrack.rating;
if (rating != 0)
{
try
{
CurrTrack.comment ="rating:"+rating/20
CurrTrack.bpm =rating/20
j++
}
catch (err)
{
WScript.Echo(CurrTrack.name + err.description);
}
}
}
WScript.Echo("updated " + j + " comments.");
Y BPM to RATING
var iTunesApp = WScript.CreateObject("iTunes.Application");
var mainLibrary = iTunesApp.LibraryPlaylist;
var mainLibrarySource = iTunesApp.LibrarySource;
var tracks = mainLibrary.Tracks;
var numTracks = tracks.Count;
var i;
var j;
WScript.Echo("copying BPM to RATING");
// FIXME take a -v parameter eventually
var verbose = false;
j=1;
// first, make an array indexed by album name
var albumArray = new Array();
WScript.Echo(numTracks);
for (i = 1; i <= numTracks; i++)
{
var CurrTrack = tracks.Item(i);
var BPM = CurrTrack.bpm;
var rating= BPM * 20;
// WScript.Echo(BPM);
// WScript.Echo(CurrTrack.name);
if (BPM != 0)
{
try
{
CurrTrack.rating = rating
j++
}
catch (err)
{
WScript.Echo(CurrTrack.name + err.description);
}
}
}