cody-music
Advanced tools
Comparing version 2.0.9 to 2.1.0
@@ -32,10 +32,16 @@ import { MusicClient } from "./client"; | ||
}/playlists?limit=50`; | ||
let spotifyPlaylists = await musicClient.spotifyApiGet(api, {}); | ||
if ( | ||
spotifyPlaylists && | ||
spotifyPlaylists.data && | ||
spotifyPlaylists.data.items | ||
) { | ||
playlists = spotifyPlaylists.data.items; | ||
let codyResp: CodyResponse = await musicClient.spotifyApiGet( | ||
api, | ||
{} | ||
); | ||
// check if the token needs to be refreshed | ||
if (codyResp.statusText === "EXPIRED") { | ||
// refresh the token | ||
await musicClient.refreshSpotifyToken(); | ||
// try again | ||
codyResp = await musicClient.spotifyApiGet(api, {}); | ||
} | ||
if (codyResp && codyResp.data && codyResp.data.items) { | ||
playlists = codyResp.data.items; | ||
} | ||
} | ||
@@ -42,0 +48,0 @@ |
{ | ||
"name": "cody-music", | ||
"version": "2.0.9", | ||
"version": "2.1.0", | ||
"description": "mac osx spotify and itunes music player controller, spotify audio features, itunes and spotify genre, and playlist control", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -62,3 +62,3 @@ # cody-music | ||
await CodyMusic.playTrack( | ||
"Spotify", | ||
"spotify", | ||
"spotify:track:2YarjDYjBJuH63dUIh9OWv" | ||
@@ -70,3 +70,3 @@ ).then(result => { | ||
// play an iTunes track number | ||
await CodyMusic.playTrack("iTunes", 1).then(result => { | ||
await CodyMusic.playTrack("itunes", 1).then(result => { | ||
// track is playing | ||
@@ -76,3 +76,3 @@ }); | ||
// handling errors | ||
await CodyMusic.playTrack("iTunes", 1000000000).then(result => { | ||
await CodyMusic.playTrack("spotify", 1000000000).then(result => { | ||
// result will contain the "error" attribute with the error message | ||
@@ -83,2 +83,6 @@ if (result.error) { | ||
}); | ||
await CodyMusic.getRunningTrack().then(result => { | ||
// result will be the best effort track that is playing. | ||
// i.e. if you have your itunes app running, it would show you that track | ||
}); | ||
``` | ||
@@ -272,2 +276,8 @@ | ||
/** | ||
* Returns the playlists for a given player | ||
* @param player {spotify|spotify-web|itunes} | ||
*/ | ||
getPlaylists(player: PlayerName): Promise<PlaylistItem[]> | ||
/** | ||
* Get the full list of the playlist names for a given player | ||
@@ -274,0 +284,0 @@ * @param player {spotify|spotify-web|itunes} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
288069
7043
402