feat(cli): Support for listing the available disk space for all provisioned root folders in both Radarr and Sonarr

This commit is contained in:
2024-11-22 15:57:05 -07:00
parent a881d1f33a
commit df3cf70682
4 changed files with 22 additions and 0 deletions
+9
View File
@@ -24,6 +24,8 @@ pub enum RadarrListCommand {
Collections,
#[command(about = "List all active downloads in Radarr")]
Downloads,
#[command(about = "List disk space details for all provisioned root folders in Radarr")]
DiskSpace,
#[command(about = "List all Radarr indexers")]
Indexers,
#[command(about = "Fetch Radarr logs")]
@@ -109,6 +111,13 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, RadarrListCommand> for RadarrListCommandH
.await?;
serde_json::to_string_pretty(&resp)?
}
RadarrListCommand::DiskSpace => {
let resp = self
.network
.handle_network_event(RadarrEvent::GetDiskSpace.into())
.await?;
serde_json::to_string_pretty(&resp)?
}
RadarrListCommand::Indexers => {
let resp = self
.network
@@ -29,6 +29,7 @@ mod tests {
"blocklist",
"collections",
"downloads",
"disk-space",
"indexers",
"movies",
"quality-profiles",
@@ -121,6 +122,7 @@ mod tests {
#[case(RadarrListCommand::Blocklist, RadarrEvent::GetBlocklist)]
#[case(RadarrListCommand::Collections, RadarrEvent::GetCollections)]
#[case(RadarrListCommand::Downloads, RadarrEvent::GetDownloads)]
#[case(RadarrListCommand::DiskSpace, RadarrEvent::GetDiskSpace)]
#[case(RadarrListCommand::Indexers, RadarrEvent::GetIndexers)]
#[case(RadarrListCommand::Movies, RadarrEvent::GetMovies)]
#[case(RadarrListCommand::QualityProfiles, RadarrEvent::GetQualityProfiles)]
+9
View File
@@ -22,6 +22,8 @@ pub enum SonarrListCommand {
Blocklist,
#[command(about = "List all active downloads in Sonarr")]
Downloads,
#[command(about = "List disk space details for all provisioned root folders in Sonarr")]
DiskSpace,
#[command(about = "List the episodes for the series with the given ID")]
Episodes {
#[arg(
@@ -119,6 +121,13 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrListCommand> for SonarrListCommandH
.await?;
serde_json::to_string_pretty(&resp)?
}
SonarrListCommand::DiskSpace => {
let resp = self
.network
.handle_network_event(SonarrEvent::GetDiskSpace.into())
.await?;
serde_json::to_string_pretty(&resp)?
}
SonarrListCommand::Episodes { series_id } => {
let resp = self
.network
@@ -28,6 +28,7 @@ mod tests {
"blocklist",
"series",
"downloads",
"disk-space",
"quality-profiles",
"indexers",
"queued-events",
@@ -198,6 +199,7 @@ mod tests {
#[rstest]
#[case(SonarrListCommand::Blocklist, SonarrEvent::GetBlocklist)]
#[case(SonarrListCommand::Downloads, SonarrEvent::GetDownloads)]
#[case(SonarrListCommand::DiskSpace, SonarrEvent::GetDiskSpace)]
#[case(SonarrListCommand::Indexers, SonarrEvent::GetIndexers)]
#[case(SonarrListCommand::QualityProfiles, SonarrEvent::GetQualityProfiles)]
#[case(SonarrListCommand::QueuedEvents, SonarrEvent::GetQueuedEvents)]