Targeted-search backoff and release-date gating (#90)
This commit was merged in pull request #90.
This commit is contained in:
@@ -94,10 +94,19 @@ async fn run() -> Result<(), Error> {
|
||||
database.migrate().await?;
|
||||
|
||||
let transmission = arr_dl::TransmissionClient::new(&config.transmission_url)?;
|
||||
let tmdb = if let Some(key) = &config.tmdb_api_key {
|
||||
let mut client = TmdbClient::builder(key.clone());
|
||||
if let Some(url) = &config.tmdb_url {
|
||||
client = client.base_url(url.clone());
|
||||
}
|
||||
Some(Arc::new(client.build()?))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
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() {
|
||||
if let (Some(key), Some(tmdb)) = (config.prowlarr_api_key.clone(), tmdb.clone()) {
|
||||
let prowlarr = arr_indexer::ProwlarrClient::new(config.prowlarr_url.clone(), key)?;
|
||||
reconcile = reconcile.register(
|
||||
Tick::Reconcile,
|
||||
@@ -124,10 +133,11 @@ async fn run() -> Result<(), Error> {
|
||||
})
|
||||
.collect(),
|
||||
),
|
||||
),
|
||||
)
|
||||
.with_tmdb(tmdb),
|
||||
);
|
||||
} else {
|
||||
tracing::warn!("no Prowlarr API key: nothing will be grabbed");
|
||||
tracing::warn!("Prowlarr or TMDB is not configured: nothing will be grabbed");
|
||||
}
|
||||
// Grab before import, so a download that completes on this tick is
|
||||
// imported on this tick.
|
||||
@@ -140,12 +150,8 @@ async fn run() -> Result<(), Error> {
|
||||
// Jellyseerr's Radarr shim (DESIGN.md §9.4) reads the same database and
|
||||
// needs its own TMDB client for `movie/lookup`.
|
||||
let mut compat = CompatState::new(database.clone());
|
||||
if let Some(key) = &config.tmdb_api_key {
|
||||
let mut tmdb = TmdbClient::builder(key.clone());
|
||||
if let Some(tmdb_url) = &config.tmdb_url {
|
||||
tmdb = tmdb.base_url(tmdb_url.clone());
|
||||
}
|
||||
compat = compat.with_tmdb(Arc::new(tmdb.build()?));
|
||||
if let Some(tmdb) = tmdb {
|
||||
compat = compat.with_tmdb(tmdb);
|
||||
}
|
||||
|
||||
let mut upstreams = Upstreams::new(config.prowlarr_url, config.transmission_url)
|
||||
|
||||
Reference in New Issue
Block a user