feat(cli): Support for triggering an automatic episode search in Sonarr

This commit is contained in:
2024-11-22 18:35:38 -07:00
parent 40bb22ef7c
commit b8e4deb80f
2 changed files with 74 additions and 0 deletions
+16
View File
@@ -121,6 +121,15 @@ pub enum SonarrCommand {
#[arg(long, help = "The season number to search for", required = true)]
season_number: i64,
},
#[command(about = "Trigger an automatic search for the episode with the specified ID")]
TriggerAutomaticEpisodeSearch {
#[arg(
long,
help = "The ID of the episode you want to trigger an automatic search for",
required = true
)]
episode_id: i64,
},
}
impl From<SonarrCommand> for Command {
@@ -250,6 +259,13 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrCommand> for SonarrCliHandler<'a, '
.await?;
serde_json::to_string_pretty(&resp)?
}
SonarrCommand::TriggerAutomaticEpisodeSearch { episode_id } => {
let resp = self
.network
.handle_network_event(SonarrEvent::TriggerAutomaticEpisodeSearch(Some(episode_id)).into())
.await?;
serde_json::to_string_pretty(&resp)?
}
};
Ok(result)