config.html 8.1 KB

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