config.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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="selectProfileSize" label="Profile"></select>
  41. </div>
  42. <div class="selectContainer">
  43. <select is="emby-select" id="selectStillSize" label="Still"></select>
  44. </div>
  45. </div>
  46. <div>
  47. <button is="emby-button" type="submit" class="raised button-submit block"><span>Save</span></button>
  48. </div>
  49. </form>
  50. </div>
  51. </div>
  52. <script type="text/javascript">
  53. var PluginConfig = {
  54. pluginId: "b8715ed1-6c47-4528-9ad3-f72deb539cd4"
  55. };
  56. document.querySelector('.configPage')
  57. .addEventListener('pageshow', function () {
  58. Dashboard.showLoadingMsg();
  59. var clientConfig, pluginConfig;
  60. var configureImageScaling = function() {
  61. if (clientConfig === null || pluginConfig === null) {
  62. return;
  63. }
  64. var sizeOptionsGenerator = function (size) {
  65. return '<option value="' + size + '">' + size + '</option>';
  66. }
  67. var selPosterSize = document.querySelector('#selectPosterSize');
  68. selPosterSize.innerHTML = clientConfig.PosterSizes.map(sizeOptionsGenerator);
  69. selPosterSize.value = pluginConfig.PosterSize;
  70. var selBackdropSize = document.querySelector('#selectBackdropSize');
  71. selBackdropSize.innerHTML = clientConfig.BackdropSizes.map(sizeOptionsGenerator);
  72. selBackdropSize.value = pluginConfig.BackdropSize;
  73. var selProfileSize = document.querySelector('#selectProfileSize');
  74. selProfileSize.innerHTML = clientConfig.ProfileSizes.map(sizeOptionsGenerator);
  75. selProfileSize.value = pluginConfig.ProfileSize;
  76. var selStillSize = document.querySelector('#selectStillSize');
  77. selStillSize.innerHTML = clientConfig.StillSizes.map(sizeOptionsGenerator);
  78. selStillSize.value = pluginConfig.StillSize;
  79. Dashboard.hideLoadingMsg();
  80. }
  81. const request = {
  82. url: ApiClient.getUrl('tmdb/ClientConfiguration'),
  83. dataType: 'json',
  84. type: 'GET',
  85. headers: { accept: 'application/json' }
  86. }
  87. ApiClient.fetch(request).then(function (config) {
  88. clientConfig = config;
  89. configureImageScaling();
  90. });
  91. ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
  92. document.querySelector('#includeAdult').checked = config.IncludeAdult;
  93. document.querySelector('#excludeTagsSeries').checked = config.ExcludeTagsSeries;
  94. document.querySelector('#excludeTagsMovies').checked = config.ExcludeTagsMovies;
  95. document.querySelector('#importSeasonName').checked = config.ImportSeasonName;
  96. var maxCastMembers = document.querySelector('#maxCastMembers');
  97. maxCastMembers.value = config.MaxCastMembers;
  98. maxCastMembers.dispatchEvent(new Event('change', {
  99. bubbles: true,
  100. cancelable: false
  101. }));
  102. pluginConfig = config;
  103. configureImageScaling();
  104. });
  105. });
  106. document.querySelector('.configForm')
  107. .addEventListener('submit', function (e) {
  108. Dashboard.showLoadingMsg();
  109. ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
  110. config.IncludeAdult = document.querySelector('#includeAdult').checked;
  111. config.ExcludeTagsSeries = document.querySelector('#excludeTagsSeries').checked;
  112. config.ExcludeTagsMovies = document.querySelector('#excludeTagsMovies').checked;
  113. config.ImportSeasonName = document.querySelector('#importSeasonName').checked;
  114. config.MaxCastMembers = document.querySelector('#maxCastMembers').value;
  115. config.PosterSize = document.querySelector('#selectPosterSize').value;
  116. config.BackdropSize = document.querySelector('#selectBackdropSize').value;
  117. config.ProfileSize = document.querySelector('#selectProfileSize').value;
  118. config.StillSize = document.querySelector('#selectStillSize').value;
  119. ApiClient.updatePluginConfiguration(PluginConfig.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
  120. });
  121. e.preventDefault();
  122. return false;
  123. });
  124. </script>
  125. </div>
  126. </body>
  127. </html>