config.html 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>MusicBrainz</title>
  5. </head>
  6. <body>
  7. <div data-role="page" class="page type-interior pluginConfigurationPage musicBrainzConfigPage" data-require="emby-input,emby-button,emby-checkbox">
  8. <div data-role="content">
  9. <div class="content-primary">
  10. <form class="musicBrainzConfigForm">
  11. <div class="inputContainer">
  12. <input is="emby-input" type="text" id="server" required label="Server" />
  13. <div class="fieldDescription">This can be a mirror of the official server or even a custom server.</div>
  14. </div>
  15. <div class="inputContainer">
  16. <input is="emby-input" type="number" id="rateLimit" pattern="[0-9]*" required min="0" max="10000" label="Rate Limit" />
  17. <div class="fieldDescription">Span of time between requests in milliseconds. The official server is limited to one request every two seconds.</div>
  18. </div>
  19. <label class="checkboxContainer">
  20. <input is="emby-checkbox" type="checkbox" id="enable" />
  21. <span>Enable this provider for metadata searches on artists and albums.</span>
  22. </label>
  23. <label class="checkboxContainer">
  24. <input is="emby-checkbox" type="checkbox" id="replaceArtistName" />
  25. <span>When an artist is found during a metadata search, replace the artist name with the value on the server.</span>
  26. </label>
  27. <br />
  28. <div>
  29. <button is="emby-button" type="submit" class="raised button-submit block"><span>Save</span></button>
  30. </div>
  31. </form>
  32. </div>
  33. </div>
  34. <script type="text/javascript">
  35. var MusicBrainzPluginConfig = {
  36. uniquePluginId: "8c95c4d2-e50c-4fb0-a4f3-6c06ff0f9a1a"
  37. };
  38. document.querySelector('.musicBrainzConfigPage')
  39. .addEventListener('pageshow', function () {
  40. Dashboard.showLoadingMsg();
  41. ApiClient.getPluginConfiguration(MusicBrainzPluginConfig.uniquePluginId).then(function (config) {
  42. var server = document.querySelector('#server');
  43. server.value = config.Server;
  44. server.dispatchEvent(new Event('change', {
  45. bubbles: true,
  46. cancelable: false
  47. }));
  48. var rateLimit = document.querySelector('#rateLimit');
  49. rateLimit.value = config.RateLimit;
  50. rateLimit.dispatchEvent(new Event('change', {
  51. bubbles: true,
  52. cancelable: false
  53. }));
  54. document.querySelector('#enable').checked = config.Enable;
  55. document.querySelector('#replaceArtistName').checked = config.ReplaceArtistName;
  56. Dashboard.hideLoadingMsg();
  57. });
  58. });
  59. document.querySelector('.musicBrainzConfigForm')
  60. .addEventListener('submit', function (e) {
  61. Dashboard.showLoadingMsg();
  62. ApiClient.getPluginConfiguration(MusicBrainzPluginConfig.uniquePluginId).then(function (config) {
  63. config.Server = document.querySelector('#server').value;
  64. config.RateLimit = document.querySelector('#rateLimit').value;
  65. config.Enable = document.querySelector('#enable').checked;
  66. config.ReplaceArtistName = document.querySelector('#replaceArtistName').checked;
  67. ApiClient.updatePluginConfiguration(MusicBrainzPluginConfig.uniquePluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
  68. });
  69. e.preventDefault();
  70. return false;
  71. });
  72. </script>
  73. </div>
  74. </body>
  75. </html>