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
@@ -1,5 +1,6 @@
#[cfg(test)]
mod tests {
use core::sync::atomic::Ordering::SeqCst;
use std::cmp::Ordering;
use std::iter;
@@ -231,7 +232,7 @@ mod tests {
.handle();
assert_eq!(
*app
app
.data
.radarr_data
.collections
@@ -239,7 +240,7 @@ mod tests {
.as_ref()
.unwrap()
.offset
.borrow(),
.load(SeqCst),
4
);
@@ -252,7 +253,7 @@ mod tests {
.handle();
assert_eq!(
*app
app
.data
.radarr_data
.collections
@@ -260,7 +261,7 @@ mod tests {
.as_ref()
.unwrap()
.offset
.borrow(),
.load(SeqCst),
0
);
}
@@ -284,7 +285,7 @@ mod tests {
.handle();
assert_eq!(
*app
app
.data
.radarr_data
.collections
@@ -292,7 +293,7 @@ mod tests {
.as_ref()
.unwrap()
.offset
.borrow(),
.load(SeqCst),
4
);
@@ -305,7 +306,7 @@ mod tests {
.handle();
assert_eq!(
*app
app
.data
.radarr_data
.collections
@@ -313,7 +314,7 @@ mod tests {
.as_ref()
.unwrap()
.offset
.borrow(),
.load(SeqCst),
0
);
}
@@ -458,7 +459,7 @@ mod tests {
.handle();
assert_eq!(
*app
app
.data
.radarr_data
.collections
@@ -466,7 +467,7 @@ mod tests {
.as_ref()
.unwrap()
.offset
.borrow(),
.load(SeqCst),
1
);
@@ -479,7 +480,7 @@ mod tests {
.handle();
assert_eq!(
*app
app
.data
.radarr_data
.collections
@@ -487,7 +488,7 @@ mod tests {
.as_ref()
.unwrap()
.offset
.borrow(),
.load(SeqCst),
0
);
}
@@ -506,7 +507,7 @@ mod tests {
.handle();
assert_eq!(
*app
app
.data
.radarr_data
.collections
@@ -514,7 +515,7 @@ mod tests {
.as_ref()
.unwrap()
.offset
.borrow(),
.load(SeqCst),
1
);
@@ -527,7 +528,7 @@ mod tests {
.handle();
assert_eq!(
*app
app
.data
.radarr_data
.collections
@@ -535,7 +536,7 @@ mod tests {
.as_ref()
.unwrap()
.offset
.borrow(),
.load(SeqCst),
0
);
}
@@ -192,7 +192,8 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for EditCollectionHandle
match self.app.data.radarr_data.selected_block.get_active_block() {
ActiveRadarrBlock::EditCollectionConfirmPrompt => {
if self.app.data.radarr_data.prompt_confirm {
self.app.data.radarr_data.prompt_confirm_action = Some(RadarrEvent::EditCollection);
self.app.data.radarr_data.prompt_confirm_action =
Some(RadarrEvent::EditCollection(None));
self.app.should_refresh = true;
}
@@ -200,6 +200,8 @@ mod tests {
}
mod test_handle_home_end {
use std::sync::atomic::Ordering;
use pretty_assertions::assert_eq;
use strum::IntoEnumIterator;
@@ -337,7 +339,7 @@ mod tests {
.handle();
assert_eq!(
*app
app
.data
.radarr_data
.edit_collection_modal
@@ -345,7 +347,7 @@ mod tests {
.unwrap()
.path
.offset
.borrow(),
.load(Ordering::SeqCst),
4
);
@@ -358,7 +360,7 @@ mod tests {
.handle();
assert_eq!(
*app
app
.data
.radarr_data
.edit_collection_modal
@@ -366,13 +368,15 @@ mod tests {
.unwrap()
.path
.offset
.borrow(),
.load(Ordering::SeqCst),
0
);
}
}
mod test_handle_left_right_action {
use std::sync::atomic::Ordering;
use crate::models::servarr_data::radarr::modals::EditCollectionModal;
use rstest::rstest;
@@ -420,7 +424,7 @@ mod tests {
.handle();
assert_eq!(
*app
app
.data
.radarr_data
.edit_collection_modal
@@ -428,7 +432,7 @@ mod tests {
.unwrap()
.path
.offset
.borrow(),
.load(Ordering::SeqCst),
1
);
@@ -441,7 +445,7 @@ mod tests {
.handle();
assert_eq!(
*app
app
.data
.radarr_data
.edit_collection_modal
@@ -449,7 +453,7 @@ mod tests {
.unwrap()
.path
.offset
.borrow(),
.load(Ordering::SeqCst),
0
);
}
@@ -561,7 +565,7 @@ mod tests {
);
assert_eq!(
app.data.radarr_data.prompt_confirm_action,
Some(RadarrEvent::EditCollection)
Some(RadarrEvent::EditCollection(None))
);
assert!(app.should_refresh);
}