cody-music
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -130,4 +130,14 @@ "use strict"; | ||
if (scriptName === "play" && player.toLowerCase() === "itunes") { | ||
script = this.scripts.playFromLibrary; | ||
params.push("Library"); | ||
// if itunes is not currently running, default to play from the | ||
// user's default playlist | ||
let itunesTrack = await this.run(models_1.PlayerName.ItunesDesktop, "state"); | ||
if (itunesTrack) { | ||
// make it an object | ||
itunesTrack = JSON.parse(itunesTrack); | ||
if (!itunesTrack || !itunesTrack.id) { | ||
// play from the user's default playlist | ||
script = this.scripts.playFromLibrary; | ||
params.push("Library"); | ||
} | ||
} | ||
} | ||
@@ -134,0 +144,0 @@ // apply the params to the one line script |
@@ -54,6 +54,20 @@ "use strict"; | ||
.then((result) => { | ||
done(); | ||
musicCtr | ||
.quitApp(CodyMusic.PlayerName.ItunesDesktop) | ||
.then((result) => { | ||
done(); | ||
}) | ||
.catch((err) => { | ||
done(); | ||
}); | ||
}) | ||
.catch((err) => { | ||
done(); | ||
musicCtr | ||
.quitApp(CodyMusic.PlayerName.ItunesDesktop) | ||
.then((result) => { | ||
done(); | ||
}) | ||
.catch((err) => { | ||
done(); | ||
}); | ||
}); | ||
@@ -60,0 +74,0 @@ }); |
@@ -147,5 +147,20 @@ import { MusicUtil } from "./util"; | ||
if (scriptName === "play" && player.toLowerCase() === "itunes") { | ||
script = this.scripts.playFromLibrary; | ||
params.push("Library"); | ||
// if itunes is not currently running, default to play from the | ||
// user's default playlist | ||
let itunesTrack = await this.run( | ||
PlayerName.ItunesDesktop, | ||
"state" | ||
); | ||
if (itunesTrack) { | ||
// make it an object | ||
itunesTrack = JSON.parse(itunesTrack); | ||
if (!itunesTrack || !itunesTrack.id) { | ||
// play from the user's default playlist | ||
script = this.scripts.playFromLibrary; | ||
params.push("Library"); | ||
} | ||
} | ||
} | ||
// apply the params to the one line script | ||
@@ -215,2 +230,3 @@ script = musicUtil.formatString(script, params); | ||
} | ||
return this.execScript(player, scriptName, params, argv).then( | ||
@@ -217,0 +233,0 @@ result => { |
{ | ||
"name": "cody-music", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "mac osx spotify and itunes music player controller, spotify audio features, itunes and spotify genre, and playlist control", | ||
@@ -11,3 +11,4 @@ "main": "dist/index.js", | ||
"playlist-test": "npm run build && mocha -r ts-node/register test/playlists/test.ts --reporter spec --timeout 20000 --exit", | ||
"web-test": "npm run build && mocha -r ts-node/register test/web/test.ts --reporter spec --timeout 20000 --exit" | ||
"web-test": "npm run build && mocha -r ts-node/register test/web/test.ts --reporter spec --timeout 20000 --exit", | ||
"controls-test": "npm run build && mocha -r ts-node/register test/controls/test.ts --reporter spec --timeout 20000 --exit" | ||
}, | ||
@@ -14,0 +15,0 @@ "repository": { |
@@ -48,6 +48,20 @@ const expect = require("chai").expect; | ||
.then((result: any) => { | ||
done(); | ||
musicCtr | ||
.quitApp(CodyMusic.PlayerName.ItunesDesktop) | ||
.then((result: any) => { | ||
done(); | ||
}) | ||
.catch((err: any) => { | ||
done(); | ||
}); | ||
}) | ||
.catch((err: any) => { | ||
done(); | ||
musicCtr | ||
.quitApp(CodyMusic.PlayerName.ItunesDesktop) | ||
.then((result: any) => { | ||
done(); | ||
}) | ||
.catch((err: any) => { | ||
done(); | ||
}); | ||
}); | ||
@@ -54,0 +68,0 @@ }); |
273554
82
6599