Page 1 of 1

Right syntax help

Posted: 05 Mar 2019, 12:45
by KRONZO
Im trying to get filebot to sort for radarr and sonarr and i got the sorting down, but i cant get the syntax right for {fn} the file ends up the correct place but is just named fn. ;(
D:/{info.genres.contains('Animation') ? 'Cartoon Series' : label =~ 'Sonarr' ? 'Utorrent/SonarrDone' : csv('C:/AMC/Filebot/ShowPaths.csv').get(n) ?: 'Series'}/{label =~ 'Sonarr' ? '{fn}' : csv('C:/AMC/Filebot/Shownames.csv').get(n) ?: n.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:?_]/, " ").upperInitial() + ''}

Hope you can help

Re: Right syntax help

Posted: 05 Mar 2019, 13:02
by KRONZO
nevermind I got it working

Re: Right syntax help

Posted: 05 Mar 2019, 13:28
by rednoah
The variable name is fn so you don't need expression braces if you're already inside an expression.

Re: Right syntax help

Posted: 05 Mar 2019, 16:41
by KRONZO
Hey rednoah
as always thanks for answering ;)
I actually knew that, brackets where added to highlight the problem I still had the ' ' though witch (sorry can never spell that correctly) :cry: was the problem ;)
will you please help fix this, i need the format to go one place if the label is sonarr or otherwise use the regular format. been trying to fix this for a long time i think this might actually work, here is the format

Code: Select all

D:/{info.genres.contains('Animation') ? 'Cartoon Series' : csv('C:/AMC/Filebot/ShowPaths.csv').get(n) ?: 'Series'}/{csv('C:/AMC/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('C:/AMC/Filebot/Episodenames.csv').get(n) ?: n.replaceAll(/[?:_]/, " ") + ''} {episode.special ? 'S00E'+special.pad(2) : s00e00.replaceAll(/[-]/, "")}{' '+t.replaceAll(/[:?_]/, " ") + ''}{' '+tags}{' ['+vf.replace(/2160p/, "4K")+']'}{' ['+"${self.source ?: 'Web-DL'}"+']'}{fn =~ /AMZN|AMAZON/ ? ' [AMAZON]' : fn =~ /NF|NETFLIX/ ? ' [NETFLIX]' :fn =~ /it|Itunes/ ? ' [ITUNES]' : null}{if (bitdepth == 10) ' [10bit]'}{boolean isHDR = false;def mHDRCol = ["BT.709" : "NO", "BT.2020" : "YES"];if(self.video[0].bitdepth != null && self.bitdepth >= 10 && self.video[0].colourprimaries != null &&  mHDRCol.get(self.video[0].colourprimaries) == "YES") ' [HDR]/' else null;} {video[0].CodecID =~ /HEVC/ ? ' [HEVC] ' : null}{' '+"[$ac "+af.replace('8ch', '7.1ch').replace('7ch', '6.1ch').replace('6ch', '5.1ch').replace('3ch', '2.1ch').replace('2ch','2.0ch')+']'}{' ['+fn.matchAll(/repack|proper/).join('] [').toUpperCase()+']'}{'-'+group}{'.'+lang.ISO2}{fn.match(/-thumb|[.]nfo/)}

label =~ 'Sonarr' ? 'uttorrent/sonarrdone/'fn : regular format here

in advance thank you

Re: Right syntax help

Posted: 05 Mar 2019, 17:16
by rednoah
I can't really fix complex formats that do many things.

If you have a specific question about a specific section of the format, then I can help with that.

Since you have a very complex regular format, you can't use a simple if-then-else (unless you rewrite your entire format anyway), so the best option is to have your own glue logic script that calls filebot with different options depending on the label argument (assuming you're using some kind of script to run filebot).

Re: Right syntax help

Posted: 05 Mar 2019, 17:40
by KRONZO
ok I was sure you would know the solution ;)
could i use def exec to call different filebot scripts based on labels
I am using run program on utorrent complete

Re: Right syntax help

Posted: 05 Mar 2019, 22:20
by KRONZO
Hey Rednoah

I found another solution, thank you very much for your awesome support :) and ignore all those who complain about pricing this is an amazing software and is worth way more then you charge ;()

Re: Right syntax help

Posted: 06 Mar 2019, 04:49
by rednoah
Many ways to do it.

I'd start by hooking they python post process script into uTorrent, and then have the python script make different FileBot calls depending on the arguments passed in.

e.g.
https://github.com/filebot/plugins/blob ... rocess.pyw