Need Help for Certification

All about user-defined episode / movie / file name format expressions
Post Reply
LovelyFr
Posts: 4
Joined: 01 May 2016, 19:12

Need Help for Certification

Post by LovelyFr »

Hi guys im new here and i need some help for a renaming situation

i need to rename my movie and i cant figure out how to do what i want ...

my renaming is this

Code: Select all

F:/Films En Francais/{collection}/{n.upperInitial().replaceAll(/[:?]+/)} ({y}) [{fn.match(/3D/)+'3D'}{fn =~ /H-SBS/ ? '3D' : ''}{fn =~ /TB/ ? '3D' : ''} {sdhd} {vf}, {vc}, {ac}, {af}] {(any{audios.language}{fn.space('.').upper().matchAll(/(?<=\bTRUE?|\b)FR(?=ENCH\b|\b)|\bEN(?=GLISH\b|\b)|\bSPA(?=NISH\b|\b)|\bVF(?=I\b|F\b|\b)/, 0)}{[]}).flatten()*.upper().flatten()*.replaceAll('VF', 'FR').unique() ?: null} {fn =~ /VFQ/ ? '[VFQ]' : ''} {fn =~ /H-SBS/ ? '.H-SBS' : ''}{fn =~ /TB/ ? '.TB' : ''}
witch work GREATTTTT

but now i need to had something
i need to had that IF the {certification} is PG that it create a rep PG, before the collection
but i don't understand how to make the {certification} use just the PG

Code: Select all

F:/Films En Francais/{certification}/{collection}/{n.upperInitial().replaceAll(/[:?]+/)} ({y}) [{fn.match(/3D/)+'3D'}{fn =~ /H-SBS/ ? '3D' : ''}{fn =~ /TB/ ? '3D' : ''} {sdhd} {vf}, {vc}, {ac}, {af}] {(any{audios.language}{fn.space('.').upper().matchAll(/(?<=\bTRUE?|\b)FR(?=ENCH\b|\b)|\bEN(?=GLISH\b|\b)|\bSPA(?=NISH\b|\b)|\bVF(?=I\b|F\b|\b)/, 0)}{[]}).flatten()*.upper().flatten()*.replaceAll('VF', 'FR').unique() ?: null} {fn =~ /VFQ/ ? '[VFQ]' : ''} {fn =~ /H-SBS/ ? '.H-SBS' : ''}{fn =~ /TB/ ? '.TB' : ''}
here to be more precise
.... En Francais/{certification}/{collection}/.....
anyone can help me please ???
User avatar
rednoah
The Source
Posts: 23936
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need Help for Certification

Post by rednoah »

You can use if-then-else in your expression. Just keep in mind the unwind-on-undefined behaviour if certification is undefined.
:idea: Please read the FAQ and How to Request Help.
LovelyFr
Posts: 4
Joined: 01 May 2016, 19:12

Re: Need Help for Certification

Post by LovelyFr »

i have absolutly no experience with coding with those kind of stuff so i understand the if then else but have no idea how to apply them on the small code that i want

but thanks anyway :)
User avatar
rednoah
The Source
Posts: 23936
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need Help for Certification

Post by rednoah »

I'm not actually sure what you're trying to achieve. Maybe you could get me a few examples? How is what you already have not working as you'd like it?
:idea: Please read the FAQ and How to Request Help.
LovelyFr
Posts: 4
Joined: 01 May 2016, 19:12

Re: Need Help for Certification

Post by LovelyFr »

my code for the moment is

Code: Select all

F:/Films En Francais/{collection}/{n.upperInitial().replaceAll(/[:?]+/)} ({y}) [{fn.match(/3D/)+'3D'}{fn =~ /H-SBS/ ? '3D' : ''}{fn =~ /TB/ ? '3D' : ''} {sdhd} {vf}, {vc}, {ac}, {af}] {(any{audios.language}{fn.space('.').upper().matchAll(/(?<=\bTRUE?|\b)FR(?=ENCH\b|\b)|\bEN(?=GLISH\b|\b)|\bSPA(?=NISH\b|\b)|\bVF(?=I\b|F\b|\b)/, 0)}{[]}).flatten()*.upper().flatten()*.replaceAll('VF', 'FR').unique() ?: null} {fn =~ /VFQ/ ? '[VFQ]' : ''} {fn =~ /H-SBS/ ? '.H-SBS' : ''}{fn =~ /TB/ ? '.TB' : ''}
and it work great i love it

but i would like to add before the /{collection}/
i would like to

if {certification} is "PG" then that will add another repertoire name PG before collection
but if the certification is anything else it's stay where it is (witch is ine films en francais (that mean french movie LOL)

my niece just watch american pie naked mile without us knowing and she is 7 years old LOLLL so i want to make a specific folrder for my PG but with the renaming automatic cause i have more than 1400 movie LOL

i understant the IF THEN ELSE but i don't know i to "code" in between the {certification} braquet
User avatar
rednoah
The Source
Posts: 23936
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need Help for Certification

Post by rednoah »

Try this:

Code: Select all

{certification == /PG/ ? 'Children' : 'Adults'}
:idea: Please read the FAQ and How to Request Help.
LovelyFr
Posts: 4
Joined: 01 May 2016, 19:12

Re: Need Help for Certification

Post by LovelyFr »

Thank You rednoah it work great :)
:)
nevil
Posts: 10
Joined: 08 Jun 2016, 20:06

Re: Need Help for Certification

Post by nevil »

I am trying to do the same thing with Linux.

My script:

filebot -script fn:amc --output "/media/drive2/testout" --action copy -non-strict "/media/drive2/testin" --log-file amc.log --def "movieFormat=movies/{certification == /PG/ ? 'Children' : 'Adults’}/{n} ({y})/{n} ({y})" --def excludeList=amc.txt

But I am receiving the following error:

Run script [fn:amc] at [Wed Jun 08 16:04:02 EDT 2016]
Parameter: movieFormat = movies/{certification == /PG/ ? 'Children' : 'Adults’}/{n} ({y})/{n} ({y})
Parameter: excludeList = amc.txt
Argument: /media/drive2/testin
Creating excludes: /media/drive2/testout/amc.txt
Input: /media/drive2/testin/Barbie Fairytopia Mermaidia (2006)/Barbie Fairytopia Mermaidia (2006).avi
Input: /media/drive2/testin/Barbie in A Mermaid Tale (2010)/Barbie in A Mermaid Tale (2010).avi
Input: /media/drive2/testin/Barbie in A Mermaid Tale 2 (2012)/Barbie in A Mermaid Tale 2 (2012).avi
Input: /media/drive2/testin/X-Men Apocalypse (2016)/X-Men Apocalypse (2016).mkv
Group: [mov:barbie fairytopia mermaidia 2006] => [Barbie Fairytopia Mermaidia (2006).avi]
Group: [mov:barbie in a mermaid tale 2010] => [Barbie in A Mermaid Tale (2010).avi]
Group: [mov:barbie in a mermaid tale 2 2012] => [Barbie in A Mermaid Tale 2 (2012).avi]
Group: [mov:x men apocalypse 2016] => [X-Men Apocalypse (2016).mkv]
SyntaxError: expecting ''', found '<EOF>'
javax.script.ScriptException: SyntaxError: expecting ''', found '<EOF>'
at net.filebot.format.ExpressionFormat.compile(ExpressionFormat.java:117)
at net.filebot.format.ExpressionFormat.<init>(ExpressionFormat.java:75)
at net.filebot.cli.CmdlineOperations.rename(CmdlineOperations.java:97)
at net.filebot.cli.ScriptShellBaseClass.rename(ScriptShellBaseClass.java:336)
at Script1$_run_closure72.doCall(Script1.groovy:398)
at Script1.run(Script1.groovy:356)
at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:62)
at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:72)
at net.filebot.cli.ArgumentProcessor.runScript(ArgumentProcessor.java:114)
at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:29)
at net.filebot.Main.main(Main.java:120)
SyntaxError: expecting ''', found '<EOF>'
javax.script.ScriptException: SyntaxError: expecting ''', found '<EOF>'
at net.filebot.format.ExpressionFormat.compile(ExpressionFormat.java:117)
at net.filebot.format.ExpressionFormat.<init>(ExpressionFormat.java:75)
at net.filebot.cli.CmdlineOperations.rename(CmdlineOperations.java:97)
at net.filebot.cli.ScriptShellBaseClass.rename(ScriptShellBaseClass.java:336)
at Script1$_run_closure72.doCall(Script1.groovy:398)
at Script1.run(Script1.groovy:356)
at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:62)
at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:72)
at net.filebot.cli.ArgumentProcessor.runScript(ArgumentProcessor.java:114)
at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:29)
at net.filebot.Main.main(Main.java:120)
SyntaxError: expecting ''', found '<EOF>'
javax.script.ScriptException: SyntaxError: expecting ''', found '<EOF>'
at net.filebot.format.ExpressionFormat.compile(ExpressionFormat.java:117)
at net.filebot.format.ExpressionFormat.<init>(ExpressionFormat.java:75)
at net.filebot.cli.CmdlineOperations.rename(CmdlineOperations.java:97)
at net.filebot.cli.ScriptShellBaseClass.rename(ScriptShellBaseClass.java:336)
at Script1$_run_closure72.doCall(Script1.groovy:398)
at Script1.run(Script1.groovy:356)
at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:62)
at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:72)
at net.filebot.cli.ArgumentProcessor.runScript(ArgumentProcessor.java:114)
at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:29)
at net.filebot.Main.main(Main.java:120)
SyntaxError: expecting ''', found '<EOF>'
javax.script.ScriptException: SyntaxError: expecting ''', found '<EOF>'
at net.filebot.format.ExpressionFormat.compile(ExpressionFormat.java:117)
at net.filebot.format.ExpressionFormat.<init>(ExpressionFormat.java:75)
at net.filebot.cli.CmdlineOperations.rename(CmdlineOperations.java:97)
at net.filebot.cli.ScriptShellBaseClass.rename(ScriptShellBaseClass.java:336)
at Script1$_run_closure72.doCall(Script1.groovy:398)
at Script1.run(Script1.groovy:356)
at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:62)
at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:72)
at net.filebot.cli.ArgumentProcessor.runScript(ArgumentProcessor.java:114)
at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:29)
at net.filebot.Main.main(Main.java:120)
Finished without processing any files
Failure (°_°)
nevil
Posts: 10
Joined: 08 Jun 2016, 20:06

Re: Need Help for Certification

Post by nevil »

I will re-work the directory structure after the test works correctly but the goal is:


All kids movies goto:

/media/drive2/kidsmovies

All other movies goto:

/media/drive2/movies


In my current script, I was just testing and wanted to see it actually would separate the kids and adult movies into separate folders.
User avatar
rednoah
The Source
Posts: 23936
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need Help for Certification

Post by rednoah »

Don't use characters that aren't on the keyboard. The first 3 ' are proper, how did you screw up the last one? Seriously, I'm curious! :D

' ... YES
’ ... NO

PS: Use the GUI to prototype your format. ;)
:idea: Please read the FAQ and How to Request Help.
nevil
Posts: 10
Joined: 08 Jun 2016, 20:06

Re: Need Help for Certification

Post by nevil »

Not sure what you mean? What characters are not on the keyboard?
nevil
Posts: 10
Joined: 08 Jun 2016, 20:06

Re: Need Help for Certification

Post by nevil »

rednoah wrote:Don't use characters that aren't on the keyboard. The first 3 ' are proper, how did you screw up the last one? Seriously, I'm curious! :D

' ... YES
’ ... NO

PS: Use the GUI to prototype your format. ;)

I just noticed that typo in my script. Not sure how that happened I actually copy and pasted.
nevil
Posts: 10
Joined: 08 Jun 2016, 20:06

Re: Need Help for Certification

Post by nevil »

It actually processed once I changed this ’ into this ' - seriously I did not type that, only copy and pasted, so weird...

I am using a headless linux server, what GUI should I use to prototype the format?

How could I learn more about what this {certification == /PG/ ? 'Children' : 'Adults’} actually means. I am assuming that:

If certification equals PG then place into Children, otherwise place in Adults.

If I wanted it to be PG & G then would it be certification ==/PG/G ? 'Children' : 'Adults'?

Where can I learn more?
User avatar
rednoah
The Source
Posts: 23936
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need Help for Certification

Post by rednoah »

1.
Maybe some weird auto-correction. Usually people come up with strange "..." when they "code" in MS Word...


2.
It's all Groovy code, so you can learn how it works by learning Groovy basics:
http://groovy-lang.org/syntax.html#_slashy_string


You want a condition such as this:

Code: Select all

certification in ['PG', 'G']
Using a regex is probably easier on the keyboard though:

Code: Select all

certification ==~ 'PG|G'

PS: I often use /.../ instead of '...' because that way I don't have to worry about command-line escaping, but it's just two different ways of defining a String value.
:idea: Please read the FAQ and How to Request Help.
nevil
Posts: 10
Joined: 08 Jun 2016, 20:06

Re: Need Help for Certification

Post by nevil »

For some reason when I execute with this script,

Code: Select all

filebot -script fn:amc --output "$CONFIG_OUTPUT" --action duplicate --conflict auto -non-strict --log-file amc.log --def unsorted=y  --def "seriesFormat=tvshows/{n}/Season {s}/{n} - {s00e00} - {t}" "movieFormat={certification == /G/ ? 'kids' : 'movies'}/{n} ({y})/{n} ({y})" excludeList=".excludes" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL"
The moves that are G rated end up in Unsorted.

However if I use:

Code: Select all

filebot -script fn:amc --output "$CONFIG_OUTPUT" --action duplicate --conflict auto -non-strict --log-file amc.log --def unsorted=y  --def "seriesFormat=tvshows/{n}/Season {s}/{n} - {s00e00} - {t}" "movieFormat=movies/{n} ({y})/{n} ({y})" excludeList=".excludes" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL"
All files end up in the dir movies.
nevil
Posts: 10
Joined: 08 Jun 2016, 20:06

Re: Need Help for Certification

Post by nevil »

Reward for fix.
User avatar
rednoah
The Source
Posts: 23936
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need Help for Certification

Post by rednoah »

Logs?
:idea: Please read the FAQ and How to Request Help.
nevil
Posts: 10
Joined: 08 Jun 2016, 20:06

Re: Need Help for Certification

Post by nevil »

Solved! I checked the logs and noticed permission denied. Changed the folder permission settings for 'kids' and all is working now! Thanks again!
Post Reply