From 8930f1833bb375926bd663a77f9e54ab348eca5a Mon Sep 17 00:00:00 2001 From: Allen Petersen Date: Sun, 11 Jun 2017 09:13:51 -0400 Subject: [PATCH] Changes from code review: fixes the incorrect class for logging in DispatchingContentDirectory, broadcasts search capabilities, and removes an assignment that was not longer necessary. Also added a couple of comments for clarity on the '- All Albums-' options. --- .../libresonic/player/service/upnp/ArtistUpnpProcessor.java | 2 ++ .../player/service/upnp/DispatchingContentDirectory.java | 3 +-- .../player/service/upnp/LibresonicContentDirectory.java | 5 +++++ .../player/service/upnp/RecentAlbumUpnpProcessor.java | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/ArtistUpnpProcessor.java b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/ArtistUpnpProcessor.java index c8145173..2c8bd1c3 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/ArtistUpnpProcessor.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/ArtistUpnpProcessor.java @@ -73,6 +73,8 @@ public class ArtistUpnpProcessor extends UpnpContentProcessor { List allFolders = getDispatcher().getSettingsService().getAllMusicFolders(); List allAlbums = getAlbumProcessor().getAlbumDao().getAlbumsForArtist(artist.getName(), allFolders); if (allAlbums.size() > 1) { + // if the artist has more than one album, add in an option to + // view the tracks in all the albums together Album viewAll = new Album(); viewAll.setName("- All Albums -"); viewAll.setId(-1); diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/DispatchingContentDirectory.java b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/DispatchingContentDirectory.java index 93056c00..ab60176f 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/DispatchingContentDirectory.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/DispatchingContentDirectory.java @@ -51,7 +51,7 @@ import java.util.Arrays; */ public class DispatchingContentDirectory extends LibresonicContentDirectory { - public static final Logger LOG = LoggerFactory.getLogger(FolderBasedContentDirectory.class); + public static final Logger LOG = LoggerFactory.getLogger(DispatchingContentDirectory.class); public static final String CONTAINER_ID_ROOT = "0"; public static final String CONTAINER_ID_PLAYLIST_PREFIX = "playlist"; @@ -118,7 +118,6 @@ public class DispatchingContentDirectory extends LibresonicContentDirectory { // if it's null then assume it's a file, and that the id // is all that's there. itemId = browseRoot; - browseRoot = "folder"; processor = getMediaFileProcessor(); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/LibresonicContentDirectory.java b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/LibresonicContentDirectory.java index 587989c8..8f681e76 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/LibresonicContentDirectory.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/LibresonicContentDirectory.java @@ -19,6 +19,7 @@ */ package org.libresonic.player.service.upnp; +import com.google.common.collect.Lists; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.fourthline.cling.support.contentdirectory.AbstractContentDirectoryService; @@ -51,6 +52,10 @@ public abstract class LibresonicContentDirectory extends AbstractContentDirector private TranscodingService transcodingService; protected JWTSecurityService jwtSecurityService; + public LibresonicContentDirectory() { + super(Lists.newArrayList("*"), Lists.newArrayList()); + } + protected Res createResourceForSong(MediaFile song) { Player player = playerService.getGuestPlayer(null); diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/RecentAlbumUpnpProcessor.java b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/RecentAlbumUpnpProcessor.java index c85784ff..3c491d17 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/upnp/RecentAlbumUpnpProcessor.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/upnp/RecentAlbumUpnpProcessor.java @@ -39,6 +39,8 @@ public class RecentAlbumUpnpProcessor extends AlbumUpnpProcessor { List allFolders = getDispatchingContentDirectory().getSettingsService().getAllMusicFolders(); List recentAlbums = getAlbumDao().getNewestAlbums(0, RECENT_COUNT, allFolders); if (recentAlbums.size() > 1) { + // if there is more than one recent album, add in an option to + // view the tracks in all the recent albums together Album viewAll = new Album(); viewAll.setName("- All Albums -"); viewAll.setId(-1);