Remove unused 'index' parameter from DWR addPlaylist method

master
François-Xavier Thomas 5 years ago
parent d6f116d2a8
commit 90e63817d0
  1. 15
      airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueService.java

@ -252,31 +252,20 @@ public class PlayQueueService {
return doPlayInternetRadio(request, player, radio).setStartPlayerAt(0); return doPlayInternetRadio(request, player, radio).setStartPlayerAt(0);
} }
/** public PlayQueueInfo addPlaylist(int id) throws Exception {
* @param index Start playing at this index, or play whole playlist if {@code null}.
*/
public PlayQueueInfo addPlaylist(int id, Integer index) throws Exception {
HttpServletRequest request = WebContextFactory.get().getHttpServletRequest(); HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
HttpServletResponse response = WebContextFactory.get().getHttpServletResponse(); HttpServletResponse response = WebContextFactory.get().getHttpServletResponse();
String username = securityService.getCurrentUsername(request); String username = securityService.getCurrentUsername(request);
boolean queueFollowingSongs = settingsService.getUserSettings(username).isQueueFollowingSongs();
List<MediaFile> files = playlistService.getFilesInPlaylist(id, true); List<MediaFile> files = playlistService.getFilesInPlaylist(id, true);
if (!files.isEmpty() && index != null) {
if (queueFollowingSongs) {
files = files.subList(index, files.size());
} else {
files = Arrays.asList(files.get(index));
}
}
// Remove non-present files // Remove non-present files
files.removeIf(file -> !file.isPresent()); files.removeIf(file -> !file.isPresent());
// Add to the play queue // Add to the play queue
int[] ids = files.stream().mapToInt(f -> f.getId()).toArray(); int[] ids = files.stream().mapToInt(f -> f.getId()).toArray();
return doAdd(request, response, ids, index); return doAdd(request, response, ids, null);
} }
/** /**

Loading…
Cancel
Save