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

+4
View File
@@ -20,6 +20,10 @@ if ($file->isTVshow()) {
} elsif ($file->isMovie()) {
print "movie" . "\n";
print $file->{movie} . "\n";
if (defined $file->{imdb}) {
my $idkind = defined $file->{idkind} ? $file->{idkind} : "";
print "id:" . $idkind . ":" . $file->{imdb} . "\n";
}
} else {
print "unknown" . "\n";
}
@@ -88,11 +88,11 @@ $VERSION = "0.35.1";
},
{ # Movie IMDB Support
# Perl > v5.10
re => '^(?<movie>.*?)?(?:[\/\s._-]*(?<openb>\[)?(?<year>(?:19|20)\d{2})(?(<openb>)\]))?(?:[\/\s._-]*(?<openc>\[)?(?:(?:imdb|tt)[\s._-]*)*(?<imdb>\d{7})(?(<openc>)\]))(?:[\s._-]*(?<title>[^\/]+?))?$',
re => '^(?<movie>.*?)?(?:[\/\s._-]*(?<openb>[\[(])?(?<year>(?:19|20)\d{2})(?(<openb>)[\])]))?(?:[\/\s._-]*(?<openc>[\[{])?(?:(?<idkind>imdb|tmdb|tvdb|tt)[\s._-]*)*(?<imdb>\d{7,9})(?(<openc>)[\]}]))(?:[\s._-]*(?<title>[^\/]+?))?$',
# Perl < v5.10
re_compat => '^(.*?)?(?:[\/\s._-]*\[?((?:19|20)\d{2})\]?)?(?:[\/\s._-]*\[?(?:(?:imdb|tt)[\s._-]*)*(\d{7})\]?)(?:[\s._-]*([^\/]+?))?$',
keys_compat => [qw(movie year imdb title)],
re_compat => '^(.*?)?(?:[\/\s._-]*[\[(]?((?:19|20)\d{2})[\])])?(?:[\/\s._-]*[\[{]?(?:(imdb|tmdb|tvdb|tt)[\s._-]*)*(\d{7,9})[\]}]?)(?:[\s._-]*([^\/]+?))?$',
keys_compat => [qw(movie year idkind imdb title)],
test_funcs => [0, 0, 0, 1], # DVD TV Episode Movie
test_keys => [qw(filename movie guess-movie year imdb title ext)],
@@ -113,6 +113,12 @@ $VERSION = "0.35.1";
['tt0096657.mov', undef, undef, undef, '0096657', undef, 'mov'],
['tt0096857', undef, undef, undef, '0096857', undef, undef],
['1234576', undef, undef, undef, '1234576', undef, undef],
['The Point Pleasant Tapes (2024) {tmdb-1015812}.mp4', 'The Point Pleasant Tapes', undef, 2024, 1015812, undef, 'mp4'],
['Some Movie (2024) {imdb-tt1234567}.mkv', 'Some Movie', undef, 2024, 1234567, undef, 'mkv'],
['Some Movie (2024) {tvdb-1234567}.mkv', 'Some Movie', undef, 2024, 1234567, undef, 'mkv'],
['Some.Movie.{tmdb-1015812}.mkv', 'Some.Movie', undef, undef, 1015812, undef, 'mkv'],
['The Matrix (1999) {imdb-tt0133093}.mkv', 'The Matrix', undef, 1999, '0133093', undef, 'mkv'],
['Dune: Part Two (2024) {imdb-tt15239678}.mp4', 'Dune: Part Two', undef, 2024, '15239678', undef, 'mp4'],
],
#warning => 'Found year instead of season+episode',
},