Working manual search with UTF-8 support and scrolling. Still need release details and finally, manually selecting release to download.

This commit is contained in:
2023-08-08 10:50:05 -06:00
parent 1ad1b16668
commit 8120debe81
8 changed files with 41 additions and 42 deletions
+2 -2
View File
@@ -64,7 +64,7 @@ fn draw_add_movie_search<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area:
let search_paragraph = Paragraph::new(Text::from(block_content))
.style(style_default())
.block(title_block_centered(" Add Movie "));
.block(title_block_centered("Add Movie"));
if let Route::Radarr(active_radarr_block) = app.get_current_route().clone() {
match active_radarr_block {
@@ -239,7 +239,7 @@ fn draw_select_quality_profile_popup<B: Backend>(
}
fn draw_confirmation_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, prompt_area: Rect) {
let title = " Confirm Add Movie? ";
let title = "Confirm Add Movie?";
let prompt = format!(
"{}:\n\n{}",
app
+3 -3
View File
@@ -34,7 +34,7 @@ mod collection_details_ui;
mod movie_details_ui;
pub(super) fn draw_radarr_ui<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
let (content_rect, _) = draw_tabs(f, area, " Movies ", &app.data.radarr_data.main_tabs);
let (content_rect, _) = draw_tabs(f, area, "Movies", &app.data.radarr_data.main_tabs);
if let Route::Radarr(active_radarr_block) = app.get_current_route().clone() {
match active_radarr_block {
@@ -173,7 +173,7 @@ fn draw_delete_movie_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, pro
draw_prompt_box(
f,
prompt_area,
" Confirm Delete Movie? ",
"Confirm Delete Movie?",
format!(
"Do you really want to delete: {}?",
app.data.radarr_data.movies.current_selection().title
@@ -187,7 +187,7 @@ fn draw_delete_download_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App,
draw_prompt_box(
f,
prompt_area,
" Confirm Cancel Download? ",
"Confirm Cancel Download?",
format!(
"Do you really want to delete this download: {}?",
app.data.radarr_data.downloads.current_selection().title
+17 -23
View File
@@ -55,6 +55,7 @@ fn draw_movie_info<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect)
ActiveRadarrBlock::MovieHistory => draw_movie_history(f, app, area),
ActiveRadarrBlock::Cast => draw_movie_cast(f, app, area),
ActiveRadarrBlock::Crew => draw_movie_crew(f, app, area),
ActiveRadarrBlock::ManualSearch => draw_movie_releases(f, app, area),
_ => (),
}
}
@@ -64,7 +65,7 @@ fn draw_search_movie_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, pro
draw_prompt_box(
f,
prompt_area,
" Confirm Search Movie? ",
"Confirm Search Movie?",
format!(
"Do you want to trigger an automatic search of your indexers for the movie: {}?",
app.data.radarr_data.movies.current_selection().title
@@ -82,7 +83,7 @@ fn draw_refresh_and_scan_prompt<B: Backend>(
draw_prompt_box(
f,
prompt_area,
" Confirm Refresh and Scan? ",
"Confirm Refresh and Scan?",
format!(
"Do you want to trigger a refresh and disk scan for the movie: {}?",
app.data.radarr_data.movies.current_selection().title
@@ -334,12 +335,12 @@ fn draw_movie_releases<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_
constraints: vec![
Constraint::Length(8),
Constraint::Length(10),
Constraint::Length(1),
Constraint::Percentage(40),
Constraint::Percentage(10),
Constraint::Length(8),
Constraint::Length(8),
Constraint::Percentage(10),
Constraint::Length(4),
Constraint::Percentage(30),
Constraint::Percentage(18),
Constraint::Length(12),
Constraint::Length(12),
Constraint::Percentage(7),
Constraint::Percentage(10),
],
table_headers: vec![
@@ -360,14 +361,15 @@ fn draw_movie_releases<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_
quality,
..
} = release;
let age = format!("{} days", age.as_u64().unwrap());
let age = format!("{} days", age.as_u64().unwrap_or(0));
title.scroll_or_reset(get_width(content_area), current_selection == *release);
indexer.scroll_or_reset(get_width(content_area), current_selection == *release);
let size = convert_to_gb(size.as_u64().unwrap());
let rejected_str = if *rejected { "" } else { "" };
let seeders = seeders.as_u64().unwrap();
let leechers = leechers.as_u64().unwrap();
let peers = format!("{} / {}", seeders, leechers);
let mut peers = Text::from(format!("{} / {}", seeders, leechers));
peers.patch_style(determine_peer_style(seeders, leechers));
let language = if languages.is_some() {
languages.clone().unwrap()[0].name.clone()
} else {
@@ -378,11 +380,11 @@ fn draw_movie_releases<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_
Row::new(vec![
Cell::from(protocol.clone()),
Cell::from(age),
Cell::from(rejected_str).style(determine_style_from_rejection(*rejected)),
Cell::from(rejected_str),
Cell::from(title.to_string()),
Cell::from(indexer.to_string()),
Cell::from(format!("{} GB", size)),
Cell::from(peers).style(determine_peer_style(seeders, leechers)),
Cell::from(indexer.clone()),
Cell::from(format!("{:.1} GB", size)),
Cell::from(peers),
Cell::from(language),
Cell::from(quality),
])
@@ -401,14 +403,6 @@ fn determine_style_from_download_status(download_status: &str) -> Style {
}
}
fn determine_style_from_rejection(rejected: bool) -> Style {
if rejected {
style_failure()
} else {
style_primary()
}
}
fn determine_peer_style(seeders: u64, leechers: u64) -> Style {
if seeders == 0 {
style_failure()