Skip to content

Commit

Permalink
fix max items being only 50 instead o 100 for albums
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed Jan 30, 2022
1 parent 86d9940 commit e080196
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group "com.github"
version "1.0.16"
version "1.0.17"

sourceCompatibility = 11
compileJava.options.encoding = "UTF-8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public class SpotifySourceManager implements AudioSourceManager{

public static final Pattern SPOTIFY_URL_PATTERN = Pattern.compile("(https?://)?(www\\.)?open\\.spotify\\.com/(user/[a-zA-Z0-9-_]+/)?(?<type>track|album|playlist|artist)/(?<identifier>[a-zA-Z0-9-_]+)");
public static final String SEARCH_PREFIX = "spsearch:";
public static final int MAX_PAGE_ITEMS = 100;
public static final int PLAYLIST_MAX_PAGE_ITEMS = 100;
public static final int ALBUM_MAX_PAGE_ITEMS = 50;
public static final String ISRC_PATTERN = "%ISRC%";
public static final String QUERY_PATTERN = "%QUERY%";

Expand Down Expand Up @@ -169,7 +170,7 @@ public AudioItem getAlbum(String id) throws IOException, ParseException, Spotify

Paging<TrackSimplified> paging = null;
do{
paging = this.spotify.getAlbumsTracks(id).limit(MAX_PAGE_ITEMS).offset(paging == null ? 0 : paging.getOffset() + MAX_PAGE_ITEMS).build().execute();
paging = this.spotify.getAlbumsTracks(id).limit(ALBUM_MAX_PAGE_ITEMS).offset(paging == null ? 0 : paging.getOffset() + ALBUM_MAX_PAGE_ITEMS).build().execute();
for(var track : paging.getItems()){
tracks.add(SpotifyTrack.of(track, album, this));
}
Expand All @@ -185,7 +186,7 @@ public AudioItem getPlaylist(String id) throws IOException, ParseException, Spot

Paging<PlaylistTrack> paging = null;
do{
paging = this.spotify.getPlaylistsItems(id).limit(MAX_PAGE_ITEMS).offset(paging == null ? 0 : paging.getOffset() + MAX_PAGE_ITEMS).build().execute();
paging = this.spotify.getPlaylistsItems(id).limit(PLAYLIST_MAX_PAGE_ITEMS).offset(paging == null ? 0 : paging.getOffset() + PLAYLIST_MAX_PAGE_ITEMS).build().execute();
for(var item : paging.getItems()){
if(item.getIsLocal() || item.getTrack() == null || item.getTrack().getType() != ModelObjectType.TRACK){
continue;
Expand Down

0 comments on commit e080196

Please sign in to comment.