Clear up some confusion about auto skip (#317)

* Link Auto, Button, and Client List

* Clarify the client list priority by placement
This commit is contained in:
TwistedUmbrellaX 2024-10-02 19:13:17 -04:00 committed by GitHub
parent 4f1ce3041a
commit 3e84d5f80f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 49 additions and 36 deletions

View File

@ -357,7 +357,8 @@
</label> </label>
<div class="fieldDescription"> <div class="fieldDescription">
If checked, intros will be automatically skipped for Apps without Skip Button. If checked, intros will be automatically skipped for <strong>all</strong> clients.
Individual clients can override this setting from the client player options.<br />
If you access Jellyfin through a reverse proxy, it must be configured to proxy websockets.<br /> If you access Jellyfin through a reverse proxy, it must be configured to proxy websockets.<br />
</div> </div>
</div> </div>
@ -392,7 +393,8 @@
</label> </label>
<div class="fieldDescription"> <div class="fieldDescription">
If checked, credits will be automatically skipped for Apps without Skip Button. If checked, credits will be automatically skipped for <strong>all</strong> clients.
Individual clients can override this setting from the client player options.<br />
If you access Jellyfin through a reverse proxy, it must be configured to proxy websockets.<br /> If you access Jellyfin through a reverse proxy, it must be configured to proxy websockets.<br />
</div> </div>
</div> </div>
@ -408,6 +410,23 @@
<br /> <br />
</div> </div>
<div id="SkipButtonContainer" class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label">
<input id="SkipButtonVisible" type="checkbox" is="emby-checkbox" />
<span id="SkipButtonVisibleLabel">Show skip intro / credit button</span>
</label>
<div class="fieldDescription">
If checked, a skip button will be displayed according to the settings below, while
clients selected in the Auto Skip Client List will skip <strong>automatically</strong>.
<br />
</div>
</div>
<div id="warningMessage" style="color: #721c24; background-color: #f7cf1f; border: 1px solid #f5c6cb; border-radius: 4px; padding: 10px; margin-bottom: 10px;">
Failed to add skip button to web interface. See <a href="https://github.com/intro-skipper/intro-skipper/wiki/Troubleshooting#skip-button-is-not-visible" target="_blank" rel="noopener noreferrer">troubleshooting guide</a> for the most common issues.
</div>
<details id="AutoSkipClientList" style="padding-bottom: 1em;"> <details id="AutoSkipClientList" style="padding-bottom: 1em;">
<summary>Auto Skip Client List</summary> <summary>Auto Skip Client List</summary>
<br /> <br />
@ -416,23 +435,6 @@
<input id="ClientList" type="hidden" is="emby-input" /> <input id="ClientList" type="hidden" is="emby-input" />
</details> </details>
<div id="warningMessage" style="color: #721c24; background-color: #f7cf1f; border: 1px solid #f5c6cb; border-radius: 4px; padding: 10px; margin-bottom: 10px;">
Failed to add skip button to web interface. See <a href="https://github.com/intro-skipper/intro-skipper/wiki/Troubleshooting#skip-button-is-not-visible" target="_blank" rel="noopener noreferrer">troubleshooting guide</a> for the most common issues.
</div>
<div id="SkipButtonContainer" class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label">
<input id="SkipButtonVisible" type="checkbox" is="emby-checkbox" />
<span>Show skip intro button</span>
</label>
<div class="fieldDescription">
If checked, a skip button will be displayed at the start of an episode's introduction.
<strong>Only applies to the web interface and compatible applications.</strong>
<br />
</div>
</div>
<div id="PersistContainer" class="checkboxContainer checkboxContainer-withDescription"> <div id="PersistContainer" class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label"> <label class="emby-checkbox-label">
<input id="PersistSkipButton" type="checkbox" is="emby-checkbox" /> <input id="PersistSkipButton" type="checkbox" is="emby-checkbox" />
@ -816,6 +818,7 @@
var windowHashInterval = 0; var windowHashInterval = 0;
var autoSkip = document.querySelector("input#AutoSkip"); var autoSkip = document.querySelector("input#AutoSkip");
var skipButtonVisibleLabel = document.getElementById("SkipButtonVisibleLabel");
var selectAllLibraries = document.querySelector("input#SelectAllLibraries"); var selectAllLibraries = document.querySelector("input#SelectAllLibraries");
var librariesContainer = document.querySelector("div.folderAccessListContainer"); var librariesContainer = document.querySelector("div.folderAccessListContainer");
var skipFirstEpisode = document.querySelector("div#divSkipFirstEpisode"); var skipFirstEpisode = document.querySelector("div#divSkipFirstEpisode");
@ -826,6 +829,25 @@
var autoSkipCredits = document.querySelector("input#AutoSkipCredits"); var autoSkipCredits = document.querySelector("input#AutoSkipCredits");
var autoSkipCreditsNotificationText = document.querySelector("div#divAutoSkipCreditsNotificationText"); var autoSkipCreditsNotificationText = document.querySelector("div#divAutoSkipCreditsNotificationText");
function skipButtonVisibleText() {
if (autoSkip.checked && autoSkipCredits.checked) {
autoSkipClientList.style.display = 'none';
skipButtonVisibleLabel.textContent = "Button unavailable due to auto skip";
} else if (autoSkip.checked) {
autoSkipClientList.style.display = 'unset';
autoSkipClientList.style.width = '100%';
skipButtonVisibleLabel.textContent = "Show skip credit button";
} else if (autoSkipCredits.checked) {
autoSkipClientList.style.display = 'unset';
autoSkipClientList.style.width = '100%';
skipButtonVisibleLabel.textContent = "Show skip intro button";
} else {
autoSkipClientList.style.display = 'unset';
autoSkipClientList.style.width = '100%';
skipButtonVisibleLabel.textContent = "Show skip intro / credit button";
}
}
function autoSkipChanged() { function autoSkipChanged() {
if (autoSkip.checked) { if (autoSkip.checked) {
skipFirstEpisode.style.display = 'unset'; skipFirstEpisode.style.display = 'unset';
@ -836,7 +858,7 @@
autoSkipNotificationText.style.display = 'none'; autoSkipNotificationText.style.display = 'none';
secondsOfIntroStartToPlay.style.display = 'none'; secondsOfIntroStartToPlay.style.display = 'none';
} }
clientListVisible(); skipButtonVisibleText();
} }
autoSkip.addEventListener("change", autoSkipChanged); autoSkip.addEventListener("change", autoSkipChanged);
@ -849,20 +871,11 @@
autoSkipCreditsNotificationText.style.display = 'none'; autoSkipCreditsNotificationText.style.display = 'none';
secondsOfCreditsStartToPlay.style.display = 'none'; secondsOfCreditsStartToPlay.style.display = 'none';
} }
clientListVisible(); skipButtonVisibleText();
} }
autoSkipCredits.addEventListener("change", autoSkipCreditsChanged); autoSkipCredits.addEventListener("change", autoSkipCreditsChanged);
function clientListVisible() {
if (autoSkip.checked || autoSkipCredits.checked) {
autoSkipClientList.style.display = 'unset';
autoSkipClientList.style.width = '100%';
} else {
autoSkipClientList.style.display = 'none';
}
}
function selectAllLibrariesChanged() { function selectAllLibrariesChanged() {
if (selectAllLibraries.checked) { if (selectAllLibraries.checked) {
librariesContainer.style.display = 'none'; librariesContainer.style.display = 'none';

View File

@ -44,10 +44,10 @@ public class AutoSkip(
private void AutoSkipChanged(object? sender, BasePluginConfiguration e) private void AutoSkipChanged(object? sender, BasePluginConfiguration e)
{ {
var configuration = (PluginConfiguration)e; var configuration = (PluginConfiguration)e;
var newState = configuration.AutoSkip; _clientList = [.. configuration.ClientList.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)];
var newState = configuration.AutoSkip || (configuration.SkipButtonVisible && _clientList.Count > 0);
_logger.LogDebug("Setting playback timer enabled to {NewState}", newState); _logger.LogDebug("Setting playback timer enabled to {NewState}", newState);
_playbackTimer.Enabled = newState; _playbackTimer.Enabled = newState;
_clientList = [.. configuration.ClientList.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)];
} }
private void UserDataManager_UserDataSaved(object? sender, UserDataSaveEventArgs e) private void UserDataManager_UserDataSaved(object? sender, UserDataSaveEventArgs e)
@ -105,7 +105,7 @@ public class AutoSkip(
private void PlaybackTimer_Elapsed(object? sender, ElapsedEventArgs e) private void PlaybackTimer_Elapsed(object? sender, ElapsedEventArgs e)
{ {
foreach (var session in _sessionManager.Sessions.Where(s => _clientList.Contains(s.Client, StringComparer.OrdinalIgnoreCase))) foreach (var session in _sessionManager.Sessions.Where(s => Plugin.Instance!.Configuration.AutoSkip || (Plugin.Instance!.Configuration.SkipButtonVisible && _clientList.Contains(s.Client, StringComparer.OrdinalIgnoreCase))))
{ {
var deviceId = session.DeviceId; var deviceId = session.DeviceId;
var itemId = session.NowPlayingItem.Id; var itemId = session.NowPlayingItem.Id;

View File

@ -44,10 +44,10 @@ public class AutoSkipCredits(
private void AutoSkipCreditChanged(object? sender, BasePluginConfiguration e) private void AutoSkipCreditChanged(object? sender, BasePluginConfiguration e)
{ {
var configuration = (PluginConfiguration)e; var configuration = (PluginConfiguration)e;
var newState = configuration.AutoSkipCredits; _clientList = [.. configuration.ClientList.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)];
var newState = configuration.AutoSkipCredits || (configuration.SkipButtonVisible && _clientList.Count > 0);
_logger.LogDebug("Setting playback timer enabled to {NewState}", newState); _logger.LogDebug("Setting playback timer enabled to {NewState}", newState);
_playbackTimer.Enabled = newState; _playbackTimer.Enabled = newState;
_clientList = [.. configuration.ClientList.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)];
} }
private void UserDataManager_UserDataSaved(object? sender, UserDataSaveEventArgs e) private void UserDataManager_UserDataSaved(object? sender, UserDataSaveEventArgs e)
@ -105,7 +105,7 @@ public class AutoSkipCredits(
private void PlaybackTimer_Elapsed(object? sender, ElapsedEventArgs e) private void PlaybackTimer_Elapsed(object? sender, ElapsedEventArgs e)
{ {
foreach (var session in _sessionManager.Sessions.Where(s => _clientList.Contains(s.Client, StringComparer.OrdinalIgnoreCase))) foreach (var session in _sessionManager.Sessions.Where(s => Plugin.Instance!.Configuration.AutoSkipCredits || (Plugin.Instance!.Configuration.SkipButtonVisible && _clientList.Contains(s.Client, StringComparer.OrdinalIgnoreCase))))
{ {
var deviceId = session.DeviceId; var deviceId = session.DeviceId;
var itemId = session.NowPlayingItem.Id; var itemId = session.NowPlayingItem.Id;