--def seriesformat question

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
User avatar
ashfallen0
Power User
Posts: 32
Joined: 14 Jan 2012, 10:44

--def seriesformat question

Post by ashfallen0 »

I can't quite understand why my automated output breaks when I use some formatting that I use when manually using filebot gui. This is my TV format through the GUI:

Code: Select all

G:/clean/TV/{n.replaceAll(":", replacement = " - ")}/{n.replaceAll(":", replacement = " - ")} - {'S'+s.pad(2)}E{e.pad(2)} - {t} [{hpi}][{resolution} {vc}-{ac}]
Which works fine. When I use that same input block through the groovyscript, nothing happens.

Code: Select all

filebot -script svn:amc --output "G:/clean" --action move --conflict override -non-strict --def "seriesFormat=TV/{n.replaceAll(":", replacement = " - ")}/{n.replaceAll(":", replacement = " - ")} - {'S'+s.pad(2)}E{e.pad(2)} - {t} [{hpi}][{resolution} {vc}-{ac}]" "animeFormat=Anime/{n.replaceAll(":", replacement = " - ")}/{n.replaceAll(":", replacement = " - ")} - {'S'+(episode.season ? s : 1).pad(2)}E{e.pad(2)} - {t} [{hpi}][{resolution} {vc}-{ac}]" "movieFormat=Movies/{n.replaceAll(":", replacement = " - ")}/{n.replaceAll(":", replacement = " - ")} - ({y}) - [{hpi}][{resolution} {vc}-{ac}]" "musicFormat=Music/{n}/{fn}" --def music=y subtitles=en artwork=y --def clean=y "ut_dir=%D" "ut_file=%F" "ut_kind=%K" "ut_title=%N" "ut_label=%L" "ut_state=%S"
I ran the output in the utorrent log and I get an error of: invalid command "-"
I've had to change my option line to :

Code: Select all

filebot -script svn:amc --output "G:/clean" --action move --conflict override -non-strict --def "seriesFormat=TV/{n}/{n} - {'S'+s.pad(2)}E{e.pad(2)} - {t} [{hpi}][{resolution} {vc}-{ac}]" "animeFormat=Anime/{n}/{n} - {'S'+(episode.season ? s : 1).pad(2)}E{e.pad(2)} - {t} [{hpi}][{resolution} {vc}-{ac}]" "movieFormat=Movies/{n}/{n} - ({y}) - [{hpi}][{resolution} {vc}-{ac}]" "musicFormat=Music/{n}/{fn}" --def music=y subtitles=en artwork=y --def clean=y "ut_dir=%D" "ut_file=%F" "ut_kind=%K" "ut_title=%N" "ut_label=%L" "ut_state=%S"
Then it runs normally. I guess besides why does this happen, does the amc script take care of validation cases already so that colons and wildcards get dropped?
Image PHPBB3 hates me.
User avatar
rednoah
The Source
Posts: 19149
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: --def seriesformat question

Post by rednoah »

Check my setup instructions and pay attention to the parts written in BIG RED LETTERS. ;)
:idea: Please read the FAQ and How to Request Help.
User avatar
ashfallen0
Power User
Posts: 32
Joined: 14 Jan 2012, 10:44

Re: --def seriesformat question

Post by ashfallen0 »

rednoah wrote:Check my setup instructions and pay attention to the parts written in BIG RED LETTERS. ;)
I know, RTFM and all that. I have done so, several times in fact, but I have to plead codeblindness in this case. I know the issue lies in:

Code: Select all

{n.replaceAll(":", replacement = " - ")}
If you would be so kind as to just point out what it is I'm missing please?
Image PHPBB3 hates me.
User avatar
rednoah
The Source
Posts: 19149
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: --def seriesformat question

Post by rednoah »

What do you think happens when you pass in something like this? "..."..."..." How does the cmd know where the arguments starts and where it ends? It doesn't.

This is how you pass in literal " without messing yup cmd argument tokenizer:

Code: Select all

"...\"...\"..."
It's plenty documented in FAQ and setup instructions. It's just how passing arguments works in the cmd. Has nothing to do with FileBot actually.
:idea: Please read the FAQ and How to Request Help.
User avatar
ashfallen0
Power User
Posts: 32
Joined: 14 Jan 2012, 10:44

Re: --def seriesformat question

Post by ashfallen0 »

rednoah wrote:What do you think happens when you pass in something like this? "..."..."..." How does the cmd know where the arguments starts and where it ends? It doesn't.

This is how you pass in literal " without messing yup cmd argument tokenizer:

Code: Select all

"...\"...\"..."
It's plenty documented in FAQ and setup instructions. It's just how passing arguments works in the cmd. Has nothing to do with FileBot actually.
ok, I was looking at that section about escaping the " " with a \. That's why I was asking for the help on that specific bit. Looking at the working version of my utorrent line, not every set of double quotes is escaped, but it works nonetheless. eg:
filebot -script svn:amc --output "G:/clean" --action move --conflict override -non-strict --def "seriesFormat=TV/{n}/{n} - {'S'+s.pad(2)}E{e.pad(2)} - {t} [{hpi}][{resolution} {vc}-{ac}]" "animeFormat=Anime/{n}/{n} - {'S'+(episode.season ? s : 1).pad(2)}E{e.pad(2)} - {t} [{hpi}][{resolution} {vc}-{ac}]" "movieFormat=Movies/{n}/{n} - ({y}) - [{hpi}][{resolution} {vc}-{ac}]" "musicFormat=Music/{n}/{fn}" --def music=y subtitles=en artwork=y --def clean=y "ut_dir=%D" "ut_file=%F" "ut_kind=%K" "ut_title=%N" "ut_label=%L" "ut_state=%S"

Red text for emphais. I'm going to assume that you meant any double quotes INSIDE of a function need to be escaped, so I've changed that bit to

Code: Select all

{n.replaceAll(":\", replacement = " - \")}
. I'm waiting for tonight's tv to download so I can check whether or not that works properly.
Image PHPBB3 hates me.
User avatar
rednoah
The Source
Posts: 19149
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: --def seriesformat question

Post by rednoah »

No, it has NOTHING to do with functions. It's all just how the command splits a line of text into arguments.

You need to tell the cmd to pass quotes on to FileBot? Then it needs to be escaped.

This

Code: Select all

"{n.replaceAll(\":\", replacement = \" - \")}"
will pass on

Code: Select all

{n.replaceAll(":", replacement = " - ")}
as single argument.
:idea: Please read the FAQ and How to Request Help.
User avatar
ashfallen0
Power User
Posts: 32
Joined: 14 Jan 2012, 10:44

Re: --def seriesformat question

Post by ashfallen0 »

Command line output of that \.

Code: Select all

C:\Documents and Settings\Ash>filebot -script svn:amc --output "G:/clean" --acti
on move --conflict override -non-strict --def "seriesFormat=TV/{n}/{n.replaceAll
(":\", replacement = " - \")} - {'S'+s.pad(2)}E{e.pad(2)} - {t} [{hpi}][{resolut
ion} {vc}-{ac}]" "animeFormat=Anime/{n}/{n} - {'S'+(episode.season ? s : 1).pad(
2)}E{e.pad(2)} - {t} [{hpi}][{resolution} {vc}-{ac}]" "movieFormat=Movies/{n}/{n
} - ({y}) - [{hpi}][{resolution} {vc}-{ac}]" "musicFormat=Music/{n}/{fn}" --def
music=y subtitles=en artwork=y --def clean=y "ut_dir=G:\downloads" "ut_file=The.
Daily.Show.2013.03.05.Sandra.Day.OConnor.HDTV.x264-FQM.mp4" "ut_kind=single" "ut
_title=The.Daily.Show.2013.03.05.Sandra.Day.OConnor.HDTV.x264-FQM.mp4" "ut_label
=TV" "ut_state=5"
Mar 06, 2013 8:58:54 PM net.sourceforge.filebot.cli.ArgumentBean getFiles
WARNING: Invalid argument
Parameter: seriesFormat = TV/{n}/{n.replaceAll(:",
Parameter: music = y
Parameter: subtitles = en
Parameter: artwork = y
Parameter: clean = y
Parameter: ut_dir = G:\downloads
Parameter: ut_file = The.Daily.Show.2013.03.05.Sandra.Day.OConnor.HDTV.x264-FQM.
mp4
Parameter: ut_kind = single
Parameter: ut_title = The.Daily.Show.2013.03.05.Sandra.Day.OConnor.HDTV.x264-FQM
.mp4
Parameter: ut_label = TV
Parameter: ut_state = 5
Argument: C:\Documents and Settings\Ash\replacement
Argument: C:\Documents and Settings\Ash\=
Argument: C:\Documents and Settings\Ash\ - ")} - {'S'+s.pad(2)}E{e.pad(2)} - {t}
 [{hpi}][{resolution} {vc}-{ac}]
Argument: C:\Documents and Settings\Ash\animeFormat=Anime\{n}\{n} - {'S'+(episod
e.season ? s : 1).pad(2)}E{e.pad(2)} - {t} [{hpi}][{resolution} {vc}-{ac}]
Argument: C:\Documents and Settings\Ash\movieFormat=Movies\{n}\{n} - ({y}) - [{h
pi}][{resolution} {vc}-{ac}]
Argument: C:\Documents and Settings\Ash\musicFormat=Music\{n}\{fn}
Exception: File not found: C:\Documents and Settings\Ash\replacement
java.lang.Exception: File not found: C:\Documents and Settings\Ash\replacement
        at Script3$_run_closure4.doCall(Script3.groovy:8)
        at Script3.run(Script3.groovy:8)
        at net.sourceforge.filebot.cli.ScriptShell.evaluate(Unknown Source)
        at net.sourceforge.filebot.cli.ScriptShell.runScript(Unknown Source)
        at net.sourceforge.filebot.cli.ArgumentProcessor.process(Unknown Source)

        at net.sourceforge.filebot.Main.main(Unknown Source)
Failure (░_░)
Image PHPBB3 hates me.
User avatar
rednoah
The Source
Posts: 19149
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: --def seriesformat question

Post by rednoah »

Still not passing in arguments correctly... I don't know how to reply expect copy my last post again... It works exactly as I explained in great detail. FileBot works perfectly, you just haven't quite figured out how cmd works. Play with it, you'll figure it out. ;)
:idea: Please read the FAQ and How to Request Help.
User avatar
ashfallen0
Power User
Posts: 32
Joined: 14 Jan 2012, 10:44

Re: --def seriesformat question

Post by ashfallen0 »

Sorry about the cmd output, I didn't see your reply before I posted that up. It works now. I even understand it.
Image PHPBB3 hates me.
Post Reply