Removes an incorrect override in AlbumUpnpProcessor which was preventing
RecentAlbumUpnpProcessor from behaving correctly.

Also adds a correct getAllItemsSize() implementation for
RecentAlbumUpnpProcessor.
master
Allen Petersen 7 years ago
parent 5e47bc500e
commit b4ef434c08
  1. 16
      airsonic-main/src/main/java/org/airsonic/player/service/upnp/AlbumUpnpProcessor.java
  2. 8
      airsonic-main/src/main/java/org/airsonic/player/service/upnp/RecentAlbumUpnpProcessor.java

@ -26,10 +26,8 @@ import org.airsonic.player.domain.CoverArtScheme;
import org.airsonic.player.domain.MediaFile;
import org.airsonic.player.domain.MusicFolder;
import org.airsonic.player.service.SearchService;
import org.fourthline.cling.support.model.BrowseResult;
import org.fourthline.cling.support.model.DIDLContent;
import org.fourthline.cling.support.model.PersonWithRole;
import org.fourthline.cling.support.model.SortCriterion;
import org.fourthline.cling.support.model.container.Container;
import org.fourthline.cling.support.model.container.MusicAlbum;
import org.springframework.beans.factory.annotation.Autowired;
@ -61,20 +59,6 @@ public class AlbumUpnpProcessor extends UpnpContentProcessor <Album, MediaFile>
setRootTitle("Albums");
}
/**
* Browses the top-level content of a type.
*/
public BrowseResult browseRoot(String filter, long firstResult, long maxResults, SortCriterion[] orderBy) throws Exception {
DIDLContent didl = new DIDLContent();
List<MusicFolder> allFolders = getDispatchingContentDirectory().getSettingsService().getAllMusicFolders();
List<Album> selectedItems = getAlbumDao().getAlphabeticalAlbums((int) firstResult, (int) maxResults, false, true, allFolders);
for (Album item : selectedItems) {
addItem(didl, item);
}
return createBrowseResult(didl, (int) didl.getCount(), getAllItemsSize());
}
public Container createContainer(Album album) throws Exception {
MusicAlbum container = new MusicAlbum();

@ -37,6 +37,7 @@ public class RecentAlbumUpnpProcessor extends AlbumUpnpProcessor {
setRootTitle("RecentAlbums");
}
@Override
public List<Album> getAllItems() {
List<MusicFolder> allFolders = getDispatchingContentDirectory().getSettingsService().getAllMusicFolders();
List<Album> recentAlbums = getAlbumDao().getNewestAlbums(0, RECENT_COUNT, allFolders);
@ -51,4 +52,11 @@ public class RecentAlbumUpnpProcessor extends AlbumUpnpProcessor {
}
return recentAlbums;
}
@Override
public int getAllItemsSize() throws Exception {
List<MusicFolder> allFolders = getDispatchingContentDirectory().getSettingsService().getAllMusicFolders();
int allAlbumCount = getAlbumDao().getAlbumCount(allFolders);
return Math.min(allAlbumCount, RECENT_COUNT);
}
}

Loading…
Cancel
Save