Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of credits skip delay (Issue #221) #235

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ConfusedPolarBear.Plugin.IntroSkipper/AutoSkipCredits.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,16 @@ private void PlaybackTimer_Elapsed(object? sender, ElapsedEventArgs e)
continue;
}

// Seek is unreliable if called at the very start of an episode.
var adjustedStart = Math.Max(5, credit.IntroStart);
// Seek is unreliable if called at the very end of an episode.
var adjustedEnd = Math.Max(5, credit.IntroEnd) + Plugin.Instance.Configuration.SecondsOfCreditsToPlay;

_logger.LogTrace(
"Playback position is {Position}, credits run from {Start} to {End}",
position,
adjustedStart,
credit.IntroEnd);
credit.IntroStart,
adjustedEnd);

if (position < adjustedStart || position > credit.IntroEnd)
if (position < credit.IntroStart || position > adjustedEnd)
{
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ public PluginConfiguration()
/// </summary>
public int SecondsOfIntroToPlay { get; set; } = 2;

/// <summary>
/// Gets or sets the amount of credits to play (in seconds).
/// </summary>
public int SecondsOfCreditsToPlay { get; set; } = 0;

// ===== Internal algorithm settings =====

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,16 @@
</div>
</div>

<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="SecondsOfCreditsToPlay">
Credits playback duration (in seconds)
</label>
<input id="SecondsOfCreditsToPlay" type="number" is="emby-input" min="0" />
<div class="fieldDescription">
Seconds of credits that should be played. Defaults to 0.
</div>
</div>

<details>
<summary>User Interface Customization</summary>

Expand Down Expand Up @@ -682,6 +692,7 @@ <h3>Fingerprint Visualizer</h3>
"ShowPromptAdjustment",
"HidePromptAdjustment",
"SecondsOfIntroToPlay",
"SecondsOfCreditsToPlay",
// internals
"SilenceDetectionMaximumNoise",
"SilenceDetectionMinimumDuration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public ActionResult<Dictionary<AnalysisMode, Intro>> GetSkippableSegments([FromR
var segment = new Intro(timestamp);

var config = Plugin.Instance.Configuration;
segment.IntroEnd -= config.SecondsOfIntroToPlay;
segment.IntroEnd -= mode == AnalysisMode.Introduction ? config.SecondsOfIntroToPlay : config.SecondsOfCreditsToPlay;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jumoog may want this to check that it's the credits for adding recap stuff.

if (config.PersistSkipButton)
{
segment.ShowSkipPromptAt = segment.IntroStart;
Expand Down