From 45085ca3b8e1d00a26e4ce895d14f8c1d9977561 Mon Sep 17 00:00:00 2001 From: Andrew DeMaria Date: Fri, 23 Sep 2016 23:06:36 -0400 Subject: [PATCH 01/22] Removed iml files Signed-off-by: Andrew DeMaria --- libresonic-main/libresonic-main.iml | 105 ------------------ libresonic-rest-api/libresonic-rest-api.iml | 13 --- libresonic-sonos-api/libresonic-sonos-api.iml | 13 --- libresonic.iml | 12 -- 4 files changed, 143 deletions(-) delete mode 100644 libresonic-main/libresonic-main.iml delete mode 100644 libresonic-rest-api/libresonic-rest-api.iml delete mode 100644 libresonic-sonos-api/libresonic-sonos-api.iml delete mode 100644 libresonic.iml diff --git a/libresonic-main/libresonic-main.iml b/libresonic-main/libresonic-main.iml deleted file mode 100644 index 4ac8de09..00000000 --- a/libresonic-main/libresonic-main.iml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libresonic-rest-api/libresonic-rest-api.iml b/libresonic-rest-api/libresonic-rest-api.iml deleted file mode 100644 index e8c2a00a..00000000 --- a/libresonic-rest-api/libresonic-rest-api.iml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/libresonic-sonos-api/libresonic-sonos-api.iml b/libresonic-sonos-api/libresonic-sonos-api.iml deleted file mode 100644 index e8c2a00a..00000000 --- a/libresonic-sonos-api/libresonic-sonos-api.iml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/libresonic.iml b/libresonic.iml deleted file mode 100644 index 987693c7..00000000 --- a/libresonic.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file From 8a8a03a66f47af2198bc0775a837859fbd646aae Mon Sep 17 00:00:00 2001 From: Andrew DeMaria Date: Tue, 25 Oct 2016 18:32:36 -0600 Subject: [PATCH 02/22] Updated gitignore for intellij Signed-off-by: Andrew DeMaria --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 88a64dc8..54c77670 100644 --- a/.gitignore +++ b/.gitignore @@ -110,6 +110,10 @@ local.properties # Eclipse Core .project +# Intellij +*.iml +.idea + # External tool builders .externalToolBuilders/ From 88e4dd35b8364057cc5a4910b7abf4ac47ae57db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20Thomas?= Date: Tue, 19 Jul 2016 22:22:33 +0200 Subject: [PATCH 03/22] Add list reload delay user preference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: François-Xavier Thomas Signed-off-by: Andrew DeMaria --- .../command/PersonalSettingsCommand.java | 9 ++++ .../player/controller/HomeController.java | 3 +- .../player/controller/MultiController.java | 1 + .../PersonalSettingsController.java | 2 + .../libresonic/player/dao/HsqlDaoHelper.java | 3 +- .../org/libresonic/player/dao/UserDao.java | 5 +- .../player/dao/schema/hsql/Schema61.java | 48 +++++++++++++++++++ .../player/domain/UserSettings.java | 9 ++++ .../player/service/SettingsService.java | 1 + .../player/i18n/ResourceBundle_en.properties | 1 + .../src/main/webapp/WEB-INF/jsp/home.jsp | 4 +- .../webapp/WEB-INF/jsp/personalSettings.jsp | 7 +++ 12 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema61.java diff --git a/libresonic-main/src/main/java/org/libresonic/player/command/PersonalSettingsCommand.java b/libresonic-main/src/main/java/org/libresonic/player/command/PersonalSettingsCommand.java index 81f5d3ec..bea8cd23 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/command/PersonalSettingsCommand.java +++ b/libresonic-main/src/main/java/org/libresonic/player/command/PersonalSettingsCommand.java @@ -57,6 +57,7 @@ public class PersonalSettingsCommand { private boolean songNotificationEnabled; private boolean queueFollowingSongs; private boolean lastFmEnabled; + private int listReloadDelay; private String lastFmUsername; private String lastFmPassword; private boolean isReloadNeeded; @@ -237,6 +238,14 @@ public class PersonalSettingsCommand { this.lastFmEnabled = lastFmEnabled; } + public int getListReloadDelay() { + return listReloadDelay; + } + + public void setListReloadDelay(int listReloadDelay) { + this.listReloadDelay = listReloadDelay; + } + public String getLastFmUsername() { return lastFmUsername; } diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/HomeController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/HomeController.java index 8f943a54..c6b0ef68 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/HomeController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/HomeController.java @@ -76,8 +76,8 @@ public class HomeController extends ParameterizableViewController { } int listOffset = getIntParameter(request, "listOffset", 0); AlbumListType listType = AlbumListType.fromId(getStringParameter(request, "listType")); + UserSettings userSettings = settingsService.getUserSettings(user.getUsername()); if (listType == null) { - UserSettings userSettings = settingsService.getUserSettings(user.getUsername()); listType = userSettings.getDefaultAlbumList(); } @@ -140,6 +140,7 @@ public class HomeController extends ParameterizableViewController { map.put("coverArtSize", CoverArtScheme.MEDIUM.getSize()); map.put("listOffset", listOffset); map.put("musicFolder", selectedMusicFolder); + map.put("listReloadDelay", userSettings.getListReloadDelay()); ModelAndView result = super.handleRequestInternal(request, response); result.addObject("model", map); diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/MultiController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/MultiController.java index 8564e46e..883e7670 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/MultiController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/MultiController.java @@ -239,6 +239,7 @@ public class MultiController extends MultiActionController { Map map = new HashMap(); map.put("showRight", userSettings.isShowNowPlayingEnabled() || userSettings.isShowChatEnabled()); map.put("autoHidePlayQueue", userSettings.isAutoHidePlayQueue()); + map.put("listReloadDelay", userSettings.getListReloadDelay()); map.put("showSideBar", userSettings.isShowSideBar()); map.put("brand", settingsService.getBrand()); return new ModelAndView("index", "model", map); diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PersonalSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PersonalSettingsController.java index 64808a2c..e772c224 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PersonalSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/PersonalSettingsController.java @@ -73,6 +73,7 @@ public class PersonalSettingsController extends SimpleFormController { command.setBetaVersionNotificationEnabled(userSettings.isBetaVersionNotificationEnabled()); command.setSongNotificationEnabled(userSettings.isSongNotificationEnabled()); command.setAutoHidePlayQueue(userSettings.isAutoHidePlayQueue()); + command.setListReloadDelay(userSettings.getListReloadDelay()); command.setLastFmEnabled(userSettings.isLastFmEnabled()); command.setLastFmUsername(userSettings.getLastFmUsername()); command.setLastFmPassword(userSettings.getLastFmPassword()); @@ -135,6 +136,7 @@ public class PersonalSettingsController extends SimpleFormController { settings.setBetaVersionNotificationEnabled(command.isBetaVersionNotificationEnabled()); settings.setSongNotificationEnabled(command.isSongNotificationEnabled()); settings.setAutoHidePlayQueue(command.isAutoHidePlayQueue()); + settings.setListReloadDelay(command.getListReloadDelay()); settings.setLastFmEnabled(command.isLastFmEnabled()); settings.setLastFmUsername(command.getLastFmUsername()); settings.setSystemAvatarId(getSystemAvatarId(command)); diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/HsqlDaoHelper.java b/libresonic-main/src/main/java/org/libresonic/player/dao/HsqlDaoHelper.java index 98137858..792a5ef1 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/HsqlDaoHelper.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/HsqlDaoHelper.java @@ -52,6 +52,7 @@ import org.libresonic.player.dao.schema.hsql.Schema50; import org.libresonic.player.dao.schema.hsql.Schema51; import org.libresonic.player.dao.schema.hsql.Schema52; import org.libresonic.player.dao.schema.hsql.Schema53; +import org.libresonic.player.dao.schema.hsql.Schema61; import org.libresonic.player.service.SettingsService; /** @@ -67,7 +68,7 @@ public class HsqlDaoHelper implements DaoHelper { new Schema30(), new Schema31(), new Schema32(), new Schema33(), new Schema34(), new Schema35(), new Schema36(), new Schema37(), new Schema38(), new Schema40(), new Schema43(), new Schema45(), new Schema46(), new Schema47(), new Schema49(), - new Schema50(), new Schema51(), new Schema52(), new Schema53()}; + new Schema50(), new Schema51(), new Schema52(), new Schema53(), new Schema61()}; private DataSource dataSource; private static boolean shutdownHookAdded; diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/UserDao.java b/libresonic-main/src/main/java/org/libresonic/player/dao/UserDao.java index 8af3216e..e95383c0 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/UserDao.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/UserDao.java @@ -49,7 +49,7 @@ public class UserDao extends AbstractDao { "playlist_year, playlist_bit_rate, playlist_duration, playlist_format, playlist_file_size, " + "last_fm_enabled, last_fm_username, last_fm_password, transcode_scheme, show_now_playing, selected_music_folder_id, " + "party_mode_enabled, now_playing_allowed, avatar_scheme, system_avatar_id, changed, show_chat, show_artist_info, auto_hide_play_queue, " + - "view_as_list, default_album_list, queue_following_songs, show_side_bar"; + "view_as_list, default_album_list, queue_following_songs, show_side_bar, list_reload_delay"; private static final Integer ROLE_ID_ADMIN = 1; private static final Integer ROLE_ID_DOWNLOAD = 2; @@ -193,7 +193,7 @@ public class UserDao extends AbstractDao { settings.getAvatarScheme().name(), settings.getSystemAvatarId(), settings.getChanged(), settings.isShowChatEnabled(), settings.isShowArtistInfoEnabled(), settings.isAutoHidePlayQueue(), settings.isViewAsList(), settings.getDefaultAlbumList().getId(), settings.isQueueFollowingSongs(), - settings.isShowSideBar()}); + settings.isShowSideBar(), settings.getListReloadDelay()}); } private static String encrypt(String s) { @@ -354,6 +354,7 @@ public class UserDao extends AbstractDao { settings.setDefaultAlbumList(AlbumListType.fromId(rs.getString(col++))); settings.setQueueFollowingSongs(rs.getBoolean(col++)); settings.setShowSideBar(rs.getBoolean(col++)); + settings.setListReloadDelay((Integer) rs.getObject(col++)); return settings; } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema61.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema61.java new file mode 100644 index 00000000..d2634efa --- /dev/null +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema61.java @@ -0,0 +1,48 @@ +/* + * This file is part of Libresonic. + * + * Libresonic is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Libresonic is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Libresonic. If not, see . + */ +package org.libresonic.player.dao.schema.hsql; + +import org.springframework.jdbc.core.JdbcTemplate; + +import org.libresonic.player.Logger; +import org.libresonic.player.dao.schema.Schema; + +/** + * Used for creating and evolving the database schema. + * This class implements the database schema for Libresonic version 6.1. + * + * @author François-Xavier Thomas + */ +public class Schema61 extends Schema { + + private static final Logger LOG = Logger.getLogger(Schema61.class); + + @Override + public void execute(JdbcTemplate template) { + + if (template.queryForInt("select count(*) from version where version = 26") == 0) { + LOG.info("Updating database schema to version 26."); + template.execute("insert into version values (26)"); + } + + if (!columnExists(template, "list_reload_delay", "user_settings")) { + LOG.info("Database column 'user_settings.list_reload_delay' not found. Creating it."); + template.execute("alter table user_settings add list_reload_delay int default 60 not null"); + LOG.info("Database column 'user_settings.list_reload_delay' was added successfully."); + } + } +} diff --git a/libresonic-main/src/main/java/org/libresonic/player/domain/UserSettings.java b/libresonic-main/src/main/java/org/libresonic/player/domain/UserSettings.java index 6b587fd1..05a9139c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/domain/UserSettings.java +++ b/libresonic-main/src/main/java/org/libresonic/player/domain/UserSettings.java @@ -46,6 +46,7 @@ public class UserSettings { private Visibility mainVisibility = new Visibility(); private Visibility playlistVisibility = new Visibility(); private boolean lastFmEnabled; + private int listReloadDelay; private String lastFmUsername; private String lastFmPassword; private TranscodeScheme transcodeScheme = TranscodeScheme.OFF; @@ -156,6 +157,14 @@ public class UserSettings { this.lastFmEnabled = lastFmEnabled; } + public int getListReloadDelay() { + return listReloadDelay; + } + + public void setListReloadDelay(int listReloadDelay) { + this.listReloadDelay = listReloadDelay; + } + public String getLastFmUsername() { return lastFmUsername; } diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/SettingsService.java b/libresonic-main/src/main/java/org/libresonic/player/service/SettingsService.java index 63b454a0..2c579baf 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/SettingsService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/SettingsService.java @@ -1270,6 +1270,7 @@ public class SettingsService { settings.setQueueFollowingSongs(true); settings.setDefaultAlbumList(AlbumListType.RANDOM); settings.setLastFmEnabled(false); + settings.setListReloadDelay(60); settings.setLastFmUsername(null); settings.setLastFmPassword(null); settings.setChanged(new Date()); 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 8f240eb2..326aa05b 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 @@ -378,6 +378,7 @@ personalsettings.autohideplayqueue = Auto-hide play queue personalsettings.finalversionnotification = Notify me about new versions personalsettings.betaversionnotification = Notify me about new beta versions personalsettings.songnotification = Notify me when new songs are played (not supported by all browsers) +personalsettings.listreloaddelay = Album list reload delay (in seconds, 0 disables) personalsettings.lastfmenabled = Register what I'm playing at Last.fm personalsettings.lastfmusername = Last.fm username personalsettings.lastfmpassword = Last.fm password diff --git a/libresonic-main/src/main/webapp/WEB-INF/jsp/home.jsp b/libresonic-main/src/main/webapp/WEB-INF/jsp/home.jsp index 124d16a3..3ed409b2 100644 --- a/libresonic-main/src/main/webapp/WEB-INF/jsp/home.jsp +++ b/libresonic-main/src/main/webapp/WEB-INF/jsp/home.jsp @@ -7,7 +7,9 @@