passing arguments though text file

Support for Windows users
Post Reply
Ztrust
Posts: 69
Joined: 21 Dec 2013, 17:04

passing arguments though text file

Post by Ztrust »

Hi i have had a setup that's worked for a long time, but since i primarily use sonarr and CP to add content i do not know when Filebot broke
but yesterday i manually tried adding both a movie and an episode only to discover it dosent work anymore, ive narrowed it down to passing the formats through the @text file, everything works through the gui client and when manually adding the format to the script. this is the utorrent script

Code: Select all

"filebot.launcher.exe" -script fn:amc --def @/H:/Filebot/Formats/Utorrentformats.txt --def subtitles=en,da  --def ignore=Sonarr  --action hardlink --conflict auto -non-strict --log-file "H:/Filebot/~Logs/amc.log" --def excludeList="H:/Filebot/~Logs/amc.txt" --def clean=y --def unsorted=n music=y artwork=n "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D"


this is the utorrentformat.txt

Code: Select all

seriesFormat=D:/{info.genres.contains('Animation') ? 'Cartoon Series' : csv('H:/Filebot/ShowPaths.csv').get(n) ?: 'Series'}/{csv('H:/Filebot/Shownames.csv').get(n) ?: n.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:?_]/, " ").upperInitial() + ''}{' '+[info.status.match(/Ended/)]}/{episode.special ? 'Season 0' : 'Season '+s}/{csv('H:/FileBot/Episodenames.csv').get(n) ?: n.replaceAll(/[?:_]/, " ") + ''} {episode.special ? 'S00E'+special.pad(2) : s00e00.replaceAll(/[-]/, "")} {t.replaceAll(/[:?_]/, " ") + ''}{' ['+fn.matchAll(/repack|proper/).join('] [').toUpperCase()+']'}{allOf{' '+tags+''}{' ['+vf+']'}{' ['+source+']'}{' '+[vc.match(/x265/)]}{'-'+group} join ''}{'.'+lang.ISO2}{fn.match(/-thumb|[.]nfo/)}
movieFormat=D:/{genres.contains('Animation') ? 'Cartoons' : info.SpokenLanguages[0] ==~ /(no|da|sv|nb)/ ? 'Nordic Movies' :any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[0-9]/ ? 'Movies/0-9' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[a-d]/ ? 'Movies/ABCD' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[e-h]/ ? 'Movies/EFGH' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[i-l]/ ? 'Movies/IJKL' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[m-p]/ ? 'Movies/MNOP' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[q-t]/ ? 'Movies/QRST' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[u-å]/ ? 'Movies/UVWYXZ' : '#'}/{collection.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!").replaceAll(/(?i)Collection/).trim()+' (Collection)/'}{info.SpokenLanguages[0] ==~ /(no|da|sv|nb)/ ? primaryTitle.upperInitial().replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!") : n.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!")} ({y}) {tags}/{info.SpokenLanguages[0] ==~ /(no|da|sv|nb)/ ? primaryTitle.upperInitial().replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!") : n.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!")} ({y}){' ['+fn.matchAll(/repack|proper/).join('] [').toUpperCase()+']'}{allOf{' '+tags+''}{' ['+vf+']'}{' '+[c{source} ?: 'BDrip']}{'-'+group} join ''}{'.'+lang.ISO2}
when tring to test through cmd it gets really wonky, this is what i use to test with and it goes through all my personal folders on c: drive before going to the input folder

Code: Select all

filebot -script fn:amc  --output "D:/"  --action test --def subtitles=en,da -non-strict   --def @/H:/Filebot/Formats/Utorrentformats.txt  "/H:/HD" --def clean=y 

Code: Select all

Run script [fn:amc] at [Sat Nov 19 15:12:34 CET 2016]
Parameter: subtitles = en,da
Parameter: seriesFormat = D:/{info.genres.contains('Animation') ? 'Cartoon Series' : csv('H:/Filebot/ShowPaths.csv').get(n) ?: 'Series'}/{csv('H:/Filebot/Shownames.csv').get(n) ?: n.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:?_]/, " ").upperInitial() + ''}{' '+[info.status.match(/Ended/)]}/{episode.special ? 'Season 0' : 'Season '+s}/{csv('H:/FileBot/Episodenames.csv').get(n) ?: n.replaceAll(/[?:_]/, " ") + ''} {episode.special ? 'S00E'+special.pad(2) : s00e00.replaceAll(/[-]/, "")} {t.replaceAll(/[:?_]/, " ") + ''}{' ['+fn.matchAll(/repack|proper/).join('] [').toUpperCase()+']'}{allOf{' '+tags+''}{' ['+vf+']'}{' ['+source+']'}{' '+[vc.match(/x265/)]}{'-'+group} join ''}{'.'+lang.ISO2}{fn.match(/-thumb|[.]nfo/)}
Parameter: movieFormat = D:/{genres.contains('Animation') ? 'Cartoons' : info.SpokenLanguages[0] ==~ /(no|da|sv|nb)/ ? 'Nordic Movies' :any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[0-9]/ ? 'Movies/0-9' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[a-d]/ ? 'Movies/ABCD' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[e-h]/ ? 'Movies/EFGH' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[i-l]/ ? 'Movies/IJKL' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[m-p]/ ? 'Movies/MNOP' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[q-t]/ ? 'Movies/QRST' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[u-Ã¥]/ ? 'Movies/UVWYXZ' : '#'}/{collection.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!").replaceAll(/(?i)Collection/).trim()+' (Collection)/'}{info.SpokenLanguages[0] ==~ /(no|da|sv|nb)/ ? primaryTitle.upperInitial().replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!") : n.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!")} ({y}) {tags}/{info.SpokenLanguages[0] ==~ /(no|da|sv|nb)/ ? primaryTitle.upperInitial().replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!") : n.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!")} ({y}){' ['+fn.matchAll(/repack|proper/).join('] [').toUpperCase()+']'}{allOf{' '+tags+''}{' ['+vf+']'}{' '+[c{source} ?: 'BDrip']}{'-'+group} join ''}{'.'+lang.ISO2}
Parameter: clean = y
Argument[0]: C:\Users\KRONZO
Argument[1]: C:\Users\KRONZO
Argument[2]: C:\Users\KRONZO
Argument[3]: C:\Users\KRONZO
Argument[4]: C:\Users\KRONZO
Argument[5]: C:\Users\KRONZO
Argument[6]: C:\Users\KRONZO
Argument[7]: C:\Users\KRONZO
Argument[8]: C:\Users\KRONZO
Argument[9]: C:\Users\KRONZO
Argument[10]: C:\Users\KRONZO
Argument[11]: H:\HD
Argument[12]: C:\Users\KRONZO
Argument[13]: C:\Users\KRONZO
Argument[14]: C:\Users\KRONZO
Argument[15]: C:\Users\KRONZO
Argument[16]: C:\Users\KRONZO
Argument[17]: C:\Users\KRONZO
Argument[18]: C:\Users\KRONZO
Argument[19]: C:\Users\KRONZO
Argument[20]: C:\Users\KRONZO
Argument[21]: C:\Users\KRONZO
Argument[22]: C:\Users\KRONZO
Argument[23]: H:\HD

this is the log for when adding movie to utorrent

Code: Select all

Run script [fn:amc] at [Sat Nov 19 14:21:53 CET 2016]
Parameter: seriesFormat = D:/{info.genres.contains('Animation') ? 'Cartoon Series' : csv('H:/Filebot/ShowPaths.csv').get(n) ?: 'Series'}/{csv('H:/Filebot/Shownames.csv').get(n) ?: n.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:?_]/, " ").upperInitial() + ''}{' '+[info.status.match(/Ended/)]}/{episode.special ? 'Season 0' : 'Season '+s}/{csv('H:/FileBot/Episodenames.csv').get(n) ?: n.replaceAll(/[?:_]/, " ") + ''} {episode.special ? 'S00E'+special.pad(2) : s00e00.replaceAll(/[-]/, "")} {t.replaceAll(/[:?_]/, " ") + ''}{' ['+fn.matchAll(/repack|proper/).join('] [').toUpperCase()+']'}{allOf{' '+tags+''}{' ['+vf+']'}{' ['+source+']'}{' '+[vc.match(/x265/)]}{'-'+group} join ''}{'.'+lang.ISO2}{fn.match(/-thumb|[.]nfo/)}
Parameter: movieFormat = D:/{genres.contains('Animation') ? 'Cartoons' : info.SpokenLanguages[0] ==~ /(no|da|sv|nb)/ ? 'Nordic Movies' :any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[0-9]/ ? 'Movies/0-9' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[a-d]/ ? 'Movies/ABCD' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[e-h]/ ? 'Movies/EFGH' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[i-l]/ ? 'Movies/IJKL' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[m-p]/ ? 'Movies/MNOP' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[q-t]/ ? 'Movies/QRST' : any{collection}{n}.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[u-Ã¥]/ ? 'Movies/UVWYXZ' : '#'}/{collection.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!").replaceAll(/(?i)Collection/).trim()+' (Collection)/'}{info.SpokenLanguages[0] ==~ /(no|da|sv|nb)/ ? primaryTitle.upperInitial().replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!") : n.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!")} ({y}) {tags}/{info.SpokenLanguages[0] ==~ /(no|da|sv|nb)/ ? primaryTitle.upperInitial().replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!") : n.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!")} ({y}){' ['+fn.matchAll(/repack|proper/).join('] [').toUpperCase()+']'}{allOf{' '+tags+''}{' ['+vf+']'}{' '+[c{source} ?: 'BDrip']}{'-'+group} join ''}{'.'+lang.ISO2}
Parameter: subtitles = en,da
Parameter: ignore = Sonarr
Parameter: excludeList = H:/Filebot/~Logs/amc.txt
Parameter: clean = y
Parameter: unsorted = n
Parameter: music = y
Parameter: artwork = n
Parameter: ut_label = IPT
Parameter: ut_state = 5
Parameter: ut_title = Jason.Bourne.2016.720p.BluRay.x264-SPARKS
Parameter: ut_kind = multi
Parameter: ut_file = Proof\jason.bourne.2016.720p.bluray.x264-sparks.proof.jpg
Parameter: ut_dir = D:\Utorrent\IPT\Jason.Bourne.2016.720p.BluRay.x264-SPARKS
Argument[0]: C:\Users\Zmedia\Desktop
Argument[1]: C:\Users\Zmedia\Desktop
Argument[2]: C:\Users\Zmedia\Desktop
Argument[3]: C:\Users\Zmedia\Desktop
Argument[4]: C:\Users\Zmedia\Desktop
Argument[5]: C:\Users\Zmedia\Desktop
Argument[6]: C:\Users\Zmedia\Desktop
Argument[7]: C:\Users\Zmedia\Desktop
Argument[8]: C:\Users\Zmedia\Desktop
Argument[9]: C:\Users\Zmedia\Desktop
Argument[10]: C:\Users\Zmedia\Desktop
Illegal usage: use either script parameters [label:IPT, state:5, title:Jason.Bourne.2016.720p.BluRay.x264-SPARKS, kind:multi, file:Proof\jason.bourne.2016.720p.bluray.x264-sparks.proof.jpg, dir:D:\Utorrent\IPT\Jason.Bourne.2016.720p.BluRay.x264-SPARKS] or file arguments [C:\Users\Zmedia\Desktop, C:\Users\Zmedia\Desktop, C:\Users\Zmedia\Desktop, C:\Users\Zmedia\Desktop, C:\Users\Zmedia\Desktop, C:\Users\Zmedia\Desktop, C:\Users\Zmedia\Desktop, C:\Users\Zmedia\Desktop, C:\Users\Zmedia\Desktop, C:\Users\Zmedia\Desktop, C:\Users\Zmedia\Desktop] but not both
Failure (°_°)

and lastly I have a danish show thats only on tvdb in danish so it does not go in the correct location which should be D./series/lukusfælden/season 17/filehere.ext
but D:/season 17/filehere.ext

i'm truthfully overwhelmed getting this to work and rather frustrated so hope you can help


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

Re: passing arguments though text file

Post by rednoah »

1.
If you're only passing in the formats via argument files anyway, then I recommend doing this:

Code: Select all

--def seriesFormat="@/path/to/SeriesFormat.groovy" movieFormat="@/path/to/MovieFormat.groovy"

2.
Your arguments file contains lots of empty lines (i.e. arguments), and an empty string happens to be a valid relative path to the current working directory.


3.
/H:/HD => NO (don't do this, it's weird)
H:/HD => YES (this is what a absolute path looks like on Windows)
:idea: Please read the FAQ and How to Request Help.
Ztrust
Posts: 69
Joined: 21 Dec 2013, 17:04

Re: passing arguments though text file

Post by Ztrust »

hey rednoah thank you for the reply ;)
can you explain what you mean with empty lines ?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: passing arguments though text file

Post by rednoah »

You're effectively doing something like this:

Code: Select all

filebot -script "g:println args" "" "" "" ""
How you end up doing this is for you to figure out. I'm not a CMD interpreter. :lol:
:idea: Please read the FAQ and How to Request Help.
Ztrust
Posts: 69
Joined: 21 Dec 2013, 17:04

Re: passing arguments though text file

Post by Ztrust »

fair enough thank you for the help. I know what i will do tonight
Thanks
Post Reply