feat(cli): Support for adding a series to Sonarr
This commit is contained in:
@@ -7,7 +7,7 @@ use tokio::sync::Mutex;
|
||||
use crate::{
|
||||
app::App,
|
||||
cli::{CliCommandHandler, Command},
|
||||
models::radarr_models::{AddMovieBody, AddOptions, MinimumAvailability, Monitor},
|
||||
models::radarr_models::{AddMovieBody, AddMovieOptions, MinimumAvailability, MovieMonitor},
|
||||
network::{radarr_network::RadarrEvent, NetworkTrait},
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ pub enum RadarrAddCommand {
|
||||
default_value_t = MinimumAvailability::default()
|
||||
)]
|
||||
minimum_availability: MinimumAvailability,
|
||||
#[arg(long, help = "Should Radarr monitor this film")]
|
||||
#[arg(long, help = "Disable monitoring for this film")]
|
||||
disable_monitoring: bool,
|
||||
#[arg(
|
||||
long,
|
||||
@@ -59,9 +59,9 @@ pub enum RadarrAddCommand {
|
||||
long,
|
||||
help = "What Radarr should monitor",
|
||||
value_enum,
|
||||
default_value_t = Monitor::default()
|
||||
default_value_t = MovieMonitor::default()
|
||||
)]
|
||||
monitor: Monitor,
|
||||
monitor: MovieMonitor,
|
||||
#[arg(
|
||||
long,
|
||||
help = "Tell Radarr to not start a search for this film once it's added to your library"
|
||||
@@ -125,7 +125,7 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, RadarrAddCommand> for RadarrAddCommandHan
|
||||
minimum_availability: minimum_availability.to_string(),
|
||||
monitored: !disable_monitoring,
|
||||
tags,
|
||||
add_options: AddOptions {
|
||||
add_options: AddMovieOptions {
|
||||
monitor: monitor.to_string(),
|
||||
search_for_movie: !no_search_for_movie,
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ mod tests {
|
||||
radarr::{add_command_handler::RadarrAddCommand, RadarrCommand},
|
||||
Command,
|
||||
},
|
||||
models::radarr_models::{MinimumAvailability, Monitor},
|
||||
models::radarr_models::{MinimumAvailability, MovieMonitor},
|
||||
Cli,
|
||||
};
|
||||
use pretty_assertions::assert_eq;
|
||||
@@ -112,6 +112,8 @@ mod tests {
|
||||
"/test",
|
||||
"--quality-profile-id",
|
||||
"1",
|
||||
"--tmdb-id",
|
||||
"1",
|
||||
flag,
|
||||
]);
|
||||
|
||||
@@ -188,7 +190,7 @@ mod tests {
|
||||
minimum_availability: MinimumAvailability::default(),
|
||||
disable_monitoring: false,
|
||||
tag: vec![],
|
||||
monitor: Monitor::default(),
|
||||
monitor: MovieMonitor::default(),
|
||||
no_search_for_movie: false,
|
||||
};
|
||||
|
||||
@@ -220,7 +222,7 @@ mod tests {
|
||||
minimum_availability: MinimumAvailability::default(),
|
||||
disable_monitoring: false,
|
||||
tag: vec![1, 2],
|
||||
monitor: Monitor::default(),
|
||||
monitor: MovieMonitor::default(),
|
||||
no_search_for_movie: false,
|
||||
};
|
||||
|
||||
@@ -256,7 +258,7 @@ mod tests {
|
||||
minimum_availability: MinimumAvailability::Released,
|
||||
disable_monitoring: true,
|
||||
tag: vec![1, 2],
|
||||
monitor: Monitor::MovieAndCollection,
|
||||
monitor: MovieMonitor::MovieAndCollection,
|
||||
no_search_for_movie: true,
|
||||
};
|
||||
|
||||
@@ -357,7 +359,7 @@ mod tests {
|
||||
app::App,
|
||||
cli::{radarr::add_command_handler::RadarrAddCommandHandler, CliCommandHandler},
|
||||
models::{
|
||||
radarr_models::{AddMovieBody, AddOptions, RadarrSerdeable},
|
||||
radarr_models::{AddMovieBody, AddMovieOptions, RadarrSerdeable},
|
||||
Serdeable,
|
||||
},
|
||||
network::{radarr_network::RadarrEvent, MockNetworkTrait, NetworkEvent},
|
||||
@@ -379,7 +381,7 @@ mod tests {
|
||||
minimum_availability: "released".to_owned(),
|
||||
monitored: false,
|
||||
tags: vec![1, 2],
|
||||
add_options: AddOptions {
|
||||
add_options: AddMovieOptions {
|
||||
monitor: "movieAndCollection".to_owned(),
|
||||
search_for_movie: false,
|
||||
},
|
||||
@@ -404,7 +406,7 @@ mod tests {
|
||||
minimum_availability: MinimumAvailability::Released,
|
||||
disable_monitoring: true,
|
||||
tag: vec![1, 2],
|
||||
monitor: Monitor::MovieAndCollection,
|
||||
monitor: MovieMonitor::MovieAndCollection,
|
||||
no_search_for_movie: true,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user