feat(daemon): grab pipeline for wanted movies (#77)
This commit was merged in pull request #77.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
//! arr — reconcile loop and process entry point. See DESIGN.md §8.
|
||||
|
||||
mod config;
|
||||
mod grab;
|
||||
pub mod reconcile;
|
||||
mod web;
|
||||
|
||||
@@ -12,7 +13,8 @@ use arr_compat::CompatState;
|
||||
use arr_db::Db;
|
||||
use arr_meta::TmdbClient;
|
||||
use config::Config;
|
||||
use reconcile::ReconcileLoop;
|
||||
use grab::{GrabAction, SeedingLimits};
|
||||
use reconcile::{ReconcileLoop, Tick};
|
||||
use tower_http::trace::TraceLayer;
|
||||
|
||||
/// Dump the `OpenAPI` document and exit, instead of serving. `just gen-client`
|
||||
@@ -67,6 +69,10 @@ enum Error {
|
||||
Migration(#[from] sqlx::migrate::MigrateError),
|
||||
#[error("tmdb client: {0}")]
|
||||
Tmdb(#[from] arr_meta::Error),
|
||||
#[error("prowlarr client: {0}")]
|
||||
Prowlarr(#[from] arr_indexer::Error),
|
||||
#[error("transmission client: {0}")]
|
||||
Transmission(#[from] arr_dl::Error),
|
||||
#[error("bind {addr}: {source}")]
|
||||
Bind {
|
||||
addr: std::net::SocketAddr,
|
||||
@@ -82,7 +88,28 @@ async fn run() -> Result<(), Error> {
|
||||
let config = Config::load()?;
|
||||
let database = Db::connect(&config.database_path).await?;
|
||||
database.migrate().await?;
|
||||
let reconcile = ReconcileLoop::new(database.clone());
|
||||
|
||||
let mut reconcile = ReconcileLoop::new(database.clone());
|
||||
// Without a Prowlarr key nothing can be searched, so the grab lane stays
|
||||
// unregistered rather than failing a tick every 30 seconds.
|
||||
if let Some(key) = config.prowlarr_api_key.clone() {
|
||||
let prowlarr = arr_indexer::ProwlarrClient::new(config.prowlarr_url.clone(), key)?;
|
||||
let transmission = arr_dl::TransmissionClient::new(&config.transmission_url)?;
|
||||
reconcile = reconcile.register(
|
||||
Tick::Reconcile,
|
||||
GrabAction::new(
|
||||
prowlarr,
|
||||
transmission,
|
||||
config.download_dir.clone(),
|
||||
SeedingLimits {
|
||||
ratio: config.seed_ratio_limit,
|
||||
idle_minutes: config.seed_idle_limit_minutes,
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
tracing::warn!("no Prowlarr API key: nothing will be grabbed");
|
||||
}
|
||||
|
||||
// Jellyseerr's Radarr shim (DESIGN.md §9.4) reads the same database and
|
||||
// needs its own TMDB client for `movie/lookup`.
|
||||
|
||||
Reference in New Issue
Block a user