Add button to erase season timestamps
This commit is contained in:
parent
85a41ea768
commit
a9ada48d3b
@ -158,6 +158,12 @@
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<button id="btnEraseSeasonTimestamps" type="button">
|
||||
Erase Season Timestamps
|
||||
</button>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<canvas id="troubleshooter"></canvas>
|
||||
<span id="timestampContainer">
|
||||
<span id="timestamps"></span> <br />
|
||||
@ -177,16 +183,20 @@
|
||||
// seasons grouped by show
|
||||
var shows = {};
|
||||
|
||||
// ui elements
|
||||
// settings elements
|
||||
var visualizer = document.querySelector("details#visualizer");
|
||||
var btnEraseTimestamps = document.querySelector("button#btnEraseTimestamps");
|
||||
|
||||
// visualizer elements
|
||||
var canvas = document.querySelector("canvas#troubleshooter");
|
||||
var selectShow = document.querySelector("select#troubleshooterShow");
|
||||
var selectSeason = document.querySelector("select#troubleshooterSeason");
|
||||
var selectEpisode1 = document.querySelector("select#troubleshooterEpisode1");
|
||||
var selectEpisode2 = document.querySelector("select#troubleshooterEpisode2");
|
||||
var txtOffset = document.querySelector("input#offset");
|
||||
var btnSeasonEraseTimestamps = document.querySelector("button#btnEraseSeasonTimestamps");
|
||||
var timeContainer = document.querySelector("span#timestampContainer");
|
||||
var btnEraseTimestamps = document.querySelector("button#btnEraseTimestamps");
|
||||
|
||||
var windowHashInterval = 0;
|
||||
|
||||
// when the fingerprint visualizer opens, populate show names
|
||||
@ -510,6 +520,15 @@
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
btnSeasonEraseTimestamps.addEventListener("click", () => {
|
||||
const show = selectShow.value;
|
||||
const season = selectSeason.value;
|
||||
|
||||
const url = "Intros/Show/" + encodeURIComponent(show) + "/" + encodeURIComponent(season);
|
||||
getJson(url, "DELETE");
|
||||
|
||||
Dashboard.alert("Erased timestamps for " + season + " of " + show);
|
||||
});
|
||||
document.addEventListener("keydown", keyDown);
|
||||
windowHashInterval = setInterval(checkWindowHash, 2500);
|
||||
|
||||
|
@ -122,6 +122,34 @@ public class VisualizationController : ControllerBase
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Erases all timestamps for the provided season.
|
||||
/// </summary>
|
||||
/// <param name="series">Show name.</param>
|
||||
/// <param name="season">Season name.</param>
|
||||
/// <response code="204">Season timestamps erased.</response>
|
||||
/// <response code="404">Unable to find season in provided series.</response>
|
||||
/// <returns>No content.</returns>
|
||||
[HttpDelete("Show/{Series}/{Season}")]
|
||||
public ActionResult EraseSeason([FromRoute] string series, [FromRoute] string season)
|
||||
{
|
||||
if (!LookupSeasonByName(series, season, out var episodes))
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_logger.LogInformation("Erasing timestamps for {Series} {Season} at user request", series, season);
|
||||
|
||||
foreach (var e in episodes)
|
||||
{
|
||||
Plugin.Instance!.Intros.Remove(e.EpisodeId);
|
||||
}
|
||||
|
||||
Plugin.Instance!.SaveTimestamps();
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
private string GetSeasonName(QueuedEpisode episode)
|
||||
{
|
||||
return "Season " + episode.SeasonNumber.ToString(CultureInfo.InvariantCulture);
|
||||
|
Loading…
x
Reference in New Issue
Block a user