Fully functional manual searching capabilities and refresh capabilities for all movies, downloads, and collections
This commit is contained in:
@@ -240,7 +240,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 = "Add Movie";
|
||||
let prompt = format!(
|
||||
"{}:\n\n{}",
|
||||
app
|
||||
|
||||
+67
-3
@@ -62,7 +62,8 @@ pub(super) fn draw_radarr_ui<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, ar
|
||||
| ActiveRadarrBlock::Crew
|
||||
| ActiveRadarrBlock::AutomaticallySearchMoviePrompt
|
||||
| ActiveRadarrBlock::RefreshAndScanPrompt
|
||||
| ActiveRadarrBlock::ManualSearch => {
|
||||
| ActiveRadarrBlock::ManualSearch
|
||||
| ActiveRadarrBlock::ManualSearchConfirmPrompt => {
|
||||
draw_large_popup_over(f, app, content_rect, draw_library, draw_movie_info_popup)
|
||||
}
|
||||
ActiveRadarrBlock::AddMovieSearchInput
|
||||
@@ -96,6 +97,27 @@ pub(super) fn draw_radarr_ui<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, ar
|
||||
draw_downloads,
|
||||
draw_delete_download_prompt,
|
||||
),
|
||||
ActiveRadarrBlock::RefreshDownloadsPrompt => draw_prompt_popup_over(
|
||||
f,
|
||||
app,
|
||||
content_rect,
|
||||
draw_downloads,
|
||||
draw_refresh_downloads_prompt,
|
||||
),
|
||||
ActiveRadarrBlock::RefreshAllMoviesPrompt => draw_prompt_popup_over(
|
||||
f,
|
||||
app,
|
||||
content_rect,
|
||||
draw_library,
|
||||
draw_refresh_all_movies_prompt,
|
||||
),
|
||||
ActiveRadarrBlock::RefreshAllCollectionsPrompt => draw_prompt_popup_over(
|
||||
f,
|
||||
app,
|
||||
content_rect,
|
||||
draw_collections,
|
||||
draw_refresh_all_collections_prompt,
|
||||
),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
@@ -174,11 +196,53 @@ fn draw_library<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_refresh_all_movies_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
draw_prompt_box(
|
||||
f,
|
||||
prompt_area,
|
||||
"Refresh All Movies",
|
||||
"Do you want to refresh info and scan your disks for all of your movies?",
|
||||
&app.data.radarr_data.prompt_confirm,
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_refresh_downloads_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
draw_prompt_box(
|
||||
f,
|
||||
prompt_area,
|
||||
"Refresh Downloads",
|
||||
"Do you want to refresh your downloads?",
|
||||
&app.data.radarr_data.prompt_confirm,
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_refresh_all_collections_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
draw_prompt_box(
|
||||
f,
|
||||
prompt_area,
|
||||
"Refresh All Collections",
|
||||
"Do you want to refresh all of your collections?",
|
||||
&app.data.radarr_data.prompt_confirm,
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_delete_movie_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, prompt_area: Rect) {
|
||||
draw_prompt_box(
|
||||
f,
|
||||
prompt_area,
|
||||
"Confirm Delete Movie?",
|
||||
"Delete Movie",
|
||||
format!(
|
||||
"Do you really want to delete: {}?",
|
||||
app.data.radarr_data.movies.current_selection().title
|
||||
@@ -192,7 +256,7 @@ fn draw_delete_download_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App,
|
||||
draw_prompt_box(
|
||||
f,
|
||||
prompt_area,
|
||||
"Confirm Cancel Download?",
|
||||
"Cancel Download",
|
||||
format!(
|
||||
"Do you really want to delete this download: {}?",
|
||||
app.data.radarr_data.downloads.current_selection().title
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use std::iter;
|
||||
|
||||
use tui::backend::Backend;
|
||||
use tui::layout::{Constraint, Rect};
|
||||
use tui::style::Style;
|
||||
use tui::text::{Spans, Text};
|
||||
use tui::layout::{Alignment, Constraint, Rect};
|
||||
use tui::style::{Modifier, Style};
|
||||
use tui::text::{Span, Spans, Text};
|
||||
use tui::widgets::{Cell, Paragraph, Row, Wrap};
|
||||
use tui::Frame;
|
||||
|
||||
@@ -13,11 +13,12 @@ use crate::models::radarr_models::{Credit, MovieHistoryItem, Release};
|
||||
use crate::models::Route;
|
||||
use crate::ui::utils::{
|
||||
borderless_block, get_width, layout_block_bottom_border, layout_block_top_border,
|
||||
spans_info_default, style_bold, style_default, style_failure, style_primary, style_success,
|
||||
style_warning, vertical_chunks,
|
||||
spans_info_default, spans_info_primary, style_bold, style_default, style_failure, style_primary,
|
||||
style_success, style_warning, vertical_chunks,
|
||||
};
|
||||
use crate::ui::{
|
||||
draw_prompt_box, draw_prompt_popup_over, draw_table, draw_tabs, loading, TableProps,
|
||||
draw_medium_popup_over, draw_prompt_box, draw_prompt_box_with_content, draw_prompt_popup_over,
|
||||
draw_small_popup_over, draw_table, draw_tabs, loading, TableProps,
|
||||
};
|
||||
use crate::utils::convert_to_gb;
|
||||
|
||||
@@ -40,6 +41,13 @@ pub(super) fn draw_movie_info_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut
|
||||
draw_movie_info,
|
||||
draw_refresh_and_scan_prompt,
|
||||
),
|
||||
ActiveRadarrBlock::ManualSearchConfirmPrompt => draw_small_popup_over(
|
||||
f,
|
||||
app,
|
||||
content_area,
|
||||
draw_movie_info,
|
||||
draw_manual_search_confirm_prompt,
|
||||
),
|
||||
_ => draw_movie_info(f, app, content_area),
|
||||
}
|
||||
}
|
||||
@@ -65,7 +73,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?",
|
||||
"Automatic Movie Search",
|
||||
format!(
|
||||
"Do you want to trigger an automatic search of your indexers for the movie: {}?",
|
||||
app.data.radarr_data.movies.current_selection().title
|
||||
@@ -83,10 +91,10 @@ fn draw_refresh_and_scan_prompt<B: Backend>(
|
||||
draw_prompt_box(
|
||||
f,
|
||||
prompt_area,
|
||||
"Confirm Refresh and Scan?",
|
||||
"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
|
||||
app.data.radarr_data.movies.current_selection_clone().title
|
||||
)
|
||||
.as_str(),
|
||||
&app.data.radarr_data.prompt_confirm,
|
||||
@@ -340,6 +348,7 @@ fn draw_movie_releases<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_
|
||||
.movie_releases
|
||||
.current_selection_clone()
|
||||
};
|
||||
let current_route = app.get_current_route().clone();
|
||||
|
||||
draw_table(
|
||||
f,
|
||||
@@ -382,7 +391,11 @@ fn draw_movie_releases<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_
|
||||
..
|
||||
} = release;
|
||||
let age = format!("{} days", age.as_u64().unwrap_or(0));
|
||||
title.scroll_or_reset(get_width(content_area), current_selection == *release);
|
||||
title.scroll_or_reset(
|
||||
get_width(content_area),
|
||||
current_selection == *release
|
||||
&& current_route != ActiveRadarrBlock::ManualSearchConfirmPrompt.into(),
|
||||
);
|
||||
let size = convert_to_gb(size.as_u64().unwrap());
|
||||
let rejected_str = if *rejected { "⛔" } else { "" };
|
||||
let seeders = seeders.as_u64().unwrap();
|
||||
@@ -414,6 +427,67 @@ fn draw_movie_releases<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_
|
||||
)
|
||||
}
|
||||
|
||||
fn draw_manual_search_confirm_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
let current_selection = app.data.radarr_data.movie_releases.current_selection();
|
||||
let title = if current_selection.rejected {
|
||||
"Download Rejected Release"
|
||||
} else {
|
||||
"Download Release"
|
||||
};
|
||||
let prompt = if current_selection.rejected {
|
||||
format!(
|
||||
"Do you really want to download the rejected release: {}?",
|
||||
current_selection.title.stationary_style()
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
"Do you want to download the release: {}?",
|
||||
current_selection.title.stationary_style()
|
||||
)
|
||||
};
|
||||
|
||||
if current_selection.rejected {
|
||||
let mut spans_vec = vec![Spans::from(vec![Span::styled(
|
||||
"Rejection reasons: ",
|
||||
style_primary().add_modifier(Modifier::BOLD),
|
||||
)])];
|
||||
let mut rejections_spans = current_selection
|
||||
.rejections
|
||||
.clone()
|
||||
.unwrap_or_default()
|
||||
.iter()
|
||||
.map(|item| Spans::from(vec![Span::styled(format!("• {}", item), style_primary())]))
|
||||
.collect::<Vec<Spans>>();
|
||||
spans_vec.append(&mut rejections_spans);
|
||||
|
||||
let content_paragraph = Paragraph::new(spans_vec)
|
||||
.block(borderless_block())
|
||||
.wrap(Wrap { trim: false })
|
||||
.alignment(Alignment::Left);
|
||||
|
||||
draw_prompt_box_with_content(
|
||||
f,
|
||||
prompt_area,
|
||||
title,
|
||||
&prompt,
|
||||
Some(content_paragraph),
|
||||
&app.data.radarr_data.prompt_confirm,
|
||||
);
|
||||
} else {
|
||||
draw_prompt_box(
|
||||
f,
|
||||
prompt_area,
|
||||
title,
|
||||
&prompt,
|
||||
&app.data.radarr_data.prompt_confirm,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn determine_style_from_download_status(download_status: &str) -> Style {
|
||||
match download_status {
|
||||
"Downloaded" => style_success(),
|
||||
|
||||
Reference in New Issue
Block a user