feat(cli): Support for downloading a season release in Sonarr
This commit is contained in:
@@ -35,6 +35,31 @@ pub enum SonarrDownloadCommand {
|
||||
)]
|
||||
series_id: i64,
|
||||
},
|
||||
#[command(
|
||||
about = "Manually download the given season release corresponding to the series specified with the series ID"
|
||||
)]
|
||||
Season {
|
||||
#[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 series ID that the release is associated with",
|
||||
required = true
|
||||
)]
|
||||
series_id: i64,
|
||||
#[arg(
|
||||
long,
|
||||
help = "The season number that the release corresponds to",
|
||||
required = true
|
||||
)]
|
||||
season_number: i64,
|
||||
},
|
||||
}
|
||||
|
||||
impl From<SonarrDownloadCommand> for Command {
|
||||
@@ -83,6 +108,25 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrDownloadCommand>
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrDownloadCommand::Season {
|
||||
guid,
|
||||
indexer_id,
|
||||
series_id,
|
||||
season_number,
|
||||
} => {
|
||||
let params = SonarrReleaseDownloadBody {
|
||||
guid,
|
||||
indexer_id,
|
||||
series_id: Some(series_id),
|
||||
season_number: Some(season_number),
|
||||
..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