Allow configuring show/hide prompt times
This commit is contained in:
parent
1c55d749a3
commit
98b0ebe6ce
@ -22,4 +22,14 @@ public class PluginConfiguration : BasePluginConfiguration
|
||||
/// If the output of fpcalc should be cached to the filesystem.
|
||||
/// </summary>
|
||||
public bool CacheFingerprints { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Seconds before the intro starts to show the skip prompt at.
|
||||
/// </summary>
|
||||
public int ShowPromptAdjustment { get; set; } = 5;
|
||||
|
||||
/// <summary>
|
||||
/// Seconds after the intro starts to hide the skip prompt at.
|
||||
/// </summary>
|
||||
public int HidePromptAdjustment { get; set; } = 10;
|
||||
}
|
||||
|
@ -20,6 +20,23 @@
|
||||
Caching fingerprints avoids having to re-run fpcalc on each file, at the expense of disk usage.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="AnInteger">Show skip prompt at</label>
|
||||
<input id="ShowPromptAdjustment" type="number" is="emby-input" min="0" />
|
||||
<div class="fieldDescription">
|
||||
Seconds before the introduction starts to display the skip prompt at.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="AnInteger">Hide skip prompt at</label>
|
||||
<input id="HidePromptAdjustment" type="number" is="emby-input" min="0" />
|
||||
<div class="fieldDescription">
|
||||
Seconds after the introduction starts to hide the skip prompt at.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button is="emby-button" type="submit" class="raised button-submit block emby-button">
|
||||
<span>Save</span>
|
||||
@ -38,6 +55,10 @@
|
||||
Dashboard.showLoadingMsg();
|
||||
ApiClient.getPluginConfiguration(TemplateConfig.pluginUniqueId).then(function (config) {
|
||||
document.querySelector('#CacheFingerprints').checked = config.CacheFingerprints;
|
||||
|
||||
document.querySelector('#ShowPromptAdjustment').value = config.ShowPromptAdjustment;
|
||||
document.querySelector('#HidePromptAdjustment').value = config.HidePromptAdjustment;
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
});
|
||||
@ -47,6 +68,10 @@
|
||||
Dashboard.showLoadingMsg();
|
||||
ApiClient.getPluginConfiguration(TemplateConfig.pluginUniqueId).then(function (config) {
|
||||
config.CacheFingerprints = document.querySelector('#CacheFingerprints').checked;
|
||||
|
||||
config.ShowPromptAdjustment = document.querySelector("#ShowPromptAdjustment").value;
|
||||
config.HidePromptAdjustment = document.querySelector("#HidePromptAdjustment").value;
|
||||
|
||||
ApiClient.updatePluginConfiguration(TemplateConfig.pluginUniqueId, config).then(function (result) {
|
||||
Dashboard.processPluginConfigurationUpdateResult(result);
|
||||
});
|
||||
|
@ -42,6 +42,11 @@ public class SkipIntroController : ControllerBase
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
// Populate the prompt show/hide times.
|
||||
var config = Plugin.Instance!.Configuration;
|
||||
intro.ShowSkipPromptAt = Math.Max(0, intro.IntroStart - config.ShowPromptAdjustment);
|
||||
intro.HideSkipPromptAt = intro.IntroStart + config.HidePromptAdjustment;
|
||||
|
||||
return intro;
|
||||
}
|
||||
}
|
||||
|
@ -350,16 +350,12 @@ public class FingerprinterTask : IScheduledTask {
|
||||
|
||||
private static void storeIntro(Guid episode, double introStart, double introEnd)
|
||||
{
|
||||
// Recommend that the skip button appears 5 seconds ahead of the intro
|
||||
// and that it disappears 10 seconds after the intro begins.
|
||||
Plugin.Instance!.Intros[episode] = new Intro()
|
||||
{
|
||||
EpisodeId = episode,
|
||||
Valid = introEnd > 0,
|
||||
IntroStart = introStart,
|
||||
IntroEnd = introEnd,
|
||||
ShowSkipPromptAt = Math.Max(0, introStart - 5),
|
||||
HideSkipPromptAt = introStart + 10
|
||||
IntroEnd = introEnd
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user