cody-music
Advanced tools
Comparing version 2.9.27 to 2.9.28
@@ -63,2 +63,3 @@ "use strict"; | ||
let tracks = []; | ||
const totalTracksToFetch = !qsOptions.limit || qsOptions.limit === -1 ? -1 : qsOptions.limit; | ||
if (!qsOptions.limit) { | ||
@@ -87,3 +88,5 @@ qsOptions["limit"] = 50; | ||
// ensure the playerType is set | ||
trackContainers.forEach((item) => { | ||
let fetchedLimit = false; | ||
for (let x = 0; x < trackContainers.length; x++) { | ||
const item = trackContainers[x]; | ||
if (item.track) { | ||
@@ -93,3 +96,11 @@ const track = this.buildTrack(item.track); | ||
} | ||
}); | ||
if (totalTracksToFetch > 0 && | ||
tracks.length >= totalTracksToFetch) { | ||
fetchedLimit = true; | ||
break; | ||
} | ||
} | ||
if (fetchedLimit) { | ||
break; | ||
} | ||
if (codyResp.data.next) { | ||
@@ -96,0 +107,0 @@ // fetch the next set (remove the root) |
@@ -87,2 +87,5 @@ import { MusicClient, SPOTIFY_ROOT_API } from "./client"; | ||
const totalTracksToFetch = | ||
!qsOptions.limit || qsOptions.limit === -1 ? -1 : qsOptions.limit; | ||
if (!qsOptions.limit) { | ||
@@ -93,2 +96,3 @@ qsOptions["limit"] = 50; | ||
} | ||
if (!qsOptions.offset) { | ||
@@ -120,3 +124,5 @@ qsOptions["offset"] = 0; | ||
// ensure the playerType is set | ||
trackContainers.forEach((item: any) => { | ||
let fetchedLimit = false; | ||
for (let x = 0; x < trackContainers.length; x++) { | ||
const item = trackContainers[x]; | ||
if (item.track) { | ||
@@ -126,4 +132,15 @@ const track: Track = this.buildTrack(item.track); | ||
} | ||
}); | ||
if ( | ||
totalTracksToFetch > 0 && | ||
tracks.length >= totalTracksToFetch | ||
) { | ||
fetchedLimit = true; | ||
break; | ||
} | ||
} | ||
if (fetchedLimit) { | ||
break; | ||
} | ||
if (codyResp.data.next) { | ||
@@ -130,0 +147,0 @@ // fetch the next set (remove the root) |
{ | ||
"name": "cody-music", | ||
"version": "2.9.27", | ||
"version": "2.9.28", | ||
"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
671900
16488