2018-05-20 16:17:10 +10:00
|
|
|
"use strict";
|
|
|
|
var itunes = Application("iTunes");
|
|
|
|
var track = itunes.currentTrack;
|
2018-06-12 02:41:11 +10:00
|
|
|
|
2018-05-20 16:17:10 +10:00
|
|
|
function run(argv) {
|
|
|
|
var state = itunes.playerState()
|
|
|
|
if (state != "playing" && state != "paused") {
|
|
|
|
return "null"
|
|
|
|
}
|
|
|
|
track = track.properties();
|
|
|
|
Object.keys(track).filter(function (name) {
|
|
|
|
if (name.startsWith("purchase") || name.endsWith("ID")) {
|
|
|
|
track[name] = undefined;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
track.state = state
|
|
|
|
return JSON.stringify(track, null, 4);
|
|
|
|
}
|