feat: scaffold Readarr support across the state, app, handler, UI, and CLI layers
Promote Route::Readarr from a unit stub to a tuple variant and wire Readarr through every layer, mirroring the Lidarr tree. Readarr appears as a fourth servarr tab and its library view renders the Authors table. Adds ReadarrData and its modals, the tick and context clue modules, the top-level ReadarrHandler, ReadarrUi with the Authors library view, and an empty ReadarrCommand behind ReadarrCliHandler. The default port is 8787. Promoting the route variant compiles cleanly without any of the arms that give it behaviour, so all six of those sites are wired explicitly here: App::on_tick, handlers::handle_events, handle_prompt_toggle, ServarrContextClueProvider, ui(), and verify_config_present_for_cli. Each was checked by removing the arm and confirming its covering assertion then fails. ReadarrEvent and ReadarrCommand are both declared empty. They gain variants alongside the network calls and CLI commands that use them, which keeps each later change to a single function. Adding the tab changes the rendered tab bar, so 13 existing snapshots regenerate. The only delta in each is that single tab bar line. This scaffold adds 24 dead_code warnings, all inside the Readarr tree and none outside it. They clear as the handlers, UI, network events, and CLI commands that consume these items land: block arrays awaiting their accepts implementations and BlockSelectionState seeding, modal and state fields awaiting their handlers, the CLI handler fields awaiting an inhabited command enum, and the top-level handler fields awaiting sub-handlers. The count must strictly decrease from here, so a later increase is a defect rather than transient noise. The 12 pre-existing collapsible_match warnings are unrelated and untouched.
This commit is contained in:
64 files changed
+6418
-22
No files matched your search
@@ -19,12 +19,14 @@ use tokio_util::sync::CancellationToken;
|
||||
use crate::app::{App, ServarrConfig};
|
||||
use crate::models::Serdeable;
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use crate::network::readarr_network::ReadarrEvent;
|
||||
#[cfg(test)]
|
||||
use mockall::automock;
|
||||
use reqwest::header::HeaderMap;
|
||||
|
||||
pub mod lidarr_network;
|
||||
pub mod radarr_network;
|
||||
pub mod readarr_network;
|
||||
pub mod sonarr_network;
|
||||
mod utils;
|
||||
|
||||
@@ -50,6 +52,7 @@ pub enum NetworkEvent {
|
||||
Radarr(RadarrEvent),
|
||||
Sonarr(SonarrEvent),
|
||||
Lidarr(LidarrEvent),
|
||||
Readarr(ReadarrEvent),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -75,6 +78,10 @@ impl NetworkTrait for Network<'_, '_> {
|
||||
.handle_lidarr_event(lidarr_event)
|
||||
.await
|
||||
.map(Serdeable::from),
|
||||
NetworkEvent::Readarr(readarr_event) => self
|
||||
.handle_readarr_event(readarr_event)
|
||||
.await
|
||||
.map(Serdeable::from),
|
||||
};
|
||||
|
||||
let mut app = self.app.lock().await;
|
||||
@@ -242,6 +249,7 @@ impl<'a, 'b> Network<'a, 'b> {
|
||||
NetworkEvent::Radarr(_) => (7878, "v3"),
|
||||
NetworkEvent::Sonarr(_) => (8989, "v3"),
|
||||
NetworkEvent::Lidarr(_) => (8686, "v1"),
|
||||
NetworkEvent::Readarr(_) => (8787, "v1"),
|
||||
};
|
||||
let mut uri = if let Some(servarr_uri) = uri {
|
||||
format!("{servarr_uri}/api/{api_version}{resource}")
|
||||
|
||||
@@ -944,6 +944,7 @@ pub(in crate::network) mod test_utils {
|
||||
let network_event_clone: NetworkEvent = network_event.clone().into();
|
||||
let api_version = match &network_event_clone {
|
||||
NetworkEvent::Lidarr(_) => "v1",
|
||||
NetworkEvent::Readarr(_) => "v1",
|
||||
_ => "v3",
|
||||
};
|
||||
let mut server = Server::new_async().await;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
use anyhow::Result;
|
||||
|
||||
use super::{NetworkEvent, NetworkResource};
|
||||
use crate::models::readarr_models::ReadarrSerdeable;
|
||||
use crate::network::Network;
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||
pub enum ReadarrEvent {}
|
||||
|
||||
impl NetworkResource for ReadarrEvent {
|
||||
fn resource(&self) -> &'static str {
|
||||
match *self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ReadarrEvent> for NetworkEvent {
|
||||
fn from(readarr_event: ReadarrEvent) -> Self {
|
||||
NetworkEvent::Readarr(readarr_event)
|
||||
}
|
||||
}
|
||||
|
||||
impl Network<'_, '_> {
|
||||
pub async fn handle_readarr_event(
|
||||
&mut self,
|
||||
readarr_event: ReadarrEvent,
|
||||
) -> Result<ReadarrSerdeable> {
|
||||
match readarr_event {}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user