jellyfin-web/dashboard-ui/scripts/metadataimagespage.js

117 lines
6.9 KiB
JavaScript
Raw Normal View History

2013-02-20 18:33:05 -07:00
var MetadataImagesPage = {
onPageShow: function () {
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function(result) {
MetadataImagesPage.load(page, result);
});
},
load: function (page, config) {
2013-12-25 23:17:19 -07:00
// Movie options
$('#txtMaxMovieBackdrops', page).val(config.MovieOptions.MaxBackdrops);
$('#txtMinMovieBackdropDownloadWidth', page).val(config.MovieOptions.MinBackdropWidth);
// Tv options
$('#txtMaxTvBackdrops', page).val(config.TvOptions.MaxBackdrops);
$('#txtMinTvBackdropDownloadWidth', page).val(config.TvOptions.MinBackdropWidth);
// Music options
$('#txtMaxMusicBackdrops', page).val(config.MusicOptions.MaxBackdrops);
$('#txtMinMusicBackdropDownloadWidth', page).val(config.MusicOptions.MinBackdropWidth);
// Game options
$('#txtMaxGameBackdrops', page).val(config.GameOptions.MaxBackdrops);
$('#txtMinGameBackdropDownloadWidth', page).val(config.GameOptions.MinBackdropWidth);
2013-03-04 09:59:35 -07:00
$('#chkDownloadMovieArt', page).checked(config.DownloadMovieImages.Art).checkboxradio("refresh");
2013-05-12 15:57:51 -07:00
$('#chkDownloadMovieBackdrops', page).checked(config.DownloadMovieImages.Backdrops).checkboxradio("refresh");
2013-03-04 09:59:35 -07:00
$('#chkDownloadMovieBanner', page).checked(config.DownloadMovieImages.Banner).checkboxradio("refresh");
$('#chkDownloadMovieDisc', page).checked(config.DownloadMovieImages.Disc).checkboxradio("refresh");
$('#chkDownloadMovieLogo', page).checked(config.DownloadMovieImages.Logo).checkboxradio("refresh");
$('#chkDownloadMovieThumb', page).checked(config.DownloadMovieImages.Thumb).checkboxradio("refresh");
2013-05-12 15:57:51 -07:00
2013-03-04 09:59:35 -07:00
$('#chKDownloadTVArt', page).checked(config.DownloadSeriesImages.Art).checkboxradio("refresh");
2013-05-12 15:57:51 -07:00
$('#chkDownloadTVBackdrops', page).checked(config.DownloadSeriesImages.Backdrops).checkboxradio("refresh");
2013-03-04 09:59:35 -07:00
$('#chkDownloadTVBanner', page).checked(config.DownloadSeriesImages.Banner).checkboxradio("refresh");
$('#chkDownloadTVLogo', page).checked(config.DownloadSeriesImages.Logo).checkboxradio("refresh");
$('#chkDownloadTVThumb', page).checked(config.DownloadSeriesImages.Thumb).checkboxradio("refresh");
2013-05-12 15:57:51 -07:00
2013-03-04 09:59:35 -07:00
$('#chkDownloadSeasonBanner', page).checked(config.DownloadSeasonImages.Banner).checkboxradio("refresh");
$('#chkDownloadSeasonThumb', page).checked(config.DownloadSeasonImages.Thumb).checkboxradio("refresh");
$('#chkDownloadSeasonBackdrops', page).checked(config.DownloadSeasonImages.Backdrops).checkboxradio("refresh");
2013-05-12 06:13:57 -07:00
$('#chkDownloadArtistThumb', page).checked(config.DownloadMusicArtistImages.Primary).checkboxradio("refresh");
2013-03-04 09:59:35 -07:00
$('#chkDownloadArtistBackdrops', page).checked(config.DownloadMusicArtistImages.Backdrops).checkboxradio("refresh");
$('#chkDownloadArtistLogo', page).checked(config.DownloadMusicArtistImages.Logo).checkboxradio("refresh");
$('#chkDownloadArtistBanner', page).checked(config.DownloadMusicArtistImages.Banner).checkboxradio("refresh");
2013-05-01 09:06:57 -07:00
2013-03-04 09:59:35 -07:00
$('#chkDownloadAlbumPrimary', page).checked(config.DownloadMusicAlbumImages.Primary).checkboxradio("refresh");
$('#chkDownloadAlbumBackdrops', page).checked(config.DownloadMusicAlbumImages.Backdrops).checkboxradio("refresh");
2013-05-01 09:06:57 -07:00
$('#chkMusicAlbumDisc', page).checked(config.DownloadMusicAlbumImages.Disc).checkboxradio("refresh");
2013-02-20 18:33:05 -07:00
$('#selectImageSavingConvention', page).val(config.ImageSavingConvention).selectmenu("refresh");
2013-02-20 18:33:05 -07:00
Dashboard.hideLoadingMsg();
},
onSubmit: function () {
var form = this;
2013-04-16 21:58:32 -07:00
Dashboard.showLoadingMsg();
2013-02-20 18:33:05 -07:00
ApiClient.getServerConfiguration().done(function (config) {
config.ImageSavingConvention = $('#selectImageSavingConvention', form).val();
2013-02-20 18:33:05 -07:00
2013-12-25 23:17:19 -07:00
// Movie options
config.MovieOptions.MaxBackdrops = $('#txtMaxMovieBackdrops', form).val();
config.MovieOptions.MinBackdropWidth = $('#txtMinMovieBackdropDownloadWidth', form).val();
2013-03-04 09:59:35 -07:00
config.DownloadMovieImages.Art = $('#chkDownloadMovieArt', form).checked();
2013-05-12 15:57:51 -07:00
config.DownloadMovieImages.Backdrops = $('#chkDownloadMovieBackdrops', form).checked();
2013-03-04 09:59:35 -07:00
config.DownloadMovieImages.Banner = $('#chkDownloadMovieBanner', form).checked();
config.DownloadMovieImages.Disc = $('#chkDownloadMovieDisc', form).checked();
config.DownloadMovieImages.Logo = $('#chkDownloadMovieLogo', form).checked();
config.DownloadMovieImages.Thumb = $('#chkDownloadMovieThumb', form).checked();
2013-12-25 23:17:19 -07:00
// Tv options
config.TvOptions.MaxBackdrops = $('#txtMaxTvBackdrops', form).val();
config.TvOptions.MinBackdropWidth = $('#txtMinTvBackdropDownloadWidth', form).val();
2013-03-04 09:59:35 -07:00
config.DownloadSeriesImages.Art = $('#chKDownloadTVArt', form).checked();
2013-05-12 15:57:51 -07:00
config.DownloadSeriesImages.Backdrops = $('#chkDownloadMovieBackdrops', form).checked();
2013-03-04 09:59:35 -07:00
config.DownloadSeriesImages.Banner = $('#chkDownloadTVBanner', form).checked();
config.DownloadSeriesImages.Logo = $('#chkDownloadTVLogo', form).checked();
config.DownloadSeriesImages.Thumb = $('#chkDownloadTVThumb', form).checked();
config.DownloadSeasonImages.Banner = $('#chkDownloadSeasonBanner', form).checked();
config.DownloadSeasonImages.Thumb = $('#chkDownloadSeasonThumb', form).checked();
config.DownloadSeasonImages.Backdrops = $('#chkDownloadSeasonBackdrops', form).checked();
2013-12-25 23:17:19 -07:00
// Music options
config.MusicOptions.MaxBackdrops = $('#txtMaxMusicBackdrops', form).val();
config.MusicOptions.MinBackdropWidth = $('#txtMinMusicBackdropDownloadWidth', form).val();
2013-03-04 09:59:35 -07:00
config.DownloadMusicArtistImages.Backdrops = $('#chkDownloadArtistBackdrops', form).checked();
config.DownloadMusicArtistImages.Logo = $('#chkDownloadArtistLogo', form).checked();
2013-05-12 06:13:57 -07:00
config.DownloadMusicArtistImages.Primary = $('#chkDownloadArtistThumb', form).checked();
2013-03-04 09:59:35 -07:00
config.DownloadMusicArtistImages.Banner = $('#chkDownloadArtistBanner', form).checked();
config.DownloadMusicAlbumImages.Primary = $('#chkDownloadAlbumPrimary', form).checked();
config.DownloadMusicAlbumImages.Backdrops = $('#chkDownloadAlbumBackdrops', form).checked();
2013-05-01 09:06:57 -07:00
config.DownloadMusicAlbumImages.Disc = $('#chkMusicAlbumDisc', form).checked();
2013-02-20 18:33:05 -07:00
2013-12-25 23:17:19 -07:00
// Game options
config.GameOptions.MaxBackdrops = $('#txtMaxGameBackdrops', form).val();
config.GameOptions.MinBackdropWidth = $('#txtMinGameBackdropDownloadWidth', form).val();
2013-04-16 21:58:32 -07:00
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
2013-02-20 18:33:05 -07:00
});
// Disable default form submission
return false;
}
};
$(document).on('pageshow', "#metadataImagesConfigurationPage", MetadataImagesPage.onPageShow);