当前位置: 首页>>代码示例>>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;未经允许,请勿转载。