feat(cli): Support for downloading an episode release in Sonarr
This commit is contained in:
@@ -60,6 +60,23 @@ pub enum SonarrDownloadCommand {
|
||||
)]
|
||||
season_number: i64,
|
||||
},
|
||||
#[command(about = "Manually download the given episode release for the specified episode ID")]
|
||||
Episode {
|
||||
#[arg(long, help = "The GUID of the release to download", required = true)]
|
||||
guid: String,
|
||||
#[arg(
|
||||
long,
|
||||
help = "The indexer ID to download the release from",
|
||||
required = true
|
||||
)]
|
||||
indexer_id: i64,
|
||||
#[arg(
|
||||
long,
|
||||
help = "The episode ID that the release is associated with",
|
||||
required = true
|
||||
)]
|
||||
episode_id: i64,
|
||||
},
|
||||
}
|
||||
|
||||
impl From<SonarrDownloadCommand> for Command {
|
||||
@@ -127,6 +144,23 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrDownloadCommand>
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrDownloadCommand::Episode {
|
||||
guid,
|
||||
indexer_id,
|
||||
episode_id,
|
||||
} => {
|
||||
let params = SonarrReleaseDownloadBody {
|
||||
guid,
|
||||
indexer_id,
|
||||
episode_id: Some(episode_id),
|
||||
..SonarrReleaseDownloadBody::default()
|
||||
};
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event(SonarrEvent::DownloadRelease(params).into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
};
|
||||
|
||||
Ok(result)
|
||||
|
||||
Reference in New Issue
Block a user