Exemple #1
0
$tracks = str_replace("\n", "", @`/usr/bin/osascript /Applications/.SqlTunes/Interfaces/iTunes.Interface.app count 2> /dev/null`);
if (!is_numeric($tracks)) {
    wlog("Invalid number of tracks returned.", true, true);
}
echo "done.\n";
// go through all the tracks in the iTunes library
for ($i = 1; $i <= $tracks; $i++) {
    // dump data for that track
    @`/usr/bin/osascript /Applications/.SqlTunes/Interfaces/iTunes.Interface.app {$i} 2>&1 /dev/null`;
    // Load the iTunes dump, dump the load read if we are logging it
    $iTunesTrack->setData(getDump($credentials["Log"]));
    switch ($credentials["Log"]) {
        case "Debug":
            wlog($iTunesTrack->debug(), false, false);
        case "Verbose":
            printf("\n%06.2f%% %6d %6d | %s - %s", $i / $tracks * 100, $i, $iTunesTrack->getDatabaseID(), $iTunesTrack->getArtist(), $iTunesTrack->getTrackName());
            wlog($i . " " . $iTunesTrack->getDatabaseID() . " " . $iTunesTrack->getArtist() . " - " . $iTunesTrack->getTrackName(), false, false);
            break;
        case "Normal":
            printf("\n%06.2f%% %s - %s", $i / $tracks * 100, $iTunesTrack->getArtist(), $iTunesTrack->getTrackName());
            break;
    }
    // perform non-fatal query on MySql DB
    query($iTunesTrack->getQuery(), false);
}
// log the summary stats
$processTime = time() - $startTime;
wlog($tracks . " processed, total processing time: " . $processTime . " seconds.  Processing rate: " . round($tracks / $processTime, 2) . " songs/sec.", false, false);
// close dump file
fclose($log);
// cleanup