Compare commits

...

1 Commits

Author SHA1 Message Date
TwistedUmbrellaX
ad186140bd Add skipping last episode minus the episode
Needs to determine if the current episode is the last episode, but this fills in all the UI and config
2024-10-09 06:51:39 -04:00
3 changed files with 29 additions and 2 deletions

View File

@ -163,6 +163,11 @@ public class PluginConfiguration : BasePluginConfiguration
/// </summary>
public bool SkipFirstEpisode { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether the introduction in the last episode of a season should be ignored.
/// </summary>
public bool SkipLastEpisode { get; set; } = false;
/// <summary>
/// Gets or sets a value indicating whether the skip button should be displayed for the duration of the intro.
/// </summary>

View File

@ -375,6 +375,18 @@
<br />
</div>
<div id="divSkipLastEpisode" class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label">
<input id="SkipLastEpisode" type="checkbox" is="emby-checkbox" />
<span>Play intro for last episode of a season</span>
</label>
<div class="fieldDescription">
If checked, auto skip will play the introduction of the last episode in a season.<br />
</div>
<br />
</div>
<div id="divSecondsOfIntroStartToPlay" class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="SecondsOfIntroStartToPlay">
Intro skip delay (in seconds)
@ -817,6 +829,7 @@
"AutoSkip",
"AutoSkipCredits",
"SkipFirstEpisode",
"SkipLastEpisode",
"PersistSkipButton",
"SkipButtonVisible"
]
@ -850,6 +863,7 @@
var selectAllLibraries = document.querySelector("input#SelectAllLibraries");
var librariesContainer = document.querySelector("div.folderAccessListContainer");
var skipFirstEpisode = document.querySelector("div#divSkipFirstEpisode");
var skipLastEpisode = document.querySelector("div#divSkipLastEpisode");
var secondsOfIntroStartToPlay = document.querySelector("div#divSecondsOfIntroStartToPlay");
var autoSkipClientList = document.getElementById("AutoSkipClientList");
var secondsOfCreditsStartToPlay = document.querySelector("div#divSecondsOfCreditsStartToPlay");
@ -892,10 +906,12 @@
function autoSkipChanged() {
if (autoSkip.checked) {
skipFirstEpisode.style.display = 'unset';
skipLastEpisode.style.display = 'unset';
autoSkipNotificationText.style.display = 'unset';
secondsOfIntroStartToPlay.style.display = 'unset';
} else {
skipFirstEpisode.style.display = 'none';
skipLastEpisode.style.display = 'none';
autoSkipNotificationText.style.display = 'none';
secondsOfIntroStartToPlay.style.display = 'none';
}

View File

@ -87,12 +87,18 @@ public class AutoSkip(
return;
}
// If this is the first episode in the season, and SkipFirstEpisode is false, pretend that we've already sent the seek command for this playback session.
// If this is the first episode in the season, and SkipFirstEpisode is true, pretend that we've already sent the seek command for this playback session.
if (Plugin.Instance!.Configuration.SkipFirstEpisode && episodeNumber == 1)
{
newState = true;
}
// If this is the last episode in the season, and SkipLastEpisode is true, pretend that we've already sent the seek command for this playback session.
if (Plugin.Instance!.Configuration.SkipLastEpisode && episodeNumber == 1)
{
newState = true;
}
// Reset the seek command state for this device.
lock (_sentSeekCommandLock)
{