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


Java MediaLibraryStatistics.getTotalDurationInSeconds方法代碼示例

本文整理匯總了Java中net.sourceforge.subsonic.domain.MediaLibraryStatistics.getTotalDurationInSeconds方法的典型用法代碼示例。如果您正苦於以下問題:Java MediaLibraryStatistics.getTotalDurationInSeconds方法的具體用法?Java MediaLibraryStatistics.getTotalDurationInSeconds怎麽用?Java MediaLibraryStatistics.getTotalDurationInSeconds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.sourceforge.subsonic.domain.MediaLibraryStatistics的用法示例。


在下文中一共展示了MediaLibraryStatistics.getTotalDurationInSeconds方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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


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