Import pipeline: probe, hardlink, rename, layout (#82)
This commit was merged in pull request #82.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
mod config;
|
||||
mod grab;
|
||||
mod import;
|
||||
pub mod reconcile;
|
||||
mod web;
|
||||
|
||||
@@ -14,6 +15,7 @@ use arr_db::Db;
|
||||
use arr_meta::TmdbClient;
|
||||
use config::Config;
|
||||
use grab::{GrabAction, SeedingLimits};
|
||||
use import::ImportAction;
|
||||
use reconcile::{ReconcileLoop, Tick};
|
||||
use tower_http::trace::TraceLayer;
|
||||
|
||||
@@ -89,17 +91,17 @@ async fn run() -> Result<(), Error> {
|
||||
let database = Db::connect(&config.database_path).await?;
|
||||
database.migrate().await?;
|
||||
|
||||
let transmission = arr_dl::TransmissionClient::new(&config.transmission_url)?;
|
||||
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,
|
||||
transmission.clone(),
|
||||
config.download_dir.clone(),
|
||||
SeedingLimits {
|
||||
ratio: config.seed_ratio_limit,
|
||||
@@ -110,6 +112,12 @@ async fn run() -> Result<(), Error> {
|
||||
} else {
|
||||
tracing::warn!("no Prowlarr API key: nothing will be grabbed");
|
||||
}
|
||||
// Grab before import, so a download that completes on this tick is
|
||||
// imported on this tick.
|
||||
reconcile = reconcile.register(
|
||||
Tick::Reconcile,
|
||||
ImportAction::new(transmission, arr_probe::Prober::new()),
|
||||
);
|
||||
|
||||
// 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