cody-music
Advanced tools
Comparing version 2.6.87 to 2.6.88
@@ -84,6 +84,9 @@ import { PlayerName, Track, PlayerDevice, SpotifyAudioFeature, PlaylistItem, CodyResponse, CodyConfig, PlayerContext, SpotifyAuthState } from "./models"; | ||
* @param min_popularity (optional) will default to a min or 20 | ||
* @param target_popularity (optional) will default to 90 | ||
* @param seed_genres (optional) the supported spotify genres (5 max) | ||
* @param seed_genres (optional) artist IDs or URIs (5 max) | ||
* @param features (optional) supports the tunable track attributes using min_*, max_*, and target_* | ||
* i.e. {max_valence: 0.3, target_valence: 0.1} | ||
*/ | ||
export declare function getRecommendationsForTracks(trackIds?: string[], limit?: number, market?: string, min_popularity?: number, seed_genres?: string[], seed_artists?: string[]): Promise<Track[]>; | ||
export declare function getRecommendationsForTracks(trackIds?: string[], limit?: number, market?: string, min_popularity?: number, target_popularity?: number, seed_genres?: string[], seed_artists?: string[], features?: any): Promise<Track[]>; | ||
/** | ||
@@ -90,0 +93,0 @@ * Returns the currently running track. |
@@ -156,7 +156,10 @@ "use strict"; | ||
* @param min_popularity (optional) will default to a min or 20 | ||
* @param target_popularity (optional) will default to 90 | ||
* @param seed_genres (optional) the supported spotify genres (5 max) | ||
* @param seed_genres (optional) artist IDs or URIs (5 max) | ||
* @param features (optional) supports the tunable track attributes using min_*, max_*, and target_* | ||
* i.e. {max_valence: 0.3, target_valence: 0.1} | ||
*/ | ||
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); | ||
async function getRecommendationsForTracks(trackIds = [], limit = 40, market = "", min_popularity = 20, target_popularity = 100, seed_genres = [], seed_artists = [], features = {}) { | ||
return musicPlayerCtr.getRecommendationsForTracks(trackIds, limit, market, min_popularity, target_popularity, seed_genres, seed_artists, features); | ||
} | ||
@@ -163,0 +166,0 @@ exports.getRecommendationsForTracks = getRecommendationsForTracks; |
@@ -47,3 +47,3 @@ import { PlayerDevice, Track, PlayerContext, Artist, PlayerName } from "./models"; | ||
getSpotifyRecentlyPlayedTracks(limit: number): Promise<Track[]>; | ||
getRecommendationsForTracks(seed_tracks?: string[], limit?: number, market?: string, min_popularity?: number, seed_genres?: string[], seed_artists?: string[]): Promise<Track[]>; | ||
getRecommendationsForTracks(seed_tracks?: string[], limit?: number, market?: string, min_popularity?: number, target_popularity?: number, seed_genres?: string[], seed_artists?: string[], features?: any): Promise<Track[]>; | ||
getSpotifyPlayerContext(): Promise<PlayerContext>; | ||
@@ -50,0 +50,0 @@ launchAndPlaySpotifyTrack(trackId?: string, playlistId?: string, playerName?: PlayerName): Promise<void>; |
@@ -297,3 +297,3 @@ "use strict"; | ||
} | ||
async getRecommendationsForTracks(seed_tracks = [], limit = 40, market = "", min_popularity = 20, seed_genres = [], seed_artists = []) { | ||
async getRecommendationsForTracks(seed_tracks = [], limit = 40, market = "", min_popularity = 20, target_popularity = 90, seed_genres = [], seed_artists = [], features = {}) { | ||
let tracks = []; | ||
@@ -317,2 +317,3 @@ // change the trackIds to non-uri ids | ||
min_popularity, | ||
target_popularity | ||
}; | ||
@@ -331,2 +332,8 @@ if (seed_genres.length) { | ||
} | ||
const featureKeys = Object.keys(features); | ||
if (featureKeys.length) { | ||
featureKeys.forEach(key => { | ||
qsOptions[key] = features[key]; | ||
}); | ||
} | ||
const api = `/v1/recommendations`; | ||
@@ -333,0 +340,0 @@ // add to the api to prevent the querystring from escaping the comma |
@@ -86,3 +86,3 @@ "use strict"; | ||
let limit = 5; | ||
let recommendedTracks = await CodyMusic.getRecommendationsForTracks(["4ut5G4rgB1ClpMTMfjoIuy"], limit, "US", 2); | ||
let recommendedTracks = await CodyMusic.getRecommendationsForTracks(["4ut5G4rgB1ClpMTMfjoIuy"], limit, "US", 2, 10, [], [], { min_valence: 0.9, target_energy: 0.8 }); | ||
let names = recommendedTracks.map(track => { | ||
@@ -89,0 +89,0 @@ return track.name; |
@@ -169,4 +169,7 @@ "use strict"; | ||
* @param min_popularity (optional) will default to a min or 20 | ||
* @param target_popularity (optional) will default to 90 | ||
* @param seed_genres (optional) the supported spotify genres (5 max) | ||
* @param seed_genres (optional) artist IDs or URIs (5 max) | ||
* @param features (optional) supports the tunable track attributes using min_*, max_*, and target_* | ||
* i.e. {max_valence: 0.3, target_valence: 0.1} | ||
*/ | ||
@@ -178,4 +181,6 @@ export async function getRecommendationsForTracks( | ||
min_popularity: number = 20, | ||
target_popularity: number = 100, | ||
seed_genres: string[] = [], | ||
seed_artists: string[] = [] | ||
seed_artists: string[] = [], | ||
features: any = {} | ||
): Promise<Track[]> { | ||
@@ -187,4 +192,6 @@ return musicPlayerCtr.getRecommendationsForTracks( | ||
min_popularity, | ||
target_popularity, | ||
seed_genres, | ||
seed_artists | ||
seed_artists, | ||
features | ||
); | ||
@@ -191,0 +198,0 @@ } |
@@ -366,4 +366,6 @@ import { MusicUtil } from "./util"; | ||
min_popularity: number = 20, | ||
target_popularity: number = 90, | ||
seed_genres: string[] = [], | ||
seed_artists: string[] = [] | ||
seed_artists: string[] = [], | ||
features: any = {} | ||
) { | ||
@@ -389,2 +391,3 @@ let tracks: Track[] = []; | ||
min_popularity, | ||
target_popularity | ||
}; | ||
@@ -403,2 +406,8 @@ if (seed_genres.length) { | ||
} | ||
const featureKeys = Object.keys(features); | ||
if (featureKeys.length) { | ||
featureKeys.forEach(key => { | ||
qsOptions[key] = features[key]; | ||
}); | ||
} | ||
const api = `/v1/recommendations`; | ||
@@ -405,0 +414,0 @@ |
{ | ||
"name": "cody-music", | ||
"version": "2.6.87", | ||
"version": "2.6.88", | ||
"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", |
@@ -234,11 +234,18 @@ # cody-music | ||
* @param min_popularity (optional) will default to a min or 20 | ||
* @param target_popularity (optional) will default to 100 | ||
* @param seed_genres (optional) the supported spotify genres (5 max) | ||
* @param seed_genres (optional) artist IDs or URIs (5 max) | ||
* @param features (optional) supports the tunable track attributes using min_*, max_*, and target_* | ||
* i.e. {max_valence: 0.3, target_valence: 0.1} | ||
*/ | ||
getRecommendationsForTracks( | ||
trackIds: string[], | ||
trackIds: string[] = [], | ||
limit: number = 40, | ||
market: string = "", | ||
min_popularity: number = 20 | ||
): Promise<Track[]> | ||
min_popularity: number = 20, | ||
target_popularity: number = 100, | ||
seed_genres: string[] = [], | ||
seed_artists: string[] = [], | ||
features: any = {} | ||
): Promise<Track[]> { | ||
@@ -245,0 +252,0 @@ /** |
@@ -87,3 +87,7 @@ const expect = require("chai").expect; | ||
"US", | ||
2 | ||
2, | ||
10, | ||
[], | ||
[], | ||
{min_valence: 0.9, target_energy: 0.8} | ||
); | ||
@@ -90,0 +94,0 @@ |
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
522249
12741
762