MetadataImagesPage.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. var MetadataImagesPage = {
  2. onPageShow: function () {
  3. Dashboard.showLoadingMsg();
  4. var page = this;
  5. ApiClient.getServerConfiguration().done(function(result) {
  6. MetadataImagesPage.load(page, result);
  7. });
  8. },
  9. load: function (page, config) {
  10. $('#selectTmdbPersonImageDownloadSize', page).val(config.TmdbFetchedProfileSize).selectmenu("refresh");
  11. $('#selectTmdbPosterDownloadSize', page).val(config.TmdbFetchedPosterSize).selectmenu("refresh");
  12. $('#selectTmdbBackdropDownloadSize', page).val(config.TmdbFetchedBackdropSize).selectmenu("refresh");
  13. $('#chkRefreshItemImages', page).checked(config.RefreshItemImages).checkboxradio("refresh");
  14. $('#txtNumbackdrops', page).val(config.MaxBackdrops);
  15. $('#chkDownloadMovieArt', page).checked(config.DownloadMovieImages.Art).checkboxradio("refresh");
  16. $('#chkDownloadMovieBanner', page).checked(config.DownloadMovieImages.Banner).checkboxradio("refresh");
  17. $('#chkDownloadMovieDisc', page).checked(config.DownloadMovieImages.Disc).checkboxradio("refresh");
  18. $('#chkDownloadMovieLogo', page).checked(config.DownloadMovieImages.Logo).checkboxradio("refresh");
  19. $('#chkDownloadMovieThumb', page).checked(config.DownloadMovieImages.Thumb).checkboxradio("refresh");
  20. $('#chKDownloadTVArt', page).checked(config.DownloadSeriesImages.Art).checkboxradio("refresh");
  21. $('#chkDownloadTVBanner', page).checked(config.DownloadSeriesImages.Banner).checkboxradio("refresh");
  22. $('#chkDownloadTVLogo', page).checked(config.DownloadSeriesImages.Logo).checkboxradio("refresh");
  23. $('#chkDownloadTVThumb', page).checked(config.DownloadSeriesImages.Thumb).checkboxradio("refresh");
  24. $('#chkDownloadSeasonBanner', page).checked(config.DownloadSeasonImages.Banner).checkboxradio("refresh");
  25. $('#chkDownloadSeasonThumb', page).checked(config.DownloadSeasonImages.Thumb).checkboxradio("refresh");
  26. $('#chkDownloadSeasonBackdrops', page).checked(config.DownloadSeasonImages.Backdrops).checkboxradio("refresh");
  27. $('#chkDownloadArtistThumb', page).checked(config.DownloadMusicArtistImages.Thumb).checkboxradio("refresh");
  28. $('#chkDownloadArtistBackdrops', page).checked(config.DownloadMusicArtistImages.Backdrops).checkboxradio("refresh");
  29. $('#chkDownloadArtistLogo', page).checked(config.DownloadMusicArtistImages.Logo).checkboxradio("refresh");
  30. $('#chkDownloadArtistBanner', page).checked(config.DownloadMusicArtistImages.Banner).checkboxradio("refresh");
  31. $('#chkDownloadAlbumPrimary', page).checked(config.DownloadMusicAlbumImages.Primary).checkboxradio("refresh");
  32. $('#chkDownloadAlbumBackdrops', page).checked(config.DownloadMusicAlbumImages.Backdrops).checkboxradio("refresh");
  33. Dashboard.hideLoadingMsg();
  34. },
  35. submit: function () {
  36. $('.btnSubmit', $.mobile.activePage)[0].click();
  37. },
  38. onSubmit: function () {
  39. var form = this;
  40. ApiClient.getServerConfiguration().done(function (config) {
  41. config.TmdbFetchedProfileSize = $('#selectTmdbPersonImageDownloadSize', form).val();
  42. config.TmdbFetchedPosterSize = $('#selectTmdbPosterDownloadSize', form).val();
  43. config.TmdbFetchedBackdropSize = $('#selectTmdbBackdropDownloadSize', form).val();
  44. config.RefreshItemImages = $('#chkRefreshItemImages', form).checked();
  45. config.MaxBackdrops = $('#txtNumbackdrops', form).val();
  46. config.DownloadMovieImages.Art = $('#chkDownloadMovieArt', form).checked();
  47. config.DownloadMovieImages.Banner = $('#chkDownloadMovieBanner', form).checked();
  48. config.DownloadMovieImages.Disc = $('#chkDownloadMovieDisc', form).checked();
  49. config.DownloadMovieImages.Logo = $('#chkDownloadMovieLogo', form).checked();
  50. config.DownloadMovieImages.Thumb = $('#chkDownloadMovieThumb', form).checked();
  51. config.DownloadSeriesImages.Art = $('#chKDownloadTVArt', form).checked();
  52. config.DownloadSeriesImages.Banner = $('#chkDownloadTVBanner', form).checked();
  53. config.DownloadSeriesImages.Logo = $('#chkDownloadTVLogo', form).checked();
  54. config.DownloadSeriesImages.Thumb = $('#chkDownloadTVThumb', form).checked();
  55. config.DownloadSeasonImages.Banner = $('#chkDownloadSeasonBanner', form).checked();
  56. config.DownloadSeasonImages.Thumb = $('#chkDownloadSeasonThumb', form).checked();
  57. config.DownloadSeasonImages.Backdrops = $('#chkDownloadSeasonBackdrops', form).checked();
  58. config.DownloadMusicArtistImages.Backdrops = $('#chkDownloadArtistBackdrops', form).checked();
  59. config.DownloadMusicArtistImages.Logo = $('#chkDownloadArtistLogo', form).checked();
  60. config.DownloadMusicArtistImages.Thumb = $('#chkDownloadArtistThumb', form).checked();
  61. config.DownloadMusicArtistImages.Banner = $('#chkDownloadArtistBanner', form).checked();
  62. config.DownloadMusicAlbumImages.Primary = $('#chkDownloadAlbumPrimary', form).checked();
  63. config.DownloadMusicAlbumImages.Backdrops = $('#chkDownloadAlbumBackdrops', form).checked();
  64. ApiClient.updateServerConfiguration(config);
  65. });
  66. // Disable default form submission
  67. return false;
  68. }
  69. };
  70. $(document).on('pageshow', "#metadataImagesConfigurationPage", MetadataImagesPage.onPageShow);