Add option for persistent skip button

This commit is contained in:
TwistedUmbrellaX 2024-03-01 09:19:12 -05:00 committed by Kilian von Pflugk
parent 05de2b44fe
commit 9dbe22c741
3 changed files with 32 additions and 7 deletions

View File

@ -122,10 +122,15 @@ public class PluginConfiguration : BasePluginConfiguration
public int HidePromptAdjustment { get; set; } = 10; public int HidePromptAdjustment { get; set; } = 10;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the introduction in the first episode of a season should be skipped. /// Gets or sets a value indicating whether the introduction in the first episode of a season should be ignored.
/// </summary> /// </summary>
public bool SkipFirstEpisode { get; set; } = true; public bool SkipFirstEpisode { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether the skip button should be displayed for the duration of the intro.
/// </summary>
public bool PersistSkipButton { get; set; } = true;
/// <summary> /// <summary>
/// Gets or sets the amount of intro to play (in seconds). /// Gets or sets the amount of intro to play (in seconds).
/// </summary> /// </summary>

View File

@ -231,6 +231,17 @@
</div> </div>
</div> </div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label">
<input id="PersistSkipButton" type="checkbox" is="emby-checkbox" />
<span>Display skip through entire intro</span>
</label>
<div class="fieldDescription">
If checked, skip button will appear through entire intro (offset and timeout are ignored).<br />
</div>
</div>
<div class="inputContainer"> <div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="ShowPromptAdjustment"> <label class="inputLabel inputLabelUnfocused" for="ShowPromptAdjustment">
Skip prompt offset (in seoncds) Skip prompt offset (in seoncds)
@ -253,11 +264,11 @@
<div class="inputContainer"> <div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="SecondsOfIntroToPlay"> <label class="inputLabel inputLabelUnfocused" for="SecondsOfIntroToPlay">
Intro playback offset (in seconds) Intro playback duration (in seconds)
</label> </label>
<input id="SecondsOfIntroToPlay" type="number" is="emby-input" min="0" /> <input id="SecondsOfIntroToPlay" type="number" is="emby-input" min="0" />
<div class="fieldDescription"> <div class="fieldDescription">
Seconds of introduction that should be played. Defaults to 2. Seconds of introduction ending that should be played. Defaults to 2.
</div> </div>
</div> </div>

View File

@ -87,10 +87,19 @@ public class SkipIntroController : ControllerBase
var segment = new Intro(timestamp); var segment = new Intro(timestamp);
var config = Plugin.Instance!.Configuration; var config = Plugin.Instance!.Configuration;
segment.ShowSkipPromptAt = Math.Max(0, segment.IntroStart - config.ShowPromptAdjustment); if (config.PersistSkipButton)
segment.HideSkipPromptAt = Math.Min( {
segment.IntroStart + config.HidePromptAdjustment, segment.ShowSkipPromptAt = Math.Max(0, segment.IntroStart - config.ShowPromptAdjustment);
segment.IntroEnd); segment.HideSkipPromptAt = Math.Min(
segment.IntroStart + config.HidePromptAdjustment,
segment.IntroEnd);
}
else
{
segment.ShowSkipPromptAt = segment.IntroStart;
segment.HideSkipPromptAt = segment.IntroEnd;
}
segment.IntroEnd -= config.SecondsOfIntroToPlay; segment.IntroEnd -= config.SecondsOfIntroToPlay;
return segment; return segment;