diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html
index db460d7..a382cd3 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html
@@ -158,6 +158,12 @@
+
+
+
+
@@ -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);
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/VisualizationController.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/VisualizationController.cs
index 99cbfe0..0aa5bde 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/VisualizationController.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/VisualizationController.cs
@@ -122,6 +122,34 @@ public class VisualizationController : ControllerBase
return NotFound();
}
+ ///
+ /// Erases all timestamps for the provided season.
+ ///
+ /// Show name.
+ /// Season name.
+ /// Season timestamps erased.
+ /// Unable to find season in provided series.
+ /// No content.
+ [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);