Thanks Red!
Uhh, I know what 420 means but not "402". Hope it's not the mark of the devil.
I used your hint to solve the issue! I will elaborate here. Hope this helps others on macOS Catalina using qBittorrent 4.3.3
I replaced my filebot code at "
Run external program on torrent completion" with a shell script by adding the path to the script and a list of the parameters (which qBittorrent passes to the script when the torrent is completed - cool)
Code: Select all
/Users/john/Documents/Shell_Scripts/MyFileBot_Script.sh "%N" "%L" "%G" "%F" "%R" "%D" "%C" "%Z" "%T" "%I"
qBittorrent passes supported parameters as positional arguments.
${1} = %N: Torrent name
${2} = %L: Category
${3} = %G: Tags (separated by comma)
${4} = %F: Content path (same as root path for multi file torrent)
${5} = %R: Root path (first torrent subdirectory path)
${6} = %D: Save path
${7} = %C: Number of files
${8} = %Z: Torrent size (bytes)
${9} = %T: Current tracker
${10} = %I: Info hash
A few things tripped me up.
1.
Having more than 9 arguments in a shell script caused an issue.
We need to use
{} for the 10th argument or it will be treated as the value of
$1 and then a
0 following, not
$10. So curly brackets on all arguments is advised in the shell script.
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
2. When there is no value for a torrent's parameter, for me it was
"%G" for tags, qBittorrent doesn't reliably pass "
null" to the argument — it skips over it, which causes the rest of the arguments' values to be off by 1 position. I still have not figured out how to solve this one.
![Question :?:](./images/smilies/icon_question.gif)
When using
--def seriesFormat and
--def movieFormat what is the purpose of "ut_kind=multi"? Or maybe what is its purpose
in all cases is the better question. Should we change that to the kind of file it is "movie" or "series" when we are defining?
For this script to work I had to modify my paths because they were failing as originally entered. I needed to add a
"/" before {plex.derive.... when using parameter
"%F" aka
"ut_dir"=${4}
Code: Select all
--def seriesFormat="/Volumes/SeedDrive/PlexServer_2/{plex.derive{' {thetvdb-'}{id}{'}'}{' - ['+allOf{tags}{vf}{vs}{crc32}.join(' ')}{']'}}{if (dc > 1) '.'+di}" "ut_dir=${4}" "ut_kind=multi" "ut_title=${1}" "ut_label=${2}"
Code: Select all
--def movieFormat="/Volumes/PlexMedia/PlexServer_1/plex.derive{' {imdb-'}{imdbid}{'}'}{' ['+allOf{tags}{audio.language}{if ('Documentary' in genres)'[doc]'}{info:video[0].displayAspectRatioString.colon('"∶"').replace('?', '')}{ws}{vf}{vs}{vc}{crc32}.join(' ')}{']'}}{if (dc > 1) '.'+di}" "ut_dir=${4}" "ut_kind=multi" "ut_title=${1}" "ut_label=${2}"
And I kept
--output "/Volumes/PlexMedia/PlexServer_1"