feat(arr): add an env-only Podnapisi URL seam
ARR_PODNAPISI_URL, same shape as the existing tmdb_url seam: a test harness can point the provider at a wiremock fake without touching DESIGN.md §10's config surface.
This commit is contained in:
@@ -133,6 +133,7 @@ fn api_state(
|
||||
config.opensubtitles_api_key.clone(),
|
||||
config.opensubtitles_username.clone(),
|
||||
config.opensubtitles_password.clone(),
|
||||
config.podnapisi_url.clone(),
|
||||
))
|
||||
.with_translation_backends(translators.backends.clone())
|
||||
.with_jellyfin(jellyfin)
|
||||
@@ -541,6 +542,7 @@ fn subtitle_action(
|
||||
config.opensubtitles_api_key.clone(),
|
||||
config.opensubtitles_username.clone(),
|
||||
config.opensubtitles_password.clone(),
|
||||
config.podnapisi_url.clone(),
|
||||
),
|
||||
translators.backends.clone(),
|
||||
arr_subs::Syncer::new().with_binary(config.alass_path.clone()),
|
||||
@@ -564,10 +566,17 @@ fn subtitle_providers(
|
||||
opensubtitles_api_key: Option<String>,
|
||||
username: Option<String>,
|
||||
password: Option<String>,
|
||||
podnapisi_url: Option<String>,
|
||||
) -> Vec<std::sync::Arc<dyn arr_subs::Provider>> {
|
||||
let mut providers: Vec<std::sync::Arc<dyn arr_subs::Provider>> = Vec::new();
|
||||
|
||||
match arr_subs::Podnapisi::new() {
|
||||
// `podnapisi_url` is the e2e-only seam (`ARR_PODNAPISI_URL`); absent, this
|
||||
// is the real Podnapisi.net.
|
||||
let mut builder = arr_subs::Podnapisi::builder();
|
||||
if let Some(url) = podnapisi_url {
|
||||
builder = builder.base_url(url);
|
||||
}
|
||||
match builder.build() {
|
||||
Ok(podnapisi) => providers.push(std::sync::Arc::new(podnapisi)),
|
||||
Err(error) => tracing::warn!(%error, "Podnapisi not available"),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user