thedesk/app/node_modules/itunes-nowplaying-mac/dist/itunes.js
2018-05-20 15:17:10 +09:00

18 lines
490 B
JavaScript

"use strict";
var itunes = Application("iTunes");
var track = itunes.currentTrack;
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);
}