Finished off sonarr integration (Non anime) and refactored requests into a Http helper.
This commit is contained in:
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user