Finished off sonarr integration (Non anime) and refactored requests into a Http helper.

This commit is contained in:
2026-03-07 23:22:06 -07:00
parent 11c241b149
commit 324d48e7cf
6 changed files with 291 additions and 28 deletions

View File

@@ -108,7 +108,7 @@ const populateTables = async () => {
var cell3 = row.insertCell(2);
cell1.innerHTML = seriesInfo[i].Name;
cell1.className = "table-text";
cell2.innerHTML = seriesInfo[i].Seasons.map(season => season.replace("Season ", "")).join(", ");
cell2.innerHTML = seriesInfo[i].Seasons.map(season => season).join(", ");
cell2.className = "table-text";
cell3.appendChild(createCheckbox(seriesInfo[i], seriesTable, seriesDeleteButton));
cell3.className = "table-checkbox"
@@ -204,6 +204,20 @@ const deleteMovieFromRadarrApi = async (movie) => {
}
}
const deleteSeriesFromSonarrApi = async (series) => {
const response = await fetch("/sonarr/deleteSeriesFromSonarr", {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(series)
});
if(!response.ok){
throw new Error(`Response status: ${response.status}`)
}
}
const deleteFromRadarr = async () => {
// Get all movies with checked checkboxes
const selectedMovies = getCheckedMedia(moviesTable);
@@ -213,7 +227,8 @@ const deleteFromRadarr = async () => {
const deleteFromSonarr = () => {
// Need to GET first for seriesIds?
getCheckedMedia(seriesTable);
const selectedSeries = getCheckedMedia(seriesTable);
selectedSeries.forEach(async series => await deleteSeriesFromSonarrApi(series));
// Use tvdbId included in filenames.
// /api/v5/series?tvdbId=383275
// Possibly use statistics from GET to show on front end?