Added the full Radarr CLI so users can programmatically access all the same management features as in the TUI

This commit is contained in:
2024-10-29 18:47:40 -06:00
parent 217d3242a8
commit 1f8d72c939
65 changed files with 9401 additions and 1370 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
use std::sync::atomic::Ordering;
use ratatui::layout::{Alignment, Constraint, Flex, Layout, Rect};
use ratatui::style::{Style, Stylize};
use ratatui::text::{Line, Text};
@@ -187,7 +189,7 @@ pub fn draw_input_box_popup(
.areas(area);
let input_box = InputBox::new(&box_content.text)
.offset(*box_content.offset.borrow())
.offset(box_content.offset.load(Ordering::SeqCst))
.block(title_block_centered(box_title));
input_box.show_cursor(f, text_box_area);
@@ -1,3 +1,5 @@
use std::sync::atomic::Ordering;
use ratatui::layout::{Constraint, Layout, Rect};
use ratatui::widgets::ListItem;
use ratatui::Frame;
@@ -142,7 +144,7 @@ fn draw_edit_collection_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>
if let Route::Radarr(active_radarr_block, _) = *app.get_current_route() {
let root_folder_input_box = InputBox::new(&path.text)
.offset(*path.offset.borrow())
.offset(path.offset.load(Ordering::SeqCst))
.label("Root Folder")
.highlighted(selected_block == &ActiveRadarrBlock::EditCollectionRootFolderPathInput)
.selected(active_radarr_block == ActiveRadarrBlock::EditCollectionRootFolderPathInput);
+8 -6
View File
@@ -1,3 +1,5 @@
use std::sync::atomic::Ordering;
use crate::app::App;
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, EDIT_INDEXER_BLOCKS};
use crate::models::Route;
@@ -79,22 +81,22 @@ fn draw_edit_indexer_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
if let Route::Radarr(active_radarr_block, _) = *app.get_current_route() {
let name_input_box = InputBox::new(&edit_indexer_modal.name.text)
.offset(*edit_indexer_modal.name.offset.borrow())
.offset(edit_indexer_modal.name.offset.load(Ordering::SeqCst))
.label("Name")
.highlighted(selected_block == &ActiveRadarrBlock::EditIndexerNameInput)
.selected(active_radarr_block == ActiveRadarrBlock::EditIndexerNameInput);
let url_input_box = InputBox::new(&edit_indexer_modal.url.text)
.offset(*edit_indexer_modal.url.offset.borrow())
.offset(edit_indexer_modal.url.offset.load(Ordering::SeqCst))
.label("URL")
.highlighted(selected_block == &ActiveRadarrBlock::EditIndexerUrlInput)
.selected(active_radarr_block == ActiveRadarrBlock::EditIndexerUrlInput);
let api_key_input_box = InputBox::new(&edit_indexer_modal.api_key.text)
.offset(*edit_indexer_modal.api_key.offset.borrow())
.offset(edit_indexer_modal.api_key.offset.load(Ordering::SeqCst))
.label("API Key")
.highlighted(selected_block == &ActiveRadarrBlock::EditIndexerApiKeyInput)
.selected(active_radarr_block == ActiveRadarrBlock::EditIndexerApiKeyInput);
let tags_input_box = InputBox::new(&edit_indexer_modal.tags.text)
.offset(*edit_indexer_modal.tags.offset.borrow())
.offset(edit_indexer_modal.tags.offset.load(Ordering::SeqCst))
.label("Tags")
.highlighted(selected_block == &ActiveRadarrBlock::EditIndexerTagsInput)
.selected(active_radarr_block == ActiveRadarrBlock::EditIndexerTagsInput);
@@ -105,12 +107,12 @@ fn draw_edit_indexer_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
if protocol == "torrent" {
let seed_ratio_input_box = InputBox::new(&edit_indexer_modal.seed_ratio.text)
.offset(*edit_indexer_modal.seed_ratio.offset.borrow())
.offset(edit_indexer_modal.seed_ratio.offset.load(Ordering::SeqCst))
.label("Seed Ratio")
.highlighted(selected_block == &ActiveRadarrBlock::EditIndexerSeedRatioInput)
.selected(active_radarr_block == ActiveRadarrBlock::EditIndexerSeedRatioInput);
let tags_input_box = InputBox::new(&edit_indexer_modal.tags.text)
.offset(*edit_indexer_modal.tags.offset.borrow())
.offset(edit_indexer_modal.tags.offset.load(Ordering::SeqCst))
.label("Tags")
.highlighted(selected_block == &ActiveRadarrBlock::EditIndexerTagsInput)
.selected(active_radarr_block == ActiveRadarrBlock::EditIndexerTagsInput);
@@ -1,3 +1,5 @@
use std::sync::atomic::Ordering;
use ratatui::layout::{Constraint, Flex, Layout, Rect};
use ratatui::Frame;
@@ -114,7 +116,12 @@ fn draw_edit_indexer_settings_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area:
.selected(active_radarr_block == ActiveRadarrBlock::IndexerSettingsRssSyncIntervalInput);
let whitelisted_subs_input_box =
InputBox::new(&indexer_settings.whitelisted_hardcoded_subs.text)
.offset(*indexer_settings.whitelisted_hardcoded_subs.offset.borrow())
.offset(
indexer_settings
.whitelisted_hardcoded_subs
.offset
.load(Ordering::SeqCst),
)
.label("Whitelisted Subtitle Tags")
.highlighted(
selected_block == &ActiveRadarrBlock::IndexerSettingsWhitelistedSubtitleTagsInput,
+5 -3
View File
@@ -1,3 +1,5 @@
use std::sync::atomic::Ordering;
use ratatui::layout::{Alignment, Constraint, Layout, Rect};
use ratatui::text::Text;
use ratatui::widgets::{Cell, ListItem, Paragraph, Row};
@@ -131,14 +133,14 @@ fn draw_add_movie_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
.margin(1)
.areas(area);
let block_content = &app.data.radarr_data.add_movie_search.as_ref().unwrap().text;
let offset = *app
let offset = app
.data
.radarr_data
.add_movie_search
.as_ref()
.unwrap()
.offset
.borrow();
.load(Ordering::SeqCst);
let search_results_row_mapping = |movie: &AddMovieSearchResult| {
let (hours, minutes) = convert_runtime(movie.runtime);
let imdb_rating = movie
@@ -416,7 +418,7 @@ fn draw_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
if let Route::Radarr(active_radarr_block, _) = *app.get_current_route() {
let tags_input_box = InputBox::new(&tags.text)
.offset(*tags.offset.borrow())
.offset(tags.offset.load(Ordering::SeqCst))
.label("Tags")
.highlighted(selected_block == &ActiveRadarrBlock::AddMovieTagsInput)
.selected(active_radarr_block == ActiveRadarrBlock::AddMovieTagsInput);
+4 -2
View File
@@ -1,3 +1,5 @@
use std::sync::atomic::Ordering;
use ratatui::layout::{Constraint, Rect};
use ratatui::prelude::Layout;
use ratatui::widgets::ListItem;
@@ -145,12 +147,12 @@ fn draw_edit_movie_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, are
if let Route::Radarr(active_radarr_block, _) = *app.get_current_route() {
let path_input_box = InputBox::new(&path.text)
.offset(*path.offset.borrow())
.offset(path.offset.load(Ordering::SeqCst))
.label("Path")
.highlighted(selected_block == &ActiveRadarrBlock::EditMoviePathInput)
.selected(active_radarr_block == ActiveRadarrBlock::EditMoviePathInput);
let tags_input_box = InputBox::new(&tags.text)
.offset(*tags.offset.borrow())
.offset(tags.offset.load(Ordering::SeqCst))
.label("Tags")
.highlighted(selected_block == &ActiveRadarrBlock::EditMovieTagsInput)
.selected(active_radarr_block == ActiveRadarrBlock::EditMovieTagsInput);