Skip to content

Commit

Permalink
Support isrc extraction from bandcamp tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
devoxin committed May 12, 2024
1 parent af27d5e commit 1d73e28
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private AudioItem loadTrack(UrlInfo urlInfo) {
String artist = trackListInfo.get("artist").safeText();
String artworkUrl = extractArtwork(trackListInfo);

return extractTrack(trackListInfo.get("trackinfo").index(0), urlInfo.baseUrl, artist, artworkUrl);
return extractTrack(trackListInfo.get("trackinfo").index(0), urlInfo.baseUrl, artist, artworkUrl, trackListInfo.get("current").get("isrc").text());
});
}

Expand All @@ -175,15 +175,16 @@ private AudioItem loadAlbum(UrlInfo urlInfo) {

List<AudioTrack> tracks = new ArrayList<>();
for (JsonBrowser trackInfo : trackListInfo.get("trackinfo").values()) {
tracks.add(extractTrack(trackInfo, urlInfo.baseUrl, artist, artworkUrl));
// album track json does not include isrc
tracks.add(extractTrack(trackInfo, urlInfo.baseUrl, artist, artworkUrl, null));
}

JsonBrowser albumInfo = readAlbumInformation(text);
return new BasicAudioPlaylist(albumInfo.get("current").get("title").text(), tracks, null, false);
});
}

private AudioTrack extractTrack(JsonBrowser trackInfo, String bandUrl, String artist, String artworkUrl) {
private AudioTrack extractTrack(JsonBrowser trackInfo, String bandUrl, String artist, String artworkUrl, String isrc) {
String trackPageUrl = bandUrl + trackInfo.get("title_link").text();

return new BandcampAudioTrack(new AudioTrackInfo(
Expand All @@ -194,7 +195,7 @@ private AudioTrack extractTrack(JsonBrowser trackInfo, String bandUrl, String ar
false,
trackPageUrl,
artworkUrl,
null
isrc
), this);
}

Expand Down

0 comments on commit 1d73e28

Please sign in to comment.