It is not adding languages

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Levaculik
Posts: 7
Joined: 05 Aug 2022, 00:33

It is not adding languages

Post by Levaculik »

I'm using this script to rename and detect the languages, making them look like this.

Shell: Select all

Dragon.Ball.Daima.S01E01.Conspiracy.1080p.CR.WEB-DL.AAC2.0.H.264.JPN.pt-BR-Levaculik.mkv
But it's coming out

Shell: Select all

Dragon.Ball.Daima.S01E01.Conspiracy.1080p.CR.WEB-DL.AAC2.0.H.264-Levaculik.mkv
how to solve this.

Here is the complete script.

Shell: Select all

for f in *.mkv; do filebot "$f" -rename -r , --format "{n.upperInitial().space('.').replaceAll(/[-()`´‘’'?,!]/, '').replaceAll(/'/, '')}.{s00e00}.{t.space('.').replace(/·/, '-').replace('&','and').removeAll(/[!?,:'`´‘’ʻ’]/).replacePart('Part.$1')}.{vf.replace('720pInf', '720p')}.CR.WEB-DL{'.'+ac.replace('MLP','TrueHD').replace('AC3','DD').replace('MPEG Audio','MP3').replace('EDD','DDP').replace('DTS','DTS').replace('DTS-HD','DTS-HD').replace('FLAC','FLAC').replace('AAC5.1','DDP5.1').replace('AAC2.0','AAC2.0').replace('AAC','AAC').replace('Opus','Opus')}.{af.format(8: 'DD+ 7.1', 7: '6.1', 6: 'DD 5.1', 5: '5.0', 3: '2.1', 2: '2.0')}{'.'+vc.replace('ATEME','H.265').replace('HEVC','H.265').replace('AVC','H.264').replace('x264','H.264')}.{audioLanguages.ISO3.joining('.','','').upper().replace('POR','pt-BR').replace('POB','pt-BR').replace('ZHO','CHI')}-Levaculik" --db TheTVDB -no-xattr -non-strict ; done
User avatar
rednoah
The Source
Posts: 24035
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: It is not adding languages

Post by rednoah »

:?: What does the Format Editor say when you test the relevant part of the format on a relevant file?

Screenshot


:?: What does filebot -mediainfo say for the file at hand?

Shell: Select all

filebot -mediainfo *.mkv --format "{ audioLanguages.ISO3 } | { f }"





General Observations:

:!: You'll want to do filebot -rename *.mkv to call filebot once with many file arguments, instead of calling filebot many times once for each file.

:!: There's a straggling , between -r and --format. I'd remove that.

:!: You're using $1 and ! inside a "..." which means the shell replace the $1 variable with some value, or nothing, before calling filebot. Same thing with ! history expansion. See Cmdline and Argument Passing › Escape Arguments for details. The easy solution for this class of problem is to simply pass along your format via an external text file.



EDIT:

:!: The command posted above notably does not work with zsh nor bash due to all the special characters, so you definitely want to pass along your format via an external text file to avoid that can of worms all together:

Code: Select all

zsh: parse error near `)'

Code: Select all

bash: !? ... event not found
:idea: Please read the FAQ and How to Request Help.
Post Reply