Mostly added Add movie functionality. Removed calendar functions for now. Want to add the ability to modify settings and quality profiles first

This commit is contained in:
2023-08-08 10:50:04 -06:00
parent ae6e19a414
commit 08cde20359
14 changed files with 475 additions and 98 deletions
+5
View File
@@ -9,6 +9,7 @@ macro_rules! generate_keybindings {
}
generate_keybindings! {
add,
up,
down,
left,
@@ -30,6 +31,10 @@ pub struct KeyBinding {
}
pub const DEFAULT_KEYBINDINGS: KeyBindings = KeyBindings {
add: KeyBinding {
key: Key::Char('a'),
desc: "Add",
},
up: KeyBinding {
key: Key::Up,
desc: "Scroll up",
+4 -1
View File
@@ -30,6 +30,7 @@ pub struct App {
pub is_routing: bool,
pub is_loading: bool,
pub should_refresh: bool,
pub should_ignore_quit_key: bool,
pub config: AppConfig,
pub data: Data,
}
@@ -119,7 +120,8 @@ impl Default for App {
TabRoute {
title: "Radarr".to_owned(),
route: ActiveRadarrBlock::Movies.into(),
help: "<tab> change servarr | <?> help | <q> quit ".to_owned(),
help: "<↑↓> scroll | ←→ change tab | <tab> change servarr | <?> help | <q> quit "
.to_owned(),
},
TabRoute {
title: "Sonarr".to_owned(),
@@ -136,6 +138,7 @@ impl Default for App {
is_loading: false,
is_routing: false,
should_refresh: false,
should_ignore_quit_key: false,
config: AppConfig::default(),
data: Data::default(),
}
+18 -12
View File
@@ -5,10 +5,11 @@ use chrono::{DateTime, Utc};
use strum::EnumIter;
use crate::app::{App, Route};
use crate::models::{ScrollableText, StatefulMatrix, StatefulTable, TabRoute, TabState};
use crate::models::radarr_models::{
Collection, CollectionMovie, Credit, DiskSpace, DownloadRecord, Movie, MovieHistoryItem,
AddMovieSearchResult, Collection, CollectionMovie, Credit, DiskSpace, DownloadRecord, Movie,
MovieHistoryItem,
};
use crate::models::{ScrollableText, StatefulTable, TabRoute, TabState};
use crate::network::radarr_network::RadarrEvent;
pub struct RadarrData {
@@ -17,6 +18,7 @@ pub struct RadarrData {
pub start_time: DateTime<Utc>,
pub movies: StatefulTable<Movie>,
pub filtered_movies: StatefulTable<Movie>,
pub add_searched_movies: StatefulTable<AddMovieSearchResult>,
pub downloads: StatefulTable<DownloadRecord>,
pub quality_profile_map: HashMap<u64, String>,
pub movie_details: ScrollableText,
@@ -29,7 +31,6 @@ pub struct RadarrData {
pub collections: StatefulTable<Collection>,
pub filtered_collections: StatefulTable<Collection>,
pub collection_movies: StatefulTable<CollectionMovie>,
pub calendar: StatefulMatrix<>
pub main_tabs: TabState,
pub movie_info_tabs: TabState,
pub search: String,
@@ -49,6 +50,7 @@ impl RadarrData {
self.filter = String::default();
self.filtered_movies = StatefulTable::default();
self.filtered_collections = StatefulTable::default();
self.add_searched_movies = StatefulTable::default();
}
pub fn reset_movie_info_tabs(&mut self) {
@@ -74,6 +76,7 @@ impl Default for RadarrData {
version: String::default(),
start_time: DateTime::default(),
movies: StatefulTable::default(),
add_searched_movies: StatefulTable::default(),
filtered_movies: StatefulTable::default(),
downloads: StatefulTable::default(),
quality_profile_map: HashMap::default(),
@@ -95,25 +98,20 @@ impl Default for RadarrData {
TabRoute {
title: "Library".to_owned(),
route: ActiveRadarrBlock::Movies.into(),
help: "<↑↓> scroll | <s> search | <f> filter | <enter> details | <esc> cancel filter | <del> delete | ←→ change tab "
help: "<a> add | <s> search | <f> filter | <enter> details | <esc> cancel filter | <del> delete "
.to_owned(),
},
TabRoute {
title: "Downloads".to_owned(),
route: ActiveRadarrBlock::Downloads.into(),
help: "<↑↓> scroll | ←→ change tab ".to_owned(),
help: String::default(),
},
TabRoute {
title: "Collections".to_owned(),
route: ActiveRadarrBlock::Collections.into(),
help: "<↑↓> scroll | <s> search | <f> filter | <enter> details | <esc> cancel filter | ←→ change tab "
help: "<s> search | <f> filter | <enter> details | <esc> cancel filter "
.to_owned(),
},
TabRoute {
title: "Calendar".to_owned(),
route: ActiveRadarrBlock::Calendar.into(),
help: "<↑↓> scroll | <enter> details | ←→ change tab ".to_owned()
}
]),
movie_info_tabs: TabState::new(vec![
TabRoute {
@@ -148,7 +146,9 @@ impl Default for RadarrData {
#[derive(Clone, PartialEq, Eq, Debug, EnumIter)]
pub enum ActiveRadarrBlock {
AddMovie,
AddMovieSearchInput,
AddMovieSearchResults,
AddMoviePrompt,
Calendar,
Collections,
CollectionDetails,
@@ -209,6 +209,12 @@ impl App {
.await;
}
}
ActiveRadarrBlock::AddMovieSearchResults => {
self.is_loading = true;
self
.dispatch_network_event(RadarrEvent::SearchNewMovie.into())
.await;
}
ActiveRadarrBlock::MovieDetails | ActiveRadarrBlock::FileInfo => {
self.is_loading = true;
self