From 60fc2c72b2983317f598aa70080e0f1b13e70ba5 Mon Sep 17 00:00:00 2001 From: Topher Johnson Date: Mon, 19 Feb 2024 23:37:46 -0800 Subject: [PATCH 1/3] Add option to enable/disable libraries This commit adds the option to enable/disable libraries from the library options editor. The backend changes required for this functionality are in jellyfin PR 11037. This commit adds a checkbox in the library options editor. It adds a checkbox saying "Library Enabled" that is checked by default. libraryoptionseditor.js - added logic to handle enable libraries checkbox. Enables libraries by default libraryoptionseditor.template.html - added "enable libraries" checkbox src/strings/en-us.json - added English strings for enable library checkbox. --- CONTRIBUTORS.md | 1 + .../libraryoptionseditor/libraryoptionseditor.js | 2 ++ .../libraryoptionseditor.template.html | 8 ++++++++ src/strings/en-us.json | 2 ++ 4 files changed, 13 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index daec591172..8bc658eb04 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -79,6 +79,7 @@ - [Kevin Tan (Valius)](https://github.com/valius) - [Rasmus Krämer](https://github.com/rasmuslos) - [ntarelix](https://github.com/ntarelix) +- [btopherjohnson](https://github.com/btopherjohnson) ## Emby Contributors diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.js b/src/components/libraryoptionseditor/libraryoptionseditor.js index 11c0806104..c8f1a1ddcf 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.js +++ b/src/components/libraryoptionseditor/libraryoptionseditor.js @@ -511,6 +511,7 @@ function setImageOptionsIntoOptions(options) { export function getLibraryOptions(parent) { const options = { + Disabled: !parent.querySelector('.chkEnabled').checked, EnableArchiveMediaFiles: false, EnablePhotos: parent.querySelector('.chkEnablePhotos').checked, EnableRealtimeMonitor: parent.querySelector('.chkEnableRealtimeMonitor').checked, @@ -574,6 +575,7 @@ export function setLibraryOptions(parent, options) { parent.querySelector('#selectCountry').value = options.MetadataCountryCode || ''; parent.querySelector('#selectAutoRefreshInterval').value = options.AutomaticRefreshIntervalDays || '0'; parent.querySelector('#txtSeasonZeroName').value = options.SeasonZeroDisplayName || 'Specials'; + parent.querySelector('.chkEnabled').checked = !options.Disabled; parent.querySelector('.chkEnablePhotos').checked = options.EnablePhotos; parent.querySelector('.chkEnableRealtimeMonitor').checked = options.EnableRealtimeMonitor; parent.querySelector('.chkEnableLUFSScan').checked = options.EnableLUFSScan; diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.template.html b/src/components/libraryoptionseditor/libraryoptionseditor.template.html index a221f53bbf..ea0f3069f7 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.template.html +++ b/src/components/libraryoptionseditor/libraryoptionseditor.template.html @@ -1,4 +1,12 @@

${HeaderLibrarySettings}

+
+ +
${EnableLibraryHelp}
+
+
diff --git a/src/strings/en-us.json b/src/strings/en-us.json index bf71f50583..bbd2d98a3c 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -237,6 +237,8 @@ "EnableFasterAnimations": "Faster animations", "EnableFasterAnimationsHelp": "Use faster animations and transitions.", "EnableHardwareEncoding": "Enable hardware encoding", + "EnableLibrary": "Enable the library", + "EnableLibraryHelp": "Allows the library to be enabled/disabled", "EnableNextVideoInfoOverlay": "Show next video info during playback", "EnableNextVideoInfoOverlayHelp": "At the end of a video, display info about the next video coming up in the current playlist.", "EnablePhotos": "Display the photos", From 9ab45c43ad9ce6207302c9995dfed578cbcf109b Mon Sep 17 00:00:00 2001 From: Topher Johnson Date: Sun, 25 Feb 2024 13:35:36 -0800 Subject: [PATCH 2/3] Change LibraryOption to match backend Changed "disable" to "enable" to match backend. It makes more sense to have it be "enable" because that's what the checkbox says. Now no weird "not" logic is needed to send options to the backend. --- src/components/libraryoptionseditor/libraryoptionseditor.js | 4 ++-- .../libraryoptionseditor/libraryoptionseditor.template.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.js b/src/components/libraryoptionseditor/libraryoptionseditor.js index c8f1a1ddcf..036dbf948b 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.js +++ b/src/components/libraryoptionseditor/libraryoptionseditor.js @@ -511,7 +511,7 @@ function setImageOptionsIntoOptions(options) { export function getLibraryOptions(parent) { const options = { - Disabled: !parent.querySelector('.chkEnabled').checked, + Enabled: parent.querySelector('.chkEnabled').checked, EnableArchiveMediaFiles: false, EnablePhotos: parent.querySelector('.chkEnablePhotos').checked, EnableRealtimeMonitor: parent.querySelector('.chkEnableRealtimeMonitor').checked, @@ -575,7 +575,7 @@ export function setLibraryOptions(parent, options) { parent.querySelector('#selectCountry').value = options.MetadataCountryCode || ''; parent.querySelector('#selectAutoRefreshInterval').value = options.AutomaticRefreshIntervalDays || '0'; parent.querySelector('#txtSeasonZeroName').value = options.SeasonZeroDisplayName || 'Specials'; - parent.querySelector('.chkEnabled').checked = !options.Disabled; + parent.querySelector('.chkEnabled').checked = options.Enabled; parent.querySelector('.chkEnablePhotos').checked = options.EnablePhotos; parent.querySelector('.chkEnableRealtimeMonitor').checked = options.EnableRealtimeMonitor; parent.querySelector('.chkEnableLUFSScan').checked = options.EnableLUFSScan; diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.template.html b/src/components/libraryoptionseditor/libraryoptionseditor.template.html index ea0f3069f7..38ebe99310 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.template.html +++ b/src/components/libraryoptionseditor/libraryoptionseditor.template.html @@ -1,5 +1,5 @@

${HeaderLibrarySettings}

-
+