Match subtitle name before renaming files?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
baxuz
Posts: 2
Joined: 15 May 2016, 12:12

Match subtitle name before renaming files?

Post by baxuz »

I noticed that AMC fetches the wrong subtitles when using the following script, but fetches the correct ones when I manually search for them via CLI or GUI. This is the script I'm using:

Code: Select all

filebot -script fn:amc --output "D:/Videos" --def plex=localhost:hYX6n4bQhRLP##### --format {plex} --def subtitles=en --action hardlink -non-strict "D:/Downloads/#TV Shows" --action hardlink -non-strict "D:/Downloads/#Movies" --log-file amc.log --def excludeList=amc.txt
What seems to be happening is that Filebot first renames and moves the files and then searches for the subtitles with the generically named files. I might be wrong though. For example:

Silicon.Valley.S01E01.720p.BluRay.x265.ShAaNiG gets renamed to Silicon Valley - S01E01 - Minimum Viable Product

The subtitle detected for the renamed file is Silicon.Valley.S01E01.1080p.BluRay.x264-ROVERS.srt (wrong one) while for the original it's [Silicon.Valley.S01E01.HDTV.x264-KILLERS.srt (correct one)

Is it possible to have AMC search for the files based on the source filename instead of the destination filename?

PS:
I'm running this as a .bat file since I find it easier to edit. Is this the right syntax to specify multiple input folders? (qBittorrent labels in this case)
Last edited by baxuz on 15 May 2016, 16:22, edited 2 times in total.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Match subtitle name before renaming files?

Post by rednoah »

Thanks for the post! Before a real human comes by, please make sure your report has all the following points checked:
  • Include screenshots, logs or filenames (i.e. demonstrate the issue)
  • Include basic information (i.e. sysinfo output)
:idea: Please read How to Request Help and Fix Problems, Report Bugs, Get Features
:idea: Please read the FAQ and How to Request Help.
baxuz
Posts: 2
Joined: 15 May 2016, 12:12

Re: Match subtitle name before renaming files?

Post by baxuz »

Any ideas?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Match subtitle name before renaming files?

Post by rednoah »

1.
The amc script searches for subtitles before files are renamed, but only in strict mode (by hash and by tag). In any case, output filename doesn't matter.

2.
Neither of your suggested subtitles (good and bad) matches the original filename, so it's not necessarily possible for filebot to know which one matches well and which one doesn't. Based on the filename neither one is a match.

3.
You could try the osdb.explain script to learn more about the subtitle options:

Code: Select all

filebot -script fn:osdb.explain -non-strict /path/to/file
:idea: Please read the FAQ and How to Request Help.
sjtsnix
Posts: 3
Joined: 27 Nov 2021, 03:40

Re: Match subtitle name before renaming files?

Post by sjtsnix »

rednoah wrote: 20 May 2016, 19:19 1.
The amc script searches for subtitles before files are renamed, but only in strict mode (by hash and by tag). In any case, output filename doesn't matter.
Hello rednoah,
When running the following:

M:\FileBot\INPUT>filebot -script fn:amc --output "M:\FileBot\OUTPUT" --action duplicate -non-strict "M:\FileBot\INPUT" --log-file amc.log --def excludeList=amc.txt --mode interactive --def subtitles=en --def artwork=y --def pushover=******** --def storeReport="M:\FileBot\REPORTS" --def movieDB=TheMovieDB seriesDB=TheMovieDB::TV


it appears the script is only looking for subtitles by hash (and it fails).

Run script [fn:amc] at [Sun Jul 10 19:02:02 PDT 2022]
Parameter: excludeList = amc.txt
Parameter: subtitles = en
Parameter: artwork = y
Parameter: pushover = *****
Parameter: storeReport = M:\FileBot\REPORTS
Parameter: movieDB = TheMovieDB
Parameter: seriesDB = TheMovieDB::TV
Argument[0]: M:\FileBot\INPUT
Use excludes: M:\FileBot\OUTPUT\amc.txt
Input: M:\FileBot\INPUT\The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG[TGx]\The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG.mkv
Group: {Movie=The Phantom of the Open (2022), Series=null} => [The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG.mkv]
Get [English] subtitles for 1 file
Looking up subtitles by hash via OpenSubtitles
No subtitle match by hash: M:\FileBot\INPUT\The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG[TGx]\The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG.mkv

Rename movies using [TheMovieDB]
Auto-detect movie from context [M:\FileBot\INPUT\The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG[TGx]\The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG.mkv]
[DUPLICATE] from [M:\FileBot\INPUT\The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG[TGx]\The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG.mkv] to [M:\FileBot\OUTPUT\Movies\The Phantom of the Open (2022)\The Phantom of the Open (2022).mkv]
Processed 1 file
Fetching movie artwork for [The Phantom of the Open (2022)] to [M:\FileBot\OUTPUT\Movies\The Phantom of the Open (2022)]
Generate Movie NFO: The Phantom of the Open [717151]
Fetching M:\FileBot\OUTPUT\Movies\The Phantom of the Open (2022)\poster.jpg => [posters/1000x1500, en, 15738.0, https://image.tmdb.org/t/p/original/g6t ... TsF3da.jpg]
Fetching M:\FileBot\OUTPUT\Movies\The Phantom of the Open (2022)\fanart.jpg => [backdrops/1859x1047, 0.0, https://image.tmdb.org/t/p/original/7gb ... xvePOS.jpg]
Fanart not found: M:\FileBot\OUTPUT\Movies\The Phantom of the Open (2022)\clearart.png / hdmovieclearart
Fanart not found: M:\FileBot\OUTPUT\Movies\The Phantom of the Open (2022)\clearart.png / movieart
Fanart not found: M:\FileBot\OUTPUT\Movies\The Phantom of the Open (2022)\logo.png / hdmovielogo
Fanart not found: M:\FileBot\OUTPUT\Movies\The Phantom of the Open (2022)\logo.png / movielogo
Fanart not found: M:\FileBot\OUTPUT\Movies\The Phantom of the Open (2022)\disc.png / moviedisc
Fanart not found: M:\FileBot\OUTPUT\Movies\The Phantom of the Open (2022)\disc.png / moviedisc
Fanart not found: M:\FileBot\OUTPUT\Movies\The Phantom of the Open (2022)\disc.png / moviedisc
Sending Pushover notification
Saving HTML report to [M:\FileBot\REPORTS\[2022-07-10_19_02]_The_Phantom_of_the_Open_2022_720p_WEBRip_800MB_x26.html]
Done ?(?????)?

I used your osdb.explain script listed below:
rednoah wrote: 20 May 2016, 19:19 3.
You could try the osdb.explain script to learn more about the subtitle options:

Code: Select all

filebot -script fn:osdb.explain -non-strict /path/to/file
with these two results:
first one from the original filename (it fails) and from the renamed filename (it fails):

Code: Select all

C:\Users\sj>filebot -script fn:osdb.explain -non-strict "M:\FileBot\OUTPUT\Movies\The Phantom of the Open (2022)\The Phantom of the Open (2022).mkv"
File: M:\FileBot\OUTPUT\Movies\The Phantom of the Open (2022)\The Phantom of the Open (2022).mkv
Hash/Tag Lookup (hash: 3b1995692b1cd623, size: 835730353, lang: en_US, tag: The Phantom of the Open (2022))
Best Hash Match: null
Name Lookup (file: The Phantom of the Open (2022), strict: false, lang: en_US)
Best Name Match: null
Done ?(?????)?

Code: Select all

C:\Users\sj>filebot -script fn:osdb.explain -non-strict "M:\FileBot\INPUT\The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG[TGx]\The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG.mkv"
File: M:\FileBot\INPUT\The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG[TGx]\The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG.mkv
Hash/Tag Lookup (hash: 3b1995692b1cd623, size: 835730353, lang: en_US, tag: The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG)
Best Hash Match: null
Name Lookup (file: The.Phantom.of.the.Open.2022.720p.WEBRip.800MB.x264-GalaxyRG, strict: false, lang: en_US)
Best Name Match: null
Done ?(?????)?
Using VLC and the VLSub 0.11.1, if I search for the original file name, no subtitles are found (same as filebot), but when I search for the renamed file, VLSub 0.11.1 offers up four hits, with three of the being a potential match.

Can FileBot do something similar, offer up a list of potential matches in an interactive window?

Thank you for your time,
SJ
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Match subtitle name before renaming files?

Post by rednoah »

The amc script will indeed only use Lookup by Hash because that's the only reliable non-interactive way to find subtitles:
viewtopic.php?t=2615


:arrow: You can use the suball script with -non-strict to fetch subtitles in a non-interactive script.


:arrow: You can use the FileBot Desktop application to fetch subtitles in an interactive window.


Image


:idea: Note that FileBot stores the original filename to xattr metadata and so FileBot knows the original filename when looking up matching subtitles later.


:arrow: If you encounter files where Lookup by Hash does not work, and have subtitles that you have confirmed to be in-sync, then please re-upload them with FileBot so that OpenSubtitles can link a file hash to the subtitles and so that it works right away for the next guy.



EDIT:

FileBot r9254

Code: Select all

Add "lookup by tag" (i.e. exact file name search) as fall back to "lookup by hash" so that the amc script (which uses strict subtitle lookup by default) is more likley to find subtitles (at the expensive of maybe finding bad subtitles).

NOTE: "lookup by tag" was disabled in 2017 due to "search by name" working better at the time, but "search by name" is limited to the top 5 results nowadays which makes it work less well (because it doesn't have to best option to choose from in the first place)
:idea: Please read the FAQ and How to Request Help.
Post Reply