本文整理汇总了Java中net.sourceforge.subsonic.domain.MediaLibraryStatistics类的典型用法代码示例。如果您正苦于以下问题:Java MediaLibraryStatistics类的具体用法?Java MediaLibraryStatistics怎么用?Java MediaLibraryStatistics使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MediaLibraryStatistics类属于net.sourceforge.subsonic.domain包,在下文中一共展示了MediaLibraryStatistics类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: browseRootMetadata
import net.sourceforge.subsonic.domain.MediaLibraryStatistics; //导入依赖的package包/类
private BrowseResult browseRootMetadata() throws Exception {
StorageFolder root = new StorageFolder();
root.setId(CONTAINER_ID_ROOT);
root.setParentID("-1");
MediaLibraryStatistics statistics = settingsService.getMediaLibraryStatistics();
root.setStorageUsed(statistics == null ? 0 : statistics.getTotalLengthInBytes());
root.setTitle("Subsonic Media");
root.setRestricted(true);
root.setSearchable(false);
root.setWriteStatus(WriteStatus.NOT_WRITABLE);
List<MusicFolder> musicFolders = settingsService.getAllMusicFolders();
root.setChildCount(musicFolders.size() + 1); // +1 for playlists
DIDLContent didl = new DIDLContent();
didl.addContainer(root);
return createBrowseResult(didl, 1, 1);
}
示例2: handleRequestInternal
import net.sourceforge.subsonic.domain.MediaLibraryStatistics; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
boolean musicFolderChanged = saveSelectedMusicFolder(request);
Map<String, Object> map = new HashMap<String, Object>();
MediaLibraryStatistics statistics = mediaScannerService.getStatistics();
Locale locale = RequestContextUtils.getLocale(request);
boolean refresh = ServletRequestUtils.getBooleanParameter(request, "refresh", false);
if (refresh) {
settingsService.clearMusicFolderCache();
}
String username = securityService.getCurrentUsername(request);
List<MusicFolder> allMusicFolders = settingsService.getMusicFoldersForUser(username);
MusicFolder selectedMusicFolder = settingsService.getSelectedMusicFolder(username);
List<MusicFolder> musicFoldersToUse = selectedMusicFolder == null ? allMusicFolders : Arrays.asList(selectedMusicFolder);
UserSettings userSettings = settingsService.getUserSettings(username);
MusicFolderContent musicFolderContent = musicIndexService.getMusicFolderContent(musicFoldersToUse, refresh);
map.put("player", playerService.getPlayer(request, response));
map.put("scanning", mediaScannerService.isScanning());
map.put("musicFolders", allMusicFolders);
map.put("selectedMusicFolder", selectedMusicFolder);
map.put("radios", settingsService.getAllInternetRadios());
map.put("shortcuts", musicIndexService.getShortcuts(musicFoldersToUse));
map.put("partyMode", userSettings.isPartyModeEnabled());
map.put("organizeByFolderStructure", settingsService.isOrganizeByFolderStructure());
map.put("musicFolderChanged", musicFolderChanged);
if (statistics != null) {
map.put("statistics", statistics);
long bytes = statistics.getTotalLengthInBytes();
long hours = statistics.getTotalDurationInSeconds() / 3600L;
map.put("hours", hours);
map.put("bytes", StringUtil.formatBytes(bytes, locale));
}
map.put("indexedArtists", musicFolderContent.getIndexedArtists());
map.put("singleSongs", musicFolderContent.getSingleSongs());
map.put("indexes", musicFolderContent.getIndexedArtists().keySet());
map.put("user", securityService.getCurrentUser(request));
ModelAndView result = super.handleRequestInternal(request, response);
result.addObject("model", map);
return result;
}
示例3: getMediaLibraryStatistics
import net.sourceforge.subsonic.domain.MediaLibraryStatistics; //导入依赖的package包/类
public MediaLibraryStatistics getMediaLibraryStatistics() {
return MediaLibraryStatistics.parse(getString(KEY_MEDIA_LIBRARY_STATISTICS, DEFAULT_MEDIA_LIBRARY_STATISTICS));
}
示例4: setMediaLibraryStatistics
import net.sourceforge.subsonic.domain.MediaLibraryStatistics; //导入依赖的package包/类
public void setMediaLibraryStatistics(MediaLibraryStatistics statistics) {
setString(KEY_MEDIA_LIBRARY_STATISTICS, statistics.format());
}
示例5: handleRequestInternal
import net.sourceforge.subsonic.domain.MediaLibraryStatistics; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
saveSelectedMusicFolder(request);
saveSelectedGenre(request);
Map<String, Object> map = new HashMap<String, Object>();
MediaLibraryStatistics statistics = mediaScannerService.getStatistics();
Locale locale = RequestContextUtils.getLocale(request);
String username = securityService.getCurrentUsername(request);
int userGroupId = securityService.getCurrentUserGroupId(request);
List<MusicFolder> allMusicFolders = settingsService.getAllMusicFolders(userGroupId, settingsService.isSortMediaFileFolder());
MusicFolder selectedMusicFolder = getSelectedMusicFolder(request);
String selectedGenre = getSelectedGenre(request);
List<MusicFolder> musicFoldersToUse = selectedMusicFolder == null ? allMusicFolders : Arrays.asList(selectedMusicFolder);
String[] shortcuts = settingsService.getShortcutsAsArray();
UserSettings userSettings = settingsService.getUserSettings(username);
boolean refresh = ServletRequestUtils.getBooleanParameter(request, "refresh", false);
map.put("player", playerService.getPlayer(request, response));
map.put("scanning", mediaScannerService.isScanning());
map.put("musicFolders", allMusicFolders);
map.put("selectedMusicFolder", selectedMusicFolder);
map.put("selectedGenre", selectedGenre);
List <String> _allGenres = mediaFileService.getArtistGenresforFolder(musicFoldersToUse, userGroupId);
map.put("allGenres", _allGenres);
_allGenres.add("unknown genre");
if (selectedGenre != "unknown genre") {
boolean genreFound = false;
for (String s : _allGenres) {
if (s.equals(selectedGenre)) { genreFound = true; }
}
if (genreFound == false) {
selectedGenre = "";
// if (selectedGenre == "unknown") {
// selectedGenre = "unknown genre" ;
// }
UserSettings settings = settingsService.getUserSettings(securityService.getCurrentUsername(request));
settings.setSelectedGenre(selectedGenre);
settingsService.updateUserSettings(settings);
map.put("selectedGenre", selectedGenre);
}
}
MusicFolderContent musicFolderContent = getMusicFolderContent(musicFoldersToUse, selectedGenre, refresh);
map.put("radios", settingsService.getAllInternetRadios());
map.put("shortcuts", getShortcuts(musicFoldersToUse, shortcuts));
map.put("captionCutoff", userSettings.getMainVisibility().getCaptionCutoff());
map.put("partyMode", userSettings.isPartyModeEnabled());
map.put("organizeByFolderStructure", settingsService.isOrganizeByFolderStructure());
map.put("listType", userSettings.getListType());
map.put("ShowShortcuts", settingsService.isShowShortcuts());
if (statistics != null) {
map.put("statistics", statistics);
long bytes = statistics.getTotalLengthInBytes();
long hours = statistics.getTotalDurationInSeconds() / 3600L;
map.put("hours", hours);
map.put("bytes", StringUtil.formatBytes(bytes, locale));
}
map.put("indexedArtists", musicFolderContent.getIndexedArtists());
map.put("singleSongs", musicFolderContent.getSingleSongs());
map.put("indexes", musicFolderContent.getIndexedArtists().keySet());
map.put("user", securityService.getCurrentUser(request));
map.put("customScrollbar", userSettings.isCustomScrollbarEnabled());
map.put("customAccordion", userSettings.isCustomAccordionEnabled());
map.put("playlistEnabled", settingsService.isPlaylistEnabled());
// map.put("sortMediaFileFolder", settingsService.isSortMediaFileFolder());
ModelAndView result = super.handleRequestInternal(request, response);
result.addObject("model", map);
return result;
}
示例6: getStatistics
import net.sourceforge.subsonic.domain.MediaLibraryStatistics; //导入依赖的package包/类
/**
* Returns media library statistics, including the number of artists, albums and songs.
*
* @return Media library statistics.
*/
public MediaLibraryStatistics getStatistics() {
return statistics;
}