cody-music
Advanced tools
Comparing version 2.9.28 to 2.9.29
@@ -205,15 +205,14 @@ "use strict"; | ||
if (artistIds.length > 50) { | ||
const maxArtists = 50; | ||
let offset = 0; | ||
let maxlen = artistIds.length / maxArtists; | ||
if (maxlen % 1 !== 0) { | ||
maxlen += 1; | ||
} | ||
for (let idx = 0; idx < maxlen; idx++) { | ||
artistIds = artistIds.splice(offset, 50); | ||
const batchedArtists = await this.getSpotifyArtistsByIds(artistIds); | ||
if (batchedArtists) { | ||
let hasData = artistIds.length ? true : false; | ||
while (hasData) { | ||
// keep removing from the artistIds | ||
let splicedArtistIds = artistIds.splice(0, 50); | ||
const batchedArtists = await this.getSpotifyArtistsByIds(splicedArtistIds); | ||
if (batchedArtists && batchedArtists.length) { | ||
artists.push(...batchedArtists); | ||
} | ||
offset += maxArtists; | ||
hasData = artistIds.length ? true : false; | ||
if (!hasData) { | ||
break; | ||
} | ||
} | ||
@@ -240,12 +239,16 @@ } | ||
let genre = ""; | ||
if (t.artists && | ||
t.artists.length > 0 && | ||
t.artists[0].genres) { | ||
// make sure we use the highest frequency genre | ||
try { | ||
genre = musicClient.getHighestFrequencySpotifyGenre(t.artists[0].genres); | ||
if (t.artists && t.artists.length) { | ||
for (let a = 0; a < t.artists.length; a++) { | ||
const artistCandidate = t.artists[a]; | ||
if (artistCandidate.genres && | ||
artistCandidate.genres.length) { | ||
try { | ||
genre = musicClient.getHighestFrequencySpotifyGenre(artistCandidate.genres); | ||
} | ||
catch (e) { | ||
// | ||
} | ||
break; | ||
} | ||
} | ||
catch (e) { | ||
// | ||
} | ||
} | ||
@@ -252,0 +255,0 @@ if (genre) { |
@@ -244,17 +244,17 @@ import { MusicUtil } from "./util"; | ||
if (artistIds.length > 50) { | ||
const maxArtists = 50; | ||
let offset = 0; | ||
let maxlen = artistIds.length / maxArtists; | ||
if (maxlen % 1 !== 0) { | ||
maxlen += 1; | ||
} | ||
for (let idx = 0; idx < maxlen; idx++) { | ||
artistIds = artistIds.splice(offset, 50); | ||
let hasData = artistIds.length ? true : false; | ||
while (hasData) { | ||
// keep removing from the artistIds | ||
let splicedArtistIds = artistIds.splice(0, 50); | ||
const batchedArtists = await this.getSpotifyArtistsByIds( | ||
artistIds | ||
splicedArtistIds | ||
); | ||
if (batchedArtists) { | ||
if (batchedArtists && batchedArtists.length) { | ||
artists.push(...batchedArtists); | ||
} | ||
offset += maxArtists; | ||
hasData = artistIds.length ? true : false; | ||
if (!hasData) { | ||
break; | ||
} | ||
} | ||
@@ -286,14 +286,18 @@ } else { | ||
let genre = ""; | ||
if ( | ||
t.artists && | ||
t.artists.length > 0 && | ||
t.artists[0].genres | ||
) { | ||
// make sure we use the highest frequency genre | ||
try { | ||
genre = musicClient.getHighestFrequencySpotifyGenre( | ||
t.artists[0].genres | ||
); | ||
} catch (e) { | ||
// | ||
if (t.artists && t.artists.length) { | ||
for (let a = 0; a < t.artists.length; a++) { | ||
const artistCandidate = t.artists[a]; | ||
if ( | ||
artistCandidate.genres && | ||
artistCandidate.genres.length | ||
) { | ||
try { | ||
genre = musicClient.getHighestFrequencySpotifyGenre( | ||
artistCandidate.genres | ||
); | ||
} catch (e) { | ||
// | ||
} | ||
break; | ||
} | ||
} | ||
@@ -300,0 +304,0 @@ } |
{ | ||
"name": "cody-music", | ||
"version": "2.9.28", | ||
"version": "2.9.29", | ||
"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", |
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
672531
16494