config.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>TMDb</title>
  5. </head>
  6. <body>
  7. <div data-role="page" class="page type-interior pluginConfigurationPage configPage" data-require="emby-input,emby-button,emby-checkbox">
  8. <div data-role="content">
  9. <div class="content-primary">
  10. <form class="configForm">
  11. <label class="checkboxContainer">
  12. <input is="emby-checkbox" type="checkbox" id="includeAdult" />
  13. <span>Include adult content in search results.</span>
  14. </label>
  15. <label class="checkboxContainer">
  16. <input is="emby-checkbox" type="checkbox" id="excludeTagsSeries" />
  17. <span>Exclude tags/keywords from metadata fetched for series.</span>
  18. </label>
  19. <label class="checkboxContainer">
  20. <input is="emby-checkbox" type="checkbox" id="excludeTagsMovies" />
  21. <span>Exclude tags/keywords from metadata fetched for movies.</span>
  22. </label>
  23. <label class="checkboxContainer">
  24. <input is="emby-checkbox" type="checkbox" id="importSeasonName" />
  25. <span>Import season name from metadata fetched for series.</span>
  26. </label>
  27. <div class="inputContainer">
  28. <input is="emby-input" type="number" id="maxCastMembers" pattern="[0-9]*" required min="0" max="1000" label="Max Cast Members" />
  29. <div class="fieldDescription">The maximum number of cast members to fetch for an item.</div>
  30. </div>
  31. <div class="verticalSection verticalSection-extrabottompadding">
  32. <h2>Image Scaling</h2>
  33. <div class="selectContainer">
  34. <select is="emby-select" id="selectPosterSize" label="Poster"></select>
  35. </div>
  36. <div class="selectContainer">
  37. <select is="emby-select" id="selectBackdropSize" label="Backdrop"></select>
  38. </div>
  39. <div class="selectContainer">
  40. <select is="emby-select" id="selectLogoSize" label="Logo"></select>
  41. </div>
  42. <div class="selectContainer">
  43. <select is="emby-select" id="selectProfileSize" label="Profile"></select>
  44. </div>
  45. <div class="selectContainer">
  46. <select is="emby-select" id="selectStillSize" label="Still"></select>
  47. </div>
  48. </div>
  49. <div>
  50. <button is="emby-button" type="submit" class="raised button-submit block"><span>Save</span></button>
  51. </div>
  52. </form>
  53. </div>
  54. </div>
  55. <script type="text/javascript">
  56. var PluginConfig = {
  57. pluginId: "b8715ed1-6c47-4528-9ad3-f72deb539cd4"
  58. };
  59. document.querySelector('.configPage')
  60. .addEventListener('pageshow', function () {
  61. Dashboard.showLoadingMsg();
  62. var clientConfig, pluginConfig;
  63. var configureImageScaling = function() {
  64. if (clientConfig === null || pluginConfig === null) {
  65. return;
  66. }
  67. var sizeOptionsGenerator = function (size) {
  68. return '<option value="' + size + '">' + size + '</option>';
  69. }
  70. var selPosterSize = document.querySelector('#selectPosterSize');
  71. selPosterSize.innerHTML = clientConfig.PosterSizes.map(sizeOptionsGenerator);
  72. selPosterSize.value = pluginConfig.PosterSize;
  73. var selBackdropSize = document.querySelector('#selectBackdropSize');
  74. selBackdropSize.innerHTML = clientConfig.BackdropSizes.map(sizeOptionsGenerator);
  75. selBackdropSize.value = pluginConfig.BackdropSize;
  76. var selLogoSize = document.querySelector('#selectLogoSize');
  77. selLogoSize.innerHTML = clientConfig.LogoSizes.map(sizeOptionsGenerator);
  78. selLogoSize.value = pluginConfig.LogoSize;
  79. var selProfileSize = document.querySelector('#selectProfileSize');
  80. selProfileSize.innerHTML = clientConfig.ProfileSizes.map(sizeOptionsGenerator);
  81. selProfileSize.value = pluginConfig.ProfileSize;
  82. var selStillSize = document.querySelector('#selectStillSize');
  83. selStillSize.innerHTML = clientConfig.StillSizes.map(sizeOptionsGenerator);
  84. selStillSize.value = pluginConfig.StillSize;
  85. Dashboard.hideLoadingMsg();
  86. }
  87. const request = {
  88. url: ApiClient.getUrl('tmdb/ClientConfiguration'),
  89. dataType: 'json',
  90. type: 'GET',
  91. headers: { accept: 'application/json' }
  92. }
  93. ApiClient.fetch(request).then(function (config) {
  94. clientConfig = config;
  95. configureImageScaling();
  96. });
  97. ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
  98. document.querySelector('#includeAdult').checked = config.IncludeAdult;
  99. document.querySelector('#excludeTagsSeries').checked = config.ExcludeTagsSeries;
  100. document.querySelector('#excludeTagsMovies').checked = config.ExcludeTagsMovies;
  101. document.querySelector('#importSeasonName').checked = config.ImportSeasonName;
  102. var maxCastMembers = document.querySelector('#maxCastMembers');
  103. maxCastMembers.value = config.MaxCastMembers;
  104. maxCastMembers.dispatchEvent(new Event('change', {
  105. bubbles: true,
  106. cancelable: false
  107. }));
  108. pluginConfig = config;
  109. configureImageScaling();
  110. });
  111. });
  112. document.querySelector('.configForm')
  113. .addEventListener('submit', function (e) {
  114. Dashboard.showLoadingMsg();
  115. ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
  116. config.IncludeAdult = document.querySelector('#includeAdult').checked;
  117. config.ExcludeTagsSeries = document.querySelector('#excludeTagsSeries').checked;
  118. config.ExcludeTagsMovies = document.querySelector('#excludeTagsMovies').checked;
  119. config.ImportSeasonName = document.querySelector('#importSeasonName').checked;
  120. config.MaxCastMembers = document.querySelector('#maxCastMembers').value;
  121. config.PosterSize = document.querySelector('#selectPosterSize').value;
  122. config.BackdropSize = document.querySelector('#selectBackdropSize').value;
  123. config.LogoSize = document.querySelector('#selectLogoSize').value;
  124. config.ProfileSize = document.querySelector('#selectProfileSize').value;
  125. config.StillSize = document.querySelector('#selectStillSize').value;
  126. ApiClient.updatePluginConfiguration(PluginConfig.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
  127. });
  128. e.preventDefault();
  129. return false;
  130. });
  131. </script>
  132. </div>
  133. </body>
  134. </html>