Skip to content

Commit

Permalink
fix spotify album tracks missing isrc
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed Jan 1, 2023
1 parent f5a2b8c commit ad22982
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class SpotifySourceManager extends MirroringAudioSourceManager implements HttpConfigurable {

Expand Down Expand Up @@ -173,11 +174,9 @@ public AudioItem getAlbum(String id) throws IOException {
page = this.getJson(API_BASE + "albums/" + id + "/tracks?limit=" + ALBUM_MAX_PAGE_ITEMS + "&offset=" + offset);
offset += ALBUM_MAX_PAGE_ITEMS;

for (var track : page.get("items").values()) {
track.put("album", json);
}
var tracksPage = this.getJson(API_BASE + "tracks/?ids=" + page.get("items").values().stream().map(track -> track.get("id").text()).collect(Collectors.joining(",")));

tracks.addAll(this.parseTrackItems(page));
tracks.addAll(this.parseTracks(tracksPage));
}
while (page.get("next").text() != null);

Expand Down

0 comments on commit ad22982

Please sign in to comment.