Support erasing times for intros and end credits
This commit is contained in:
parent
94bd2a059e
commit
16251f0735
@ -201,7 +201,8 @@
|
||||
</label>
|
||||
|
||||
<div class="fieldDescription">
|
||||
If checked, intros will be automatically skipped. If you access Jellyfin through a reverse proxy, it must be configured to proxy web
|
||||
If checked, intros will be automatically skipped. If you access Jellyfin through a
|
||||
reverse proxy, it must be configured to proxy web
|
||||
sockets.<br />
|
||||
</div>
|
||||
</div>
|
||||
@ -253,10 +254,6 @@
|
||||
<span>Save</span>
|
||||
</button>
|
||||
<br />
|
||||
|
||||
<button id="btnEraseTimestamps" is="emby-button" class="raised block emby-button">
|
||||
<span>Erase introduction timestamps</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -302,7 +299,17 @@
|
||||
<button id="btnEraseSeasonTimestamps" type="button">
|
||||
Erase all timestamps for this season
|
||||
</button>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<button id="btnEraseIntroTimestamps">
|
||||
Erase all introduction timestamps (globally)
|
||||
</button>
|
||||
<br />
|
||||
|
||||
<button id="btnEraseCreditTimestamps">
|
||||
Erase all end credits timestamps (globally)
|
||||
</button>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
@ -376,7 +383,8 @@
|
||||
// settings elements
|
||||
var visualizer = document.querySelector("details#visualizer");
|
||||
var support = document.querySelector("details#support");
|
||||
var btnEraseTimestamps = document.querySelector("button#btnEraseTimestamps");
|
||||
var btnEraseIntroTimestamps = document.querySelector("button#btnEraseIntroTimestamps");
|
||||
var btnEraseCreditTimestamps = document.querySelector("button#btnEraseCreditTimestamps");
|
||||
|
||||
// all plugin configuration fields that can be get or set with .value (i.e. strings or numbers).
|
||||
var configurationFields = [
|
||||
@ -662,6 +670,28 @@
|
||||
return new Date(seconds * 1000).toISOString().substr(14, 5);
|
||||
}
|
||||
|
||||
// erase all intro/credits timestamps
|
||||
function eraseTimestamps(mode) {
|
||||
const lower = mode.toLocaleLowerCase();
|
||||
const title = "Confirm timestamp erasure";
|
||||
const body = "Are you sure you want to erase all previously discovered " +
|
||||
mode.toLocaleLowerCase() +
|
||||
" timestamps?";
|
||||
|
||||
Dashboard.confirm(
|
||||
body,
|
||||
title,
|
||||
(result) => {
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetchWithAuth("Intros/EraseTimestamps?mode=" + mode, "POST", null);
|
||||
|
||||
Dashboard.alert(mode + " timestamps erased");
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelector('#TemplateConfigPage')
|
||||
.addEventListener('pageshow', function () {
|
||||
Dashboard.showLoadingMsg();
|
||||
@ -707,19 +737,12 @@
|
||||
selectSeason.addEventListener("change", seasonChanged);
|
||||
selectEpisode1.addEventListener("change", episodeChanged);
|
||||
selectEpisode2.addEventListener("change", episodeChanged);
|
||||
btnEraseTimestamps.addEventListener("click", (e) => {
|
||||
Dashboard.confirm(
|
||||
"Are you sure you want to erase all previously discovered introduction timestamps?",
|
||||
"Confirm timestamp erasure",
|
||||
(result) => {
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
|
||||
// reset all intro timestamps on the server so a new fingerprint comparison algorithm can be tested
|
||||
fetchWithAuth("Intros/EraseTimestamps", "POST", null);
|
||||
});
|
||||
|
||||
btnEraseIntroTimestamps.addEventListener("click", (e) => {
|
||||
eraseTimestamps("Introduction");
|
||||
e.preventDefault();
|
||||
});
|
||||
btnEraseCreditTimestamps.addEventListener("click", (e) => {
|
||||
eraseTimestamps("Credits");
|
||||
e.preventDefault();
|
||||
});
|
||||
btnSeasonEraseTimestamps.addEventListener("click", () => {
|
||||
|
@ -76,13 +76,22 @@ public class SkipIntroController : ControllerBase
|
||||
/// <summary>
|
||||
/// Erases all previously discovered introduction timestamps.
|
||||
/// </summary>
|
||||
/// <param name="mode">Mode.</param>
|
||||
/// <response code="204">Operation successful.</response>
|
||||
/// <returns>No content.</returns>
|
||||
[Authorize(Policy = "RequiresElevation")]
|
||||
[HttpPost("Intros/EraseTimestamps")]
|
||||
public ActionResult ResetIntroTimestamps()
|
||||
public ActionResult ResetIntroTimestamps([FromQuery] AnalysisMode mode)
|
||||
{
|
||||
Plugin.Instance!.Intros.Clear();
|
||||
if (mode == AnalysisMode.Introduction)
|
||||
{
|
||||
Plugin.Instance!.Intros.Clear();
|
||||
}
|
||||
else if (mode == AnalysisMode.Credits)
|
||||
{
|
||||
Plugin.Instance!.Credits.Clear();
|
||||
}
|
||||
|
||||
Plugin.Instance!.SaveTimestamps();
|
||||
return NoContent();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user