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:
1 parent
401584a376
commit
f20ad7ee45
10 files changed
+203
-60
No files matched your search
@@ -285,6 +285,21 @@ final public class TheMovieDBService {
|
||||
return result
|
||||
}
|
||||
|
||||
/// Resolves an external ID (e.g. an `tt…` IMDb ID with `external_source=imdb_id`)
|
||||
/// to a movie and fetches its full details.
|
||||
public func findMovie(id externalID: String, externalSource: String, language: String) -> TMDBMovie? {
|
||||
guard let url = URL(string: basePath + "find/" + externalID + "?api_key=" + key + "&external_source=" + externalSource),
|
||||
let result = sendJSONRequest(url: url, language: language, type: FindResults.self),
|
||||
let movieID = result.movie_results?.first?.id
|
||||
else { return nil }
|
||||
|
||||
return fetch(movieID: movieID, language: language)
|
||||
}
|
||||
|
||||
private struct FindResults : Codable {
|
||||
let movie_results: [TMDBMovieSearchResult]?
|
||||
}
|
||||
|
||||
public func search(series: String, language: String) -> [TMDBTVSearchResult] {
|
||||
let encodedName = series.urlEncoded()
|
||||
|
||||
|
||||
Reference in new issue
Block a user