feat(cli): Support for refreshing a specific series in Sonarr

This commit is contained in:
2024-11-22 19:13:57 -07:00
parent c3577a0724
commit eb06787bb2
3 changed files with 100 additions and 27 deletions
+16
View File
@@ -19,6 +19,15 @@ mod refresh_command_handler_tests;
pub enum SonarrRefreshCommand {
#[command(about = "Refresh all series data for all series in your Sonarr library")]
AllSeries,
#[command(about = "Refresh series data and scan disk for the series with the given ID")]
Series {
#[arg(
long,
help = "The ID of the series to refresh information on and to scan the disk for",
required = true
)]
series_id: i64,
},
}
impl From<SonarrRefreshCommand> for Command {
@@ -57,6 +66,13 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrRefreshCommand>
.await?;
serde_json::to_string_pretty(&resp)?
}
SonarrRefreshCommand::Series { series_id } => {
let resp = self
.network
.handle_network_event(SonarrEvent::UpdateAndScanSeries(Some(series_id)).into())
.await?;
serde_json::to_string_pretty(&resp)?
}
};
Ok(result)