Huge News!Announcing our $40M Series B led by Abstract Ventures.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.86 to 2.6.87

6

dist/lib/apis.d.ts

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

* Returns the recommended tracks for the
* @param trackIds (required) 1 or more
* @param trackIds (optional) track IDs or URIs (5 max)
* @param limit (optional) will default to 40 if not specified
* @param market (optional) will default to none if not specified
* @param min_popularity (optional) will default to a min or 20
* @param seed_genres (optional) the supported spotify genres (5 max)
* @param seed_genres (optional) artist IDs or URIs (5 max)
*/
export declare function getRecommendationsForTracks(trackIds: string[], limit?: number, market?: string, min_popularity?: number): Promise<Track[]>;
export declare function getRecommendationsForTracks(trackIds?: string[], limit?: number, market?: string, min_popularity?: number, seed_genres?: string[], seed_artists?: string[]): Promise<Track[]>;
/**

@@ -88,0 +90,0 @@ * Returns the currently running track.

@@ -152,9 +152,11 @@ "use strict";

* Returns the recommended tracks for the
* @param trackIds (required) 1 or more
* @param trackIds (optional) track IDs or URIs (5 max)
* @param limit (optional) will default to 40 if not specified
* @param market (optional) will default to none if not specified
* @param min_popularity (optional) will default to a min or 20
* @param seed_genres (optional) the supported spotify genres (5 max)
* @param seed_genres (optional) artist IDs or URIs (5 max)
*/
async function getRecommendationsForTracks(trackIds, limit = 40, market = "", min_popularity = 20) {
return musicPlayerCtr.getRecommendationsForTracks(trackIds, limit, market, min_popularity);
async function getRecommendationsForTracks(trackIds = [], limit = 40, market = "", min_popularity = 20, seed_genres = [], seed_artists = []) {
return musicPlayerCtr.getRecommendationsForTracks(trackIds, limit, market, min_popularity, seed_genres, seed_artists);
}

@@ -161,0 +163,0 @@ exports.getRecommendationsForTracks = getRecommendationsForTracks;

@@ -47,3 +47,3 @@ import { PlayerDevice, Track, PlayerContext, Artist, PlayerName } from "./models";

getSpotifyRecentlyPlayedTracks(limit: number): Promise<Track[]>;
getRecommendationsForTracks(trackIds: string[], limit?: number, market?: string, min_popularity?: number): Promise<Track[]>;
getRecommendationsForTracks(seed_tracks?: string[], limit?: number, market?: string, min_popularity?: number, seed_genres?: string[], seed_artists?: string[]): Promise<Track[]>;
getSpotifyPlayerContext(): Promise<PlayerContext>;

@@ -50,0 +50,0 @@ launchAndPlaySpotifyTrack(trackId?: string, playlistId?: string, playerName?: PlayerName): Promise<void>;

@@ -297,15 +297,31 @@ "use strict";

}
async getRecommendationsForTracks(trackIds, limit = 40, market = "", min_popularity = 20) {
async getRecommendationsForTracks(seed_tracks = [], limit = 40, market = "", min_popularity = 20, seed_genres = [], seed_artists = []) {
let tracks = [];
// change the trackIds to non-uri ids
trackIds = musicUtil.createTrackIdsFromUris(trackIds);
seed_tracks = musicUtil.createTrackIdsFromUris(seed_tracks);
// the create trackIds will create normal artist ids as well
seed_artists = musicUtil.createTrackIdsFromUris(seed_artists);
// it can only take up to 5, remove the rest
if (trackIds.length > 5) {
trackIds.length = 5;
if (seed_tracks.length > 5) {
seed_tracks.length = 5;
}
if (seed_genres.length > 5) {
seed_genres.length = 5;
}
if (seed_artists.length > 5) {
seed_artists.length = 5;
}
const qsOptions = {
seed_tracks: trackIds.join(","),
limit,
min_popularity
min_popularity,
};
if (seed_genres.length) {
qsOptions["seed_genres"] = seed_genres.join(",");
}
if (seed_tracks.length) {
qsOptions["seed_tracks"] = seed_tracks.join(",");
}
if (seed_artists.length) {
qsOptions["seed_artists"] = seed_artists.join(",");
}
if (market) {

@@ -312,0 +328,0 @@ qsOptions["market"] = market;

@@ -165,12 +165,16 @@ "use strict";

* Returns the recommended tracks for the
* @param trackIds (required) 1 or more
* @param trackIds (optional) track IDs or URIs (5 max)
* @param limit (optional) will default to 40 if not specified
* @param market (optional) will default to none if not specified
* @param min_popularity (optional) will default to a min or 20
* @param seed_genres (optional) the supported spotify genres (5 max)
* @param seed_genres (optional) artist IDs or URIs (5 max)
*/
export async function getRecommendationsForTracks(
trackIds: string[],
trackIds: string[] = [],
limit: number = 40,
market: string = "",
min_popularity: number = 20
min_popularity: number = 20,
seed_genres: string[] = [],
seed_artists: string[] = []
): Promise<Track[]> {

@@ -181,3 +185,5 @@ return musicPlayerCtr.getRecommendationsForTracks(

market,
min_popularity
min_popularity,
seed_genres,
seed_artists
);

@@ -184,0 +190,0 @@ }

@@ -362,6 +362,8 @@ import { MusicUtil } from "./util";

async getRecommendationsForTracks(
trackIds: string[],
seed_tracks: string[] = [],
limit: number = 40,
market: string = "",
min_popularity: number = 20
min_popularity: number = 20,
seed_genres: string[] = [],
seed_artists: string[] = []
) {

@@ -371,12 +373,28 @@ let tracks: Track[] = [];

// change the trackIds to non-uri ids
trackIds = musicUtil.createTrackIdsFromUris(trackIds);
seed_tracks = musicUtil.createTrackIdsFromUris(seed_tracks);
// the create trackIds will create normal artist ids as well
seed_artists = musicUtil.createTrackIdsFromUris(seed_artists);
// it can only take up to 5, remove the rest
if (trackIds.length > 5) {
trackIds.length = 5;
if (seed_tracks.length > 5) {
seed_tracks.length = 5;
}
if (seed_genres.length > 5) {
seed_genres.length = 5;
}
if (seed_artists.length > 5) {
seed_artists.length = 5;
}
const qsOptions: any = {
seed_tracks: trackIds.join(","),
limit,
min_popularity
min_popularity,
};
if (seed_genres.length) {
qsOptions["seed_genres"] = seed_genres.join(",");
}
if (seed_tracks.length) {
qsOptions["seed_tracks"] = seed_tracks.join(",");
}
if (seed_artists.length) {
qsOptions["seed_artists"] = seed_artists.join(",");
}
if (market) {

@@ -383,0 +401,0 @@ qsOptions["market"] = market;

{
"name": "cody-music",
"version": "2.6.86",
"version": "2.6.87",
"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",

@@ -230,6 +230,8 @@ # cody-music

* Returns the recommended tracks for the
* @param trackIds (required) 1 or more
* @param trackIds (optional) track IDs or URIs (5 max)
* @param limit (optional) will default to 40 if not specified
* @param market (optional) will default to none if not specified
* @param min_popularity (optional) will default to a min or 20
* @param seed_genres (optional) the supported spotify genres (5 max)
* @param seed_genres (optional) artist IDs or URIs (5 max)
*/

@@ -236,0 +238,0 @@ getRecommendationsForTracks(

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