feat(cli): Support for downloading a season release in Sonarr

This commit is contained in:
2024-11-22 20:00:41 -07:00
parent 8002a5aa1e
commit 5ed3372ae2
2 changed files with 193 additions and 5 deletions
@@ -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)