feat(readarr): delete a book and expose the command on the CLI

The delete flags travel as query parameters rather than a request body,
and Readarr spells the exclusion key addImportListExclusion, not the
addImportExclusion that Radarr uses.
This commit is contained in:
Dark-Alex-17 committed 2026-08-27 16:19:49 -06:00
1 parent e30d4dbd0c
commit fbfd64eb2a
6 files changed
+228 -3

No files matched your search

+25
View File
@@ -27,6 +27,15 @@ pub enum ReadarrDeleteCommand {
#[arg(long, help = "Add a list exclusion for this author")]
add_list_exclusion: bool,
},
#[command(about = "Delete a book from your Readarr library")]
Book {
#[arg(long, help = "The ID of the book to delete", required = true)]
book_id: i64,
#[arg(long, help = "Delete the book files from disk as well")]
delete_files_from_disk: bool,
#[arg(long, help = "Add a list exclusion for this book")]
add_list_exclusion: bool,
},
#[command(about = "Delete the root folder with the given ID")]
RootFolder {
#[arg(long, help = "The ID of the root folder to delete", required = true)]
@@ -84,6 +93,22 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, ReadarrDeleteCommand>
.await?;
serde_json::to_string_pretty(&resp)?
}
ReadarrDeleteCommand::Book {
book_id,
delete_files_from_disk,
add_list_exclusion,
} => {
let delete_book_params = DeleteParams {
id: book_id,
delete_files: delete_files_from_disk,
add_import_list_exclusion: add_list_exclusion,
};
let resp = self
.network
.handle_network_event(ReadarrEvent::DeleteBook(delete_book_params).into())
.await?;
serde_json::to_string_pretty(&resp)?
}
ReadarrDeleteCommand::RootFolder { root_folder_id } => {
let resp = self
.network