Non-destructive 10.10 config (#343)
This commit is contained in:
parent
75352dd1c4
commit
50ab82a2e0
@ -36,17 +36,17 @@ public class PluginConfiguration : BasePluginConfiguration
|
||||
/// <summary>
|
||||
/// Gets or sets the list of client to auto skip for.
|
||||
/// </summary>
|
||||
public string ClientList { get; set; } = "Kodi";
|
||||
public string ClientList { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to scan for intros during a scheduled task.
|
||||
/// </summary>
|
||||
public bool AutoDetectIntros { get; set; }
|
||||
public bool AutoDetectIntros { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to scan for credits during a scheduled task.
|
||||
/// </summary>
|
||||
public bool AutoDetectCredits { get; set; }
|
||||
public bool AutoDetectCredits { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to analyze season 0.
|
||||
@ -131,7 +131,7 @@ public class PluginConfiguration : BasePluginConfiguration
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to show the skip intro button.
|
||||
/// </summary>
|
||||
public bool SkipButtonVisible { get; set; } = true;
|
||||
public bool SkipButtonVisible { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether to show the skip intro warning.
|
||||
|
@ -291,20 +291,6 @@
|
||||
<br />
|
||||
</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">
|
||||
<summary>Auto Skip Client List</summary>
|
||||
<br />
|
||||
@ -313,6 +299,20 @@
|
||||
<input id="ClientList" type="hidden" is="emby-input" />
|
||||
</details>
|
||||
|
||||
<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">
|
||||
(<strong>Restart required!</strong>) If checked, a skip button will be displayed according to the settings below, while clients selected in the Auto Skip Client List will still 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>
|
||||
|
||||
<div id="SkipButtonSettings">
|
||||
<div id="PersistContainer" class="checkboxContainer checkboxContainer-withDescription">
|
||||
<label class="emby-checkbox-label">
|
||||
|
@ -476,7 +476,15 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
|
||||
_logger.LogDebug("Reading index.html from {Path}", indexPath);
|
||||
string contents = File.ReadAllText(indexPath);
|
||||
|
||||
// change URL with every relase to prevent the Browers from caching
|
||||
if (!Instance!.Configuration.SkipButtonVisible)
|
||||
{
|
||||
pattern = @"<script src=""configurationpage\?name=skip-intro-button\.js.*<\/script>";
|
||||
contents = Regex.Replace(contents, pattern, string.Empty, RegexOptions.IgnoreCase);
|
||||
File.WriteAllText(indexPath, contents);
|
||||
return; // Button is disabled, so remove and abort
|
||||
}
|
||||
|
||||
// change URL with every release to prevent the Browers from caching
|
||||
string scriptTag = "<script src=\"configurationpage?name=skip-intro-button.js&release=" + GetType().Assembly.GetName().Version + "\"></script>";
|
||||
|
||||
// Only inject the script tag once
|
||||
|
@ -45,7 +45,7 @@ public class AutoSkip(
|
||||
{
|
||||
var configuration = (PluginConfiguration)e;
|
||||
_clientList = [.. configuration.ClientList.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)];
|
||||
var newState = configuration.AutoSkip || (configuration.SkipButtonVisible && _clientList.Count > 0);
|
||||
var newState = configuration.AutoSkip || _clientList.Count > 0;
|
||||
_logger.LogDebug("Setting playback timer enabled to {NewState}", newState);
|
||||
_playbackTimer.Enabled = newState;
|
||||
}
|
||||
@ -105,7 +105,7 @@ public class AutoSkip(
|
||||
|
||||
private void PlaybackTimer_Elapsed(object? sender, ElapsedEventArgs e)
|
||||
{
|
||||
foreach (var session in _sessionManager.Sessions.Where(s => Plugin.Instance!.Configuration.AutoSkip || (Plugin.Instance!.Configuration.SkipButtonVisible && _clientList.Contains(s.Client, StringComparer.OrdinalIgnoreCase))))
|
||||
foreach (var session in _sessionManager.Sessions.Where(s => Plugin.Instance!.Configuration.AutoSkip || _clientList.Contains(s.Client, StringComparer.OrdinalIgnoreCase)))
|
||||
{
|
||||
var deviceId = session.DeviceId;
|
||||
var itemId = session.NowPlayingItem.Id;
|
||||
|
@ -45,7 +45,7 @@ public class AutoSkipCredits(
|
||||
{
|
||||
var configuration = (PluginConfiguration)e;
|
||||
_clientList = [.. configuration.ClientList.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)];
|
||||
var newState = configuration.AutoSkipCredits || (configuration.SkipButtonVisible && _clientList.Count > 0);
|
||||
var newState = configuration.AutoSkipCredits || _clientList.Count > 0;
|
||||
_logger.LogDebug("Setting playback timer enabled to {NewState}", newState);
|
||||
_playbackTimer.Enabled = newState;
|
||||
}
|
||||
@ -105,7 +105,7 @@ public class AutoSkipCredits(
|
||||
|
||||
private void PlaybackTimer_Elapsed(object? sender, ElapsedEventArgs e)
|
||||
{
|
||||
foreach (var session in _sessionManager.Sessions.Where(s => Plugin.Instance!.Configuration.AutoSkipCredits || (Plugin.Instance!.Configuration.SkipButtonVisible && _clientList.Contains(s.Client, StringComparer.OrdinalIgnoreCase))))
|
||||
foreach (var session in _sessionManager.Sessions.Where(s => Plugin.Instance!.Configuration.AutoSkipCredits || _clientList.Contains(s.Client, StringComparer.OrdinalIgnoreCase)))
|
||||
{
|
||||
var deviceId = session.DeviceId;
|
||||
var itemId = session.NowPlayingItem.Id;
|
||||
|
Loading…
x
Reference in New Issue
Block a user