feat: add a button in ManageSlideOver to remove the movie and the file from Radarr/Sonarr

This commit is contained in:
dd060606
2022-07-08 10:51:19 +02:00
parent b67844a0ee
commit 2e7458457e
5 changed files with 237 additions and 16 deletions

View File

@@ -213,6 +213,20 @@ class RadarrAPI extends ServarrBase<{ movieId: number }> {
);
}
}
public removeMovie = async (movieId: number): Promise<void> => {
try {
const { id, title } = await this.getMovieByTmdbId(movieId);
await this.axios.delete(`/movie/${id}`, {
params: {
deleteFiles: true,
addImportExclusion: false,
},
});
logger.info(`[Radarr] Removed movie ${title}`);
} catch (e) {
throw new Error(`[Radarr] Failed to remove movie: ${e.message}`);
}
};
}
export default RadarrAPI;