New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cody-music

Package Overview
Dependencies
Maintainers
1
Versions
234
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cody-music - npm Package Compare versions

Comparing version 2.6.18 to 2.6.19

6

dist/lib/apis.d.ts

@@ -173,2 +173,8 @@ import { PlayerName, Track, PlayerDevice, SpotifyAudioFeature, PlaylistItem, CodyResponse, CodyConfig, PlayerContext } from "./models";

/**
* Play a specific spotify track by trackId (it can be the URI or the ID)
* @param trackId
* @param deviceId (optional)
*/
export declare function playSpotifyTrack(trackId: string, deviceId?: string): Promise<CodyResponse>;
/**
* Initiate the play command for a given trackId for a specific player

@@ -175,0 +181,0 @@ * @param player {spotify|spotify-web|itunes}

@@ -476,2 +476,11 @@ "use strict";

/**
* Play a specific spotify track by trackId (it can be the URI or the ID)
* @param trackId
* @param deviceId (optional)
*/
function playSpotifyTrack(trackId, deviceId = "") {
return musicCtr.spotifyWebPlayTrack(trackId, deviceId);
}
exports.playSpotifyTrack = playSpotifyTrack;
/**
* Initiate the play command for a given trackId for a specific player

@@ -478,0 +487,0 @@ * @param player {spotify|spotify-web|itunes}

1

dist/lib/controller.d.ts

@@ -19,2 +19,3 @@ import { PlayerName } from "./models";

playPauseSpotifyDevice(device_id: string, play: boolean): Promise<import("./models").CodyResponse>;
spotifyWebPlayTrack(trackId: string, deviceId?: string): Promise<import("./models").CodyResponse>;
spotifyWebPlay(options: any): Promise<import("./models").CodyResponse>;

@@ -21,0 +22,0 @@ spotifyWebPause(options: any): Promise<import("./models").CodyResponse>;

@@ -321,2 +321,24 @@ "use strict";

}
async spotifyWebPlayTrack(trackId, deviceId = "") {
/**
* to play a track without the play list id
* curl -X "PUT" "https://api.spotify.com/v1/me/player/play?device_id=4f38ae14f61b3a2e4ed97d537a5cb3d09cf34ea1"
* --data "{\"uris\":[\"spotify:track:2j5hsQvApottzvTn4pFJWF\"]}"
*/
const trackUris = musicUtil.createUrisFromTrackIds([trackId]);
const qsOptions = deviceId ? { device_id: deviceId } : {};
const payload = {
uris: trackUris
};
const api = "/v1/me/player/play";
let response = await musicClient.spotifyApiPut(api, qsOptions, payload);
// check if the token needs to be refreshed
if (response.statusText === "EXPIRED") {
// refresh the token
await musicClient.refreshSpotifyToken();
// try again
response = await musicClient.spotifyApiPut(api, qsOptions, payload);
}
return response;
}
async spotifyWebPlay(options) {

@@ -333,5 +355,4 @@ const qsOptions = options.device_id

}
payload["offset"] = {};
if (options.offset) {
payload.offset = options.offset;
payload["offset"] = options.offset;
}

@@ -342,6 +363,13 @@ if (options.context_uri) {

if (payload.context_uri && payload.uris) {
payload["offset"] = {
...payload.offset,
uri: payload.uris[0]
};
if (payload.offset) {
payload["offset"] = {
...payload.offset,
uri: payload.uris[0]
};
}
else {
payload["offset"] = {
uri: payload.uris[0]
};
}
delete payload.uris;

@@ -348,0 +376,0 @@ }

@@ -526,2 +526,11 @@ "use strict";

/**
* Play a specific spotify track by trackId (it can be the URI or the ID)
* @param trackId
* @param deviceId (optional)
*/
export function playSpotifyTrack(trackId: string, deviceId: string = "") {
return musicCtr.spotifyWebPlayTrack(trackId, deviceId);
}
/**
* Initiate the play command for a given trackId for a specific player

@@ -528,0 +537,0 @@ * @param player {spotify|spotify-web|itunes}

@@ -354,2 +354,27 @@ import { MusicUtil } from "./util";

public async spotifyWebPlayTrack(trackId: string, deviceId: string = "") {
/**
* to play a track without the play list id
* curl -X "PUT" "https://api.spotify.com/v1/me/player/play?device_id=4f38ae14f61b3a2e4ed97d537a5cb3d09cf34ea1"
* --data "{\"uris\":[\"spotify:track:2j5hsQvApottzvTn4pFJWF\"]}"
*/
const trackUris = musicUtil.createUrisFromTrackIds([trackId]);
const qsOptions = deviceId ? { device_id: deviceId } : {};
const payload = {
uris: trackUris
};
const api = "/v1/me/player/play";
let response = await musicClient.spotifyApiPut(api, qsOptions, payload);
// check if the token needs to be refreshed
if (response.statusText === "EXPIRED") {
// refresh the token
await musicClient.refreshSpotifyToken();
// try again
response = await musicClient.spotifyApiPut(api, qsOptions, payload);
}
return response;
}
public async spotifyWebPlay(options: any) {

@@ -368,6 +393,4 @@ const qsOptions = options.device_id

payload["offset"] = {};
if (options.offset) {
payload.offset = options.offset;
payload["offset"] = options.offset;
}

@@ -380,6 +403,12 @@

if (payload.context_uri && payload.uris) {
payload["offset"] = {
...payload.offset,
uri: payload.uris[0]
};
if (payload.offset) {
payload["offset"] = {
...payload.offset,
uri: payload.uris[0]
};
} else {
payload["offset"] = {
uri: payload.uris[0]
};
}
delete payload.uris;

@@ -386,0 +415,0 @@ }

2

package.json
{
"name": "cody-music",
"version": "2.6.18",
"version": "2.6.19",
"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",

@@ -321,2 +321,9 @@ # cody-music

/**
* Play a specific spotify track by trackId (it can be the URI or the ID)
* @param trackId
* @param deviceId (optional)
*/
playSpotifyTrack(trackId: string, deviceId: string = "")
/**
* Initiate the pause command for a specific player

@@ -323,0 +330,0 @@ * @param player {spotify|spotify-web|itunes}

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc