本文整理汇总了Java中net.sourceforge.subsonic.domain.UserSettings类的典型用法代码示例。如果您正苦于以下问题:Java UserSettings类的具体用法?Java UserSettings怎么用?Java UserSettings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UserSettings类属于net.sourceforge.subsonic.domain包,在下文中一共展示了UserSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleRequestInternal
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
User user = securityService.getCurrentUser(request);
String username = user.getUsername();
UserSettings userSettings = settingsService.getUserSettings(username);
Player player = playerService.getPlayer(request, response);
Playlist playlist = playlistService.getPlaylist(id);
if (playlist == null) {
return new ModelAndView(new RedirectView("notFound.view"));
}
map.put("playlist", playlist);
map.put("user", user);
map.put("player", player);
map.put("editAllowed", username.equals(playlist.getUsername()) || securityService.isAdmin(username));
map.put("partyMode", userSettings.isPartyModeEnabled());
ModelAndView result = super.handleRequestInternal(request, response);
result.addObject("model", map);
return result;
}
示例2: getAvatar
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
private Avatar getAvatar(HttpServletRequest request) {
String id = request.getParameter("id");
boolean forceCustom = ServletRequestUtils.getBooleanParameter(request, "forceCustom", false);
if (id != null) {
return settingsService.getSystemAvatar(Integer.parseInt(id));
}
String username = request.getParameter("username");
if (username == null) {
return null;
}
UserSettings userSettings = settingsService.getUserSettings(username);
if (userSettings.getAvatarScheme() == AvatarScheme.CUSTOM || forceCustom) {
return settingsService.getCustomAvatar(username);
}
return settingsService.getSystemAvatar(userSettings.getSystemAvatarId());
}
示例3: handleRequestInternal
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
User user = securityService.getCurrentUser(request);
UserSettings userSettings = settingsService.getUserSettings(user.getUsername());
Player player = playerService.getPlayer(request, response);
Map<String, Object> map = new HashMap<String, Object>();
map.put("user", user);
map.put("player", player);
map.put("players", playerService.getPlayersForUserAndClientId(user.getUsername(), null));
map.put("visibility", userSettings.getPlaylistVisibility());
map.put("partyMode", userSettings.isPartyModeEnabled());
map.put("notify", userSettings.isSongNotificationEnabled());
map.put("autoHide", userSettings.isAutoHidePlayQueue());
map.put("licenseInfo", settingsService.getLicenseInfo());
ModelAndView result = super.handleRequestInternal(request, response);
result.addObject("model", map);
return result;
}
示例4: handleRequestInternal
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
ModelAndView result = super.handleRequestInternal(request, response);
UserSettings userSettings = settingsService.getUserSettings(securityService.getCurrentUsername(request));
if (userSettings.isFinalVersionNotificationEnabled() && versionService.isNewFinalVersionAvailable()) {
map.put("newVersionAvailable", true);
map.put("latestVersion", versionService.getLatestFinalVersion());
} else if (userSettings.isBetaVersionNotificationEnabled() && versionService.isNewBetaVersionAvailable()) {
map.put("newVersionAvailable", true);
map.put("latestVersion", versionService.getLatestBetaVersion());
}
map.put("brand", settingsService.getBrand());
map.put("showNowPlaying", userSettings.isShowNowPlayingEnabled());
map.put("showChat", userSettings.isShowChatEnabled());
map.put("user", securityService.getCurrentUser(request));
map.put("licenseInfo", settingsService.getLicenseInfo());
result.addObject("model", map);
return result;
}
示例5: updateUserSettings
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
/**
* Updates settings for the given username, creating it if necessary.
*
* @param settings The user-specific settings.
*/
public void updateUserSettings(UserSettings settings) {
getJdbcTemplate().update("delete from user_settings where username=?", new Object[]{settings.getUsername()});
String sql = "insert into user_settings (" + USER_SETTINGS_COLUMNS + ") values (" + questionMarks(USER_SETTINGS_COLUMNS) + ')';
String locale = settings.getLocale() == null ? null : settings.getLocale().toString();
UserSettings.Visibility main = settings.getMainVisibility();
UserSettings.Visibility playlist = settings.getPlaylistVisibility();
getJdbcTemplate().update(sql, new Object[]{settings.getUsername(), locale, settings.getThemeId(),
settings.isFinalVersionNotificationEnabled(), settings.isBetaVersionNotificationEnabled(),
settings.isSongNotificationEnabled(), main.isTrackNumberVisible(),
main.isArtistVisible(), main.isAlbumVisible(), main.isGenreVisible(), main.isYearVisible(),
main.isBitRateVisible(), main.isDurationVisible(), main.isFormatVisible(), main.isFileSizeVisible(),
playlist.isTrackNumberVisible(), playlist.isArtistVisible(), playlist.isAlbumVisible(),
playlist.isGenreVisible(), playlist.isYearVisible(), playlist.isBitRateVisible(), playlist.isDurationVisible(),
playlist.isFormatVisible(), playlist.isFileSizeVisible(),
settings.isLastFmEnabled(), settings.getLastFmUsername(), encrypt(settings.getLastFmPassword()),
settings.getTranscodeScheme().name(), settings.isShowNowPlayingEnabled(),
settings.getSelectedMusicFolderId(), settings.isPartyModeEnabled(), settings.isNowPlayingAllowed(),
settings.getAvatarScheme().name(), settings.getSystemAvatarId(), settings.getChanged(),
settings.isShowChatEnabled(), settings.isShowArtistInfoEnabled(), settings.isAutoHidePlayQueue(),
settings.isViewAsList(), settings.getDefaultAlbumList().getId(), settings.isQueueFollowingSongs(),
settings.isShowSideBar()});
}
示例6: createRegistrationData
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
private RegistrationData createRegistrationData(MediaFile mediaFile, String username, boolean submission, Date time) {
if (mediaFile == null || mediaFile.isVideo()) {
return null;
}
UserSettings userSettings = settingsService.getUserSettings(username);
if (!userSettings.isLastFmEnabled() || userSettings.getLastFmUsername() == null || userSettings.getLastFmPassword() == null) {
return null;
}
RegistrationData reg = new RegistrationData();
reg.username = userSettings.getLastFmUsername();
reg.password = userSettings.getLastFmPassword();
reg.artist = mediaFile.getArtist();
reg.album = mediaFile.getAlbumName();
reg.title = mediaFile.getTitle();
reg.duration = mediaFile.getDurationSeconds() == null ? 0 : mediaFile.getDurationSeconds();
reg.time = time == null ? new Date() : time;
reg.submission = submission;
return reg;
}
示例7: handleRequestInternal
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
User user = securityService.getCurrentUser(request);
String username = user.getUsername();
UserSettings userSettings = settingsService.getUserSettings(username);
Playlist playlist = playlistService.getPlaylist(id);
if (playlist == null) {
return new ModelAndView(new RedirectView("notFound.view"));
}
map.put("playlist", playlist);
map.put("user", user);
map.put("editAllowed", username.equals(playlist.getUsername()) || securityService.isAdmin(username));
map.put("partyMode", userSettings.isPartyModeEnabled());
ModelAndView result = super.handleRequestInternal(request, response);
result.addObject("model", map);
return result;
}
示例8: getAvatar
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
private Avatar getAvatar(HttpServletRequest request) {
String id = request.getParameter("id");
if (id != null) {
return settingsService.getSystemAvatar(Integer.parseInt(id));
}
String username = request.getParameter("username");
if (username == null) {
return null;
}
UserSettings userSettings = settingsService.getUserSettings(username);
if (userSettings.getAvatarScheme() == AvatarScheme.SYSTEM) {
return settingsService.getSystemAvatar(userSettings.getSystemAvatarId());
}
return settingsService.getCustomAvatar(username);
}
示例9: getUsers
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
public void getUsers(HttpServletRequest request, HttpServletResponse response) throws Exception {
request = wrapRequest(request);
User currentUser = securityService.getCurrentUser(request);
if (!currentUser.isAdminRole()) {
error(request, response, ErrorCode.NOT_AUTHORIZED, currentUser.getUsername() + " is not authorized to get details for other users.");
return;
}
XMLBuilder builder = createXMLBuilder(request, response, true);
builder.add("users", false);
for (User user : securityService.getAllUsers()) {
UserSettings userSettings = settingsService.getUserSettings(user.getUsername());
List<Attribute> attributes = createAttributesForUser(user, userSettings);
builder.add("user", attributes, true);
}
builder.endAll();
response.getWriter().print(builder);
}
示例10: createAttributesForUser
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
private List<Attribute> createAttributesForUser(User user, UserSettings userSettings) {
return Arrays.asList(
new Attribute("username", user.getUsername()),
new Attribute("email", user.getEmail()),
new Attribute("scrobblingEnabled", userSettings.isLastFmEnabled()),
new Attribute("adminRole", user.isAdminRole()),
new Attribute("settingsRole", user.isSettingsRole()),
new Attribute("downloadRole", user.isDownloadRole()),
new Attribute("uploadRole", user.isUploadRole()),
new Attribute("playlistRole", true), // Since 1.8.0
new Attribute("coverArtRole", user.isCoverArtRole()),
new Attribute("commentRole", user.isCommentRole()),
new Attribute("podcastRole", user.isPodcastRole()),
new Attribute("streamRole", user.isStreamRole()),
new Attribute("jukeboxRole", user.isJukeboxRole()),
new Attribute("shareRole", user.isShareRole())
);
}
示例11: handleRequestInternal
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
if (isFormSubmission(request)) {
handleParameters(request, map);
map.put("toast", true);
}
ModelAndView result = super.handleRequestInternal(request, response);
map.put("transcodings", transcodingService.getAllTranscodings());
map.put("transcodeDirectory", transcodingService.getTranscodeDirectory());
map.put("downsampleCommand", settingsService.getDownsamplingCommand());
map.put("hlsCommand", settingsService.getHlsCommand());
map.put("brand", settingsService.getBrand());
User user = securityService.getCurrentUser(request);
UserSettings userSettings = settingsService.getUserSettings(user.getUsername());
map.put("customScrollbar", userSettings.isCustomScrollbarEnabled());
result.addObject("model", map);
return result;
}
示例12: handleRequestInternal
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
User user = securityService.getCurrentUser(request);
UserSettings userSettings = settingsService.getUserSettings(user.getUsername());
Player player = playerService.getPlayer(request, response);
Map<String, Object> map = new HashMap<String, Object>();
map.put("user", user);
map.put("player", player);
map.put("players", playerService.getPlayersForUserAndClientId(user.getUsername(), null));
map.put("visibility", userSettings.getPlaylistVisibility());
map.put("customScrollbar", userSettings.isCustomScrollbarEnabled());
map.put("partyMode", userSettings.isPartyModeEnabled());
ModelAndView result = super.handleRequestInternal(request, response);
result.addObject("model", map);
return result;
}
示例13: handleRequestInternal
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
User user = securityService.getCurrentUser(request);
UserSettings userSettings = settingsService.getUserSettings(user.getUsername());
map.put("logEntries", Logger.getLatestLogEntries(settingsService.isLogfileReverse()));
map.put("logReverse", settingsService.isLogfileReverse());
map.put("logFile", Logger.getLogFile());
map.put("user", securityService.getCurrentUser(request));
map.put("customScrollbar", userSettings.isCustomScrollbarEnabled());
ModelAndView result = super.handleRequestInternal(request, response);
result.addObject("model", map);
return result;
}
示例14: handleRequestInternal
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
ModelAndView result = super.handleRequestInternal(request, response);
result.addObject("model", map);
Map<PodcastChannel, List<PodcastEpisode>> channels = new LinkedHashMap<PodcastChannel, List<PodcastEpisode>>();
for (PodcastChannel channel : podcastService.getAllChannels()) {
channels.put(channel, podcastService.getEpisodes(channel.getId(), false));
}
User user = securityService.getCurrentUser(request);
UserSettings userSettings = settingsService.getUserSettings(user.getUsername());
map.put("user", user);
map.put("partyMode", userSettings.isPartyModeEnabled());
map.put("channels", channels);
map.put("expandedChannels", StringUtil.parseInts(request.getParameter("expandedChannels")));
map.put("licenseInfo", settingsService.getLicenseInfo());
return result;
}
示例15: handleRequestInternal
import net.sourceforge.subsonic.domain.UserSettings; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
User user = securityService.getCurrentUser(request);
UserSettings userSettings = settingsService.getUserSettings(user.getUsername());
map.put("customScrollbar", userSettings.isCustomScrollbarEnabled());
map.put("chartWidth", FolderChartController.IMAGE_WIDTH);
// map.put("chartHeight", FolderChartController.IMAGE_MIN_HEIGHT);
ModelAndView result = super.handleRequestInternal(request, response);
result.addObject("model", map);
return result;
}