當前位置: 首頁>>代碼示例>>Java>>正文


Java MediaLibraryStatistics類代碼示例

本文整理匯總了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);
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:20,代碼來源:FolderBasedContentDirectory.java

示例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;
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:48,代碼來源:LeftController.java

示例3: getMediaLibraryStatistics

import net.sourceforge.subsonic.domain.MediaLibraryStatistics; //導入依賴的package包/類
public MediaLibraryStatistics getMediaLibraryStatistics() {
    return MediaLibraryStatistics.parse(getString(KEY_MEDIA_LIBRARY_STATISTICS, DEFAULT_MEDIA_LIBRARY_STATISTICS));
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:4,代碼來源:SettingsService.java

示例4: setMediaLibraryStatistics

import net.sourceforge.subsonic.domain.MediaLibraryStatistics; //導入依賴的package包/類
public void setMediaLibraryStatistics(MediaLibraryStatistics statistics) {
    setString(KEY_MEDIA_LIBRARY_STATISTICS, statistics.format());
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:4,代碼來源:SettingsService.java

示例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;
    }
 
開發者ID:FutureSonic,項目名稱:FutureSonic-Server,代碼行數:82,代碼來源:LeftController.java

示例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;
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:9,代碼來源:MediaScannerService.java


注:本文中的net.sourceforge.subsonic.domain.MediaLibraryStatistics類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。