From 1311e0220a2be72d17d46e4397cbca33615c59b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20Thomas?= Date: Sun, 6 Nov 2016 14:26:28 +0100 Subject: [PATCH] Add to playlist feature in the 'shuffle' section --- .../player/controller/RandomPlayQueueController.java | 5 ++++- .../org/libresonic/player/i18n/ResourceBundle_en.properties | 2 +- libresonic-main/src/main/webapp/WEB-INF/jsp/more.jsp | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/RandomPlayQueueController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/RandomPlayQueueController.java index 42e2687b..9759ead5 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/RandomPlayQueueController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/RandomPlayQueueController.java @@ -166,6 +166,9 @@ public class RandomPlayQueueController extends ParameterizableViewController { // Handle the music folder filter List musicFolders = getMusicFolders(request); + // Do we add to the current playlist or do we replace it? + boolean shouldAddToPlayList = ServletRequestUtils.getBooleanParameter(request, "addToPlaylist", false); + // Search the database using these criteria RandomSearchCriteria criteria = new RandomSearchCriteria( size, @@ -184,7 +187,7 @@ public class RandomPlayQueueController extends ParameterizableViewController { User user = securityService.getCurrentUser(request); Player player = playerService.getPlayer(request, response); PlayQueue playQueue = player.getPlayQueue(); - playQueue.addFiles(false, mediaFileService.getRandomSongs(criteria, user.getUsername())); + playQueue.addFiles(shouldAddToPlayList, mediaFileService.getRandomSongs(criteria, user.getUsername())); if (request.getParameter("autoRandom") != null) { playQueue.setRandomSearchCriteria(criteria); diff --git a/libresonic-main/src/main/resources/org/libresonic/player/i18n/ResourceBundle_en.properties b/libresonic-main/src/main/resources/org/libresonic/player/i18n/ResourceBundle_en.properties index 66ad6030..cfb7dcc2 100644 --- a/libresonic-main/src/main/resources/org/libresonic/player/i18n/ResourceBundle_en.properties +++ b/libresonic-main/src/main/resources/org/libresonic/player/i18n/ResourceBundle_en.properties @@ -233,7 +233,7 @@ more.random.text = Shuffle play more.random.songs = {0} songs more.random.auto = Play more random songs when end of play queue is reached. more.random.ok = OK -more.random.add = Add +more.random.add = Add to current playlist more.random.any = Any more.random.format = Format more.random.before = Before diff --git a/libresonic-main/src/main/webapp/WEB-INF/jsp/more.jsp b/libresonic-main/src/main/webapp/WEB-INF/jsp/more.jsp index 0648f112..0d5271ad 100644 --- a/libresonic-main/src/main/webapp/WEB-INF/jsp/more.jsp +++ b/libresonic-main/src/main/webapp/WEB-INF/jsp/more.jsp @@ -172,9 +172,9 @@ - - "> - "> + + "> +