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

+15 -7
View File
@@ -213,14 +213,22 @@ class QueueMetadataAction : NSObject, QueueActionProtocol {
var metadata: MetadataResult? = nil
switch info {
case let .movie(title):
case let .movie(title, id):
let service = MetadataSearch.service(name: self.movieProvider)
let movieSearch = MetadataSearch.movieSeach(service: service, movie: title, language: self.movieLanguage)
_ = movieSearch.search(completionHandler: {
if let result = $0.first {
_ = movieSearch.loadAdditionalMetadata(result, completionHandler: { metadata = $0 }).run()
}
}).run()
if let id = id {
// The file name carries a service ID: try the direct lookup (which
// already returns full details) before searching by title.
let idSearch = MetadataSearch.movieIDSearch(service: service, id: id, language: self.movieLanguage)
_ = idSearch.search(completionHandler: { metadata = $0.first }).run()
}
if metadata == nil {
let movieSearch = MetadataSearch.movieSeach(service: service, movie: title, language: self.movieLanguage)
_ = movieSearch.search(completionHandler: {
if let result = $0.first {
_ = movieSearch.loadAdditionalMetadata(result, completionHandler: { metadata = $0 }).run()
}
}).run()
}
case let .tvShow(seriesName, season, episode):
let service = MetadataSearch.service(name: self.tvShowProvider)
let tvSearch = MetadataSearch.tvSearch(service: service, tvShow: seriesName, season: season, episode: episode, language: tvShowLanguage)