Page 1 of 1

Invalid usage: use either script parameters [dir:/b] or file arguments [/a] but not both

Posted: 03 Oct 2022, 16:32
by p11ps
Hey,

I've been following the steps in the threads below:

[*] qBittorrent setup: viewtopic.php?p=9774#p9774
[*] Plex naming schemes: viewtopic.php?t=4116

What I built then is the command below:

Code: Select all

/usr/bin/filebot -script 'fn:amc' /mnt/downloads --output /mnt/media --action duplicate -non-strict --conflict auto --lang es --log all --log-file '/root/.filebot/logs/amc_execution.log' --def 'music=y' 'unsorted=y' 'deleteAfterExtract=y' 'pushbullet=KEY' 'plex=HOST:TOKEN' 'seriesFormat=tv/{plex.tail}' 'movieFormat=movies/{ ~plex % {" by $director"} % {" [$vf, $vc, $ac]"} % { " [edition-${tags[0]}]" } }' 'unsortedFormat=Unsorted/{fn}' 'excludeList=/root/.filebot/.excludes' 'minFileSize=0' 'minLengthMS=0' 
Everything worked quite well in CLI, as expected. Problem is when I execute the same command from qBittorrent when a download ends. What I tried was:

Code: Select all

- /usr/bin/filebot -script 'fn:amc' /mnt/downloads --output /mnt/media --action duplicate -non-strict --conflict auto --lang es --log all --log-file '/root/.filebot/logs/amc_execution.log' --def 'music=y' 'unsorted=y' 'deleteAfterExtract=y' 'pushbullet=KEY' 'plex=HOST:TOKEN' 'seriesFormat=tv/{plex.tail}' 'movieFormat=movies/{ ~plex % {" by $director"} % {" [$vf, $vc, $ac]"} % { " [edition-${tags[0]}]" } }' 'unsortedFormat=Unsorted/{fn}' 'excludeList=/root/.filebot/.excludes' 'minFileSize=0' 'minLengthMS=0' "ut_label=%L" "ut_title=%N" "ut_kind=multi" "ut_dir=%F"

- /usr/bin/filebot @/root/.filebot/scripts/args.txt --def "ut_label=%L" "ut_title=%N" "ut_kind=multi" "ut_dir=%F"

- /usr/bin/filebot @/root/.filebot/scripts/args.txt "ut_label=%L" "ut_title=%N" "ut_kind=multi" "ut_dir=%F"

args.txt contains the values below:

Code: Select all

-script
fn:amc
/mnt/downloads
--output
/mnt/media
--action
duplicate
-non-strict
--conflict
auto
--lang
es
--log
all
--def
music=y
unsorted=y
deleteAfterExtract=y
pushbullet=KEY
plex=HOST:TOKEN
seriesFormat=tv/{plex.tail}
movieFormat=movies/{ ~plex % {" by $director"} % {" [$vf, $vc, $ac]"} % { " [edition-${tags[0]}]" } }
unsortedFormat=Unsorted/{fn}
excludeList=/root/.filebot/.excludes
minFileSize=0
minLengthMS=0
None of the three options worked. Output is the same for all the qBittorrent execs:

Code: Select all

Bad system encoding: ANSI_X3.4-1968
Invalid usage: use either script parameters [label:TV, title:La tierra de los muertos vivientes (2005) (Unrated Director's Cut) [BDRip 1080p x264 DTS 5.1].mkv, kind:multi, dir:/mnt/downloads/La tierra de los muertos vivientes (2005) (Unrated Director's Cut) [BDRip 1080p x264 DTS 5.1].mkv] or file arguments [/mnt/downloads] but not both
Bad system encoding: ANSI_X3.4-1968
Invalid usage: use either script parameters [label:movies, title:Suavemente me mata (2002) [BDrip 720p x264 Dual AC3 Subs].mkv, kind:multi, dir:/mnt/downloads/Suavemente me mata (2002) [BDrip 720p x264 Dual AC3 Subs].mkv] or file arguments [/mnt/downloads] but not both
I can't find what's the issue here. Could you please suggest me something?

Thank you!

Re: fn:amc works on CLI but no in qBittorrent

Posted: 03 Oct 2022, 16:50
by rednoah
The error message is quite clear:

Code: Select all

Invalid usage: use either script parameters [label:TV, title:La tierra de los muertos vivientes (2005) (Unrated Director's Cut) [BDRip 1080p x264 DTS 5.1].mkv, kind:multi, dir:/mnt/downloads/La tierra de los muertos vivientes (2005) (Unrated Director's Cut) [BDRip 1080p x264 DTS 5.1].mkv] or file arguments [/mnt/downloads] but not both
You are passing in /mnt/downloads as input argument, and then you also pass in --def ut_dir="/mnt/downloads/La tierra de los muertos vivientes (2005) (Unrated Director's Cut) [BDRip 1080p x264 DTS 5.1].mkv" as input argument as well. You'll want to remove the /mnt/downloads input argument from the command-line, since we don't want to process everything in that folder. We only want to process the newly downloaded files.



e.g. qBT usage:

Code: Select all

filebot -script fn:amc ... --def "ut_label=%L" "ut_title=%N" "ut_kind=multi" "ut_dir=%F"
:idea: This is a template for a command. A real command will be generated and executed by qBT by replacing the %variables with real values specific to the newly completed download.


:!: If you want to do a test run manually, then you need to do what qBT does, i.e. replace the variables and then make the call:

Code: Select all

filebot -script fn:amc ... --def "ut_label=TV" "ut_title=La tierra de los muertos vivientes (2005) (Unrated Director's Cut) [BDRip 1080p x264 DTS 5.1].mkv" "ut_kind=multi" "ut_dir=/mnt/downloads/La tierra de los muertos vivientes (2005) (Unrated Director's Cut) [BDRip 1080p x264 DTS 5.1].mkv"


e.g. command-line usage:

Code: Select all

filebot -script fn:amc ... /input
:idea: This is a real command, executed by the shell as is. Notice the lack of %variables.





A simple test run will give you the same error:

Code: Select all

filebot -script fn:amc /a --def ut_dir="/b" --output .
...
Invalid usage: use either script parameters [dir:/b] or file arguments [/a] but not both
(This is why it complains about conflicting input arguments when called by qBT, or when called manually correctly with %variables replaced)

But if you pass --def ut_dir="%D" verbatim then the option will be ignored as if it wasn't specified in the first place, thus only leaving one set of input arguments, thus resolving the conflict, though you will still get error messages:

Code: Select all

filebot -script fn:amc /a --def ut_dir="%D" --output .
...
Bad ut_dir value: %D
...
(This is why you accidentally manage to process your entire /mnt/downloads folder when you manually call the command without replacing the %variables first)





:!: If you want to process non-ASCII file paths, then you need to configure your locale settings, otherwise FileBot will be configured to use ASCII-only encoding file file paths and fail if you every encounter unicode file paths:

Code: Select all

Bad system encoding: ANSI_X3.4-1968

Re: fn:amc works on CLI but no in qBittorrent

Posted: 03 Oct 2022, 17:26
by p11ps
Omg :roll: , you're absolutely right. Problem was that. I've removed the path from the args.txt file, as below:

Code: Select all

-script
fn:amc
--output
/mnt/media
--action
duplicate
-non-strict
--conflict
auto
--lang
es
--log
all
--def
music=y
unsorted=y
deleteAfterExtract=y
pushbullet=KEY
plex=HOST:TOKEN
seriesFormat=tv/{plex.tail}
movieFormat=movies/{ ~plex % {" by $director"} % {" [$vf, $vc, $ac]"} % { " [edition-${tags[0]}]" } }
unsortedFormat=Unsorted/{fn}
excludeList=/root/.filebot/.excludes
minFileSize=0
minLengthMS=0
Then, in qBt, I replaced the old command for the one below and it worked flawlessly:

Code: Select all

/usr/bin/filebot @/root/.filebot/scripts/args.txt --def "ut_label=%L" "ut_title=%N" "ut_kind=multi" "ut_dir=%F"
As always, thank you!