From f0b3d8ad903941e7669bab30751564e16397435b Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Mon, 4 May 2026 11:24:18 +0200 Subject: [PATCH] feat(log_review): add manual title resolution for movie lookup --- .../application/src/use_cases/log_review.rs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/crates/application/src/use_cases/log_review.rs b/crates/application/src/use_cases/log_review.rs index 670d764..29c1ebd 100644 --- a/crates/application/src/use_cases/log_review.rs +++ b/crates/application/src/use_cases/log_review.rs @@ -35,6 +35,12 @@ async fn resolve_movie( } } + if let Some(title) = &cmd.manual_title { + if let Some(resolved) = resolve_by_title(ctx, title, cmd.manual_release_year).await? { + return Ok(resolved); + } + } + resolve_manual_movie(ctx, cmd).await } @@ -64,6 +70,21 @@ async fn resolve_external_movie( } } +async fn resolve_by_title( + ctx: &AppContext, + title: &str, + year: Option, +) -> Result, DomainError> { + let criteria = MetadataSearchCriteria::Title { title: title.to_string(), year }; + match ctx.metadata_client.fetch_movie_metadata(&criteria).await { + Ok(m) => Ok(Some((m, true))), + Err(e) => { + tracing::warn!("OMDb title search failed, falling back to manual: {:?}", e); + Ok(None) + } + } +} + async fn resolve_manual_movie( ctx: &AppContext, cmd: &LogReviewCommand,