Search metadata directly from IDs embedded in file names

ParseFilename's movie-IMDB pattern now recognizes parenthesized years and
brace-wrapped service IDs, so names like "Movie (2024) {tmdb-1015812}" no
longer truncate to "Movie (2024) {tmdb". The ID kind is captured (imdb,
tmdb, tvdb, tt; IDs widened to 7-9 digits for modern IMDb IDs) and
emitted as an "id:<kind>:<value>" line.

Parsed IDs ride along in MetadataSearchTerms.movie as a MetadataFileID.
TheMovieDB answers direct lookups (movie/{id} for TMDb IDs, find +
external_source=imdb_id for IMDb IDs) as a movieIDSearch; the search
sheet, the queue metadata action, and the AppleScript fetch-metadata
command try the direct lookup first and fall back to the title search
when the ID is unknown or the provider doesn't support it. Index-based
AppleScript result commands keep the name search by design.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Scott GarrettandClaude Code committed 2026-11-28 13:10:25 -05:00
1 parent 401584a376
commit f20ad7ee45
10 files changed
+203 -60

No files matched your search

@@ -52,6 +52,20 @@ public struct TheMovieDB: MetadataService {
return results.map { metadata(forMoviePartialResult: $0, language: nil) }
}
public func search(movieID id: MetadataFileID, language: String) -> [MetadataResult] {
let result: TMDBMovie?
switch id {
case .tmdb(let movieID):
result = session.fetch(movieID: movieID, language: language)
case .imdb(let imdbID):
result = session.findMovie(id: imdbID, externalSource: "imdb_id", language: language)
case .tvdb:
// A TVDB ID identifies a series: no direct movie to fetch, fall back to the title search.
return []
}
return result.map { [metadata(forResult: $0, language: language)] } ?? []
}
// MARK: - Helpers
private func cleanList(items: [TMDBTuple]?) -> String? {