AMC Not Matching Titles Using TVDB (due to broken custom format)

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
whereswaller
Posts: 23
Joined: 05 Mar 2015, 21:59

AMC Not Matching Titles Using TVDB (due to broken custom format)

Post by whereswaller »

Hi,
Filebot AMC (across earlier versions of Filebot and now v4.9.1) has not been matching television show titles using TheTVDB for several months, instead all these files are processed into the "Unsorted" folder. Both music and movies (which don't use TheTVDB obviously) are being processing correctly. Are you aware of any issues with TheTVDB in AMC? Any advice on how I can fix this?

AMC Log:

Code: Select all

Run script [fn:amc] at [Sat May 16 15:32:50 AEST 2020]
Parameter: music = y
Parameter: subtitles = en
Parameter: artwork = n
Parameter: plex = *****
Parameter: pushbullet = *****
Parameter: clean = y
Parameter: unsorted = y
Parameter: ut_label = television
Parameter: ut_state = 20
Parameter: ut_title = American.Dad.S16E05.HDTV.x264-KILLERS[TGx]
Parameter: ut_kind = multi
Parameter: ut_file = American.Dad.S16E05.HDTV.x264-KILLERS.mkv
Parameter: ut_dir = C:\Users\xxx\Downloads\Complete\television\American.Dad.S16E05.HDTV.x264-KILLERS[TGx]
Parameter: seriesFormat = {n =~ /Frontline|Air Crash Investigation|Mayday|Horizon|Kourtney and Kim Take Miami|Kourtney and Khloe Take Miami|Kourtney and Khloé Take Miami|Kourtney and Khloe Take the Hamptons|Kourtney and Khloé Take the Hamptons|UFC/ ? 'C:/Users/xxx/Downloads/Unsorted/'+fn : {n =~ /^[0-9a-qA-Q].*/ ? 'I' : 'K'} + ':/Television/'+n.upperInitial()+'/Season '+s.pad(2)+'/'+n.upperInitial()+' '+s.pad(2)+'x'+es*.pad(2).join('-')+' - '+t.upperInitial().replacePart(replacement = ', Part $1')}{' '+fn.match(/\(Part \d+/)+' of '+model.episode.count{ it == episode }+') '}{subt}
Parameter: animeFormat = J:/Anime/{n.upperInitial()}/{fn}
Parameter: movieFormat = J:/Film/{y}/{allOf{n.upperInitial()}{info.OriginalName.upperInitial()}.unique().join(' - ')} {'('+y+')'}{' (Part '+pi+' of '+pn+')'}{subt}
Parameter: musicFormat = J:/Music (Unsorted - Stage 1)/{n.upperInitial()}/{'('+y+') '}{album.upperInitial()}/{n.upperInitial()} - {t.upperInitial()}
Input: C:\Users\xxx\Downloads\Complete\television\American.Dad.S16E05.HDTV.x264-KILLERS[TGx]\American.Dad.S16E05.HDTV.x264-KILLERS.mkv
Group: {Series=american dad} => [American.Dad.S16E05.HDTV.x264-KILLERS.mkv]
Get [English] subtitles for 1 files
Looking up subtitles by hash via OpenSubtitles
No matching subtitles found: C:\Users\James\Downloads\Complete\television\American.Dad.S16E05.HDTV.x264-KILLERS[TGx]\American.Dad.S16E05.HDTV.x264-KILLERS.mkv
Rename episodes using [TheTVDB] with [Airdate Order]
Auto-detected query: [American Dad]
Fetching episode data for [American Dad!]
Fetching episode data for [American Weed]
Fetching episode data for [American Greed]
Fetching episode data for [American Dreams]
Fetching episode data for [Savage Family Diggers]
BindingException: Binding "subt": undefined
Processing 1 unsorted files
[COPY] from [C:\Users\xxx\Downloads\Complete\television\American.Dad.S16E05.HDTV.x264-KILLERS[TGx]\American.Dad.S16E05.HDTV.x264-KILLERS.mkv] to [C:\Users\xxx\Downloads\Unsorted\American.Dad.S16E05.HDTV.x264-KILLERS[TGx]\American.Dad.S16E05.HDTV.x264-KILLERS.mkv]
Processed 1 files
Notify Plex: [host:localhost, token:xxx]
GET: http://localhost:32400/library/sections/all/refresh?X-Plex-Token=xxx
Sending PushBullet report
Done ヾ(@⌒ー⌒@)ノ
Run script [fn:amc] at [Sat May 16 15:43:50 AEST 2020]
Parameter: music = y
Parameter: subtitles = en
Parameter: artwork = n
Parameter: plex = *****
Parameter: pushbullet = *****
Parameter: clean = y
Parameter: unsorted = y
Parameter: ut_label = television
Parameter: ut_state = 20
Parameter: ut_title = Family.Guy.S18E08.720p.WEB.x265-MiNX[TGx]
Parameter: ut_kind = multi
Parameter: ut_file = Family.Guy.S18E08.720p.WEB.x265-MiNX.mkv
Parameter: ut_dir = C:\Users\xxx\Downloads\Complete\television\Family.Guy.S18E08.720p.WEB.x265-MiNX[TGx]
Parameter: seriesFormat = {n =~ /^[0-9a-qA-Q].*/ ? 'I' : 'K'} + ':/Television/'+n.upperInitial()+'/Season '+s.pad(2)+'/'+n.upperInitial()+' '+s.pad(2)+'x'+es*.pad(2).join('-')+' - '+t.upperInitial().replacePart(replacement = ', Part $1')}{' '+fn.match(/\(Part \d+/)+' of '+model.episode.count{ it == episode }+') '{subt}
Parameter: animeFormat = J:/Anime/{n.upperInitial()}/{fn}
Parameter: movieFormat = J:/Film/{y}/{allOf{n.upperInitial()}{info.OriginalName.upperInitial()}.unique().join(' - ')} {'('+y+')'}{' (Part '+pi+' of '+pn+')'}{subt}
Parameter: musicFormat = J:/Music (Unsorted - Stage 1)/{n.upperInitial()}/{'('+y+') '}{album.upperInitial()}/{n.upperInitial()} - {t.upperInitial()}
Input: C:\Users\xxx\Downloads\Complete\television\Family.Guy.S18E08.720p.WEB.x265-MiNX[TGx]\Family.Guy.S18E08.720p.WEB.x265-MiNX.mkv
Group: {Series=family guy} => [Family.Guy.S18E08.720p.WEB.x265-MiNX.mkv]
Get [English] subtitles for 1 files
Looking up subtitles by hash via OpenSubtitles
No matching subtitles found: C:\Users\xxx\Downloads\Complete\television\Family.Guy.S18E08.720p.WEB.x265-MiNX[TGx]\Family.Guy.S18E08.720p.WEB.x265-MiNX.mkv
ScriptException: SyntaxError: unexpected token: }
Processing 1 unsorted files
[COPY] from [C:\Users\xxx\Downloads\Complete\television\Family.Guy.S18E08.720p.WEB.x265-MiNX[TGx]\Family.Guy.S18E08.720p.WEB.x265-MiNX.mkv] to [C:\Users\xxx\Downloads\Unsorted\Family.Guy.S18E08.720p.WEB.x265-MiNX[TGx]\Family.Guy.S18E08.720p.WEB.x265-MiNX.mkv]
Processed 1 files
Notify Plex: [host:localhost, token:xxx]
GET: http://localhost:32400/library/sections/all/refresh?X-Plex-Token=xxx
Sending PushBullet report
Done ヾ(@⌒ー⌒@)ノ
AMC Script in uTorrent:

Code: Select all

filebot.launcher.exe -script fn:amc --output "C:/Users/xxx/Downloads" --log-file amc.log --action copy --conflict skip -non-strict --def music=y subtitles=en artwork=n --def plex=localhost:xxx --def pushbullet=xxx --def clean=y --def unsorted=y "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" --def @"C:\Program Files\FileBot\amcformats.txt"
amcformats.txt:

Code: Select all

seriesFormat={n =~ /Frontline|Air Crash Investigation|Mayday|Horizon|Kourtney and Kim Take Miami|Kourtney and Khloe Take Miami|Kourtney and Khloé Take Miami|Kourtney and Khloe Take the Hamptons|Kourtney and Khloé Take the Hamptons|UFC/ ? 'C:/Users/James/Downloads/Unsorted/'+fn : {n =~ /^[0-9a-qA-Q].*/ ? 'I' : 'K'} + ':/Television/'+n.upperInitial()+'/Season '+s.pad(2)+'/'+n.upperInitial()+' '+s.pad(2)+'x'+es*.pad(2).join('-')+' - '+t.upperInitial().replacePart(replacement = ', Part $1')}{' '+fn.match(/\(Part \d+/)+' of '+model.episode.count{ it == episode }+') '}{subt}
animeFormat=J:/Anime/{n.upperInitial()}/{fn}
movieFormat=J:/Film/{y}/{allOf{n.upperInitial()}{info.OriginalName.upperInitial()}.unique().join(' - ')} {'('+y+')'}{' (Part '+pi+' of '+pn+')'}{subt}
musicFormat=J:/Music (Unsorted - Stage 1)/{n.upperInitial()}/{'('+y+') '}{album.upperInitial()}/{n.upperInitial()} - {t.upperInitial()}
Many thanks in advance.
User avatar
rednoah
The Source
Posts: 19128
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Not Matching Titles Using TVDB

Post by rednoah »

Your series format is broken, so it'll error out for each episode, so unsorted will take care of left overs.


Individually {expressions} can fail and that's fine, however, if the entire format yields no value at all, then FileBot will escalate the most recent error:

Code: Select all

BindingException: Binding "subt": undefined

Removing {subt} to the root cause in the preceding {expression}:

Code: Select all

ScriptException: SyntaxError: unexpected token: }


:!: Different calls with different formats suggests you're trying to debug your complex custom format on the command-line. This is painful and ineffective. Use the GUI instead for prototyping and testing your custom format.



:arrow: The next step is to dissect your complex custom format in the Format Editor to figure it out:
Image


The first obvious issue is that this is wrong, within the Groovy context:

Code: Select all

{n =~ /^[0-9a-qA-Q].*/ ? 'I' : 'K'}

Code: Select all

(n =~ /^[0-9a-qA-Q].*/ ? 'I' : 'K')

:arrow: Any further debugging I will leave to you. Just divide and conquer. Test each component by itself. And remember to differentiate between Groovy context, and FileBot Format context, {...} can mean different things in different contexts. ;)
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1046
Joined: 15 May 2014, 16:17

Re: AMC Not Matching Titles Using TVDB (due to broken custom format)

Post by kim »

Code: Select all

{n =~ /^[0-9a-qA-Q].*/ ? 'I' : 'K'}{ ':/Television/'}{n.upperInitial()}{'/Season ' + s.pad(2)}{'/' + n.upperInitial()}{' ' + s.pad(2) + 'x' + es*.pad(2).join('-')}{' - ' + t.upperInitial().replacePart(replacement = ', Part $1')}{' '+fn.match(/\(Part \d+/)}{' of (' + model.episode.count{ it == episode } + ') '}{subt}
whereswaller
Posts: 23
Joined: 05 Mar 2015, 21:59

Re: AMC Not Matching Titles Using TVDB (due to broken custom format)

Post by whereswaller »

Hi,
Thanks for the help rednoah and kim. Final, working, script below for anyone interested.

Code: Select all

seriesFormat={fn =~ (/(?i)Survivor.*AU|Married.*At.*First.*Sight.*AU|Frontline|Air.*Crash.*Investigation|Mayday|Horizon|UFC/) ?  'C:/Users/xxx/Downloads/Unsorted/'+fn : ''+{n =~ /^[0-9a-qA-Q].*/ ? 'I' : 'K'}+{':/Television/'}+{n.upperInitial()}+{'/Season '+s.pad(2)}+{'/'+n.upperInitial()}+{' '+s.pad(2)+'x'+es*.pad(2).join('-')+{' - '+t.upperInitial().replacePart(replacement = ', Part $1')}+{' '+fn.match(/\(Part \d+/)+' of '+model.episode.count{ it == episode }+') '}+{subt}}}
Post Reply