thedesk/app/node_modules/itunes-nowplaying-mac/dist/itunes.js

19 lines
491 B
JavaScript
Raw Normal View History

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);
}