qBittorrent parameters change causing issues

Support for macOS users
Post Reply
jprokos
Posts: 173
Joined: 09 Oct 2016, 02:01

qBittorrent parameters change causing issues

Post by jprokos »

I filed an issue over 18 months ago and the "fixed" it in qBittorrent master. I am running the master.

Now all of my positional parameters, which are quoted as required in qBittorrent, are coming into FileBot double quoted and FileBot is angry about it.
Removing the quotes around the parameters in qBittorrent doesn't work, making them single quotes doesn't work. Removing the double quotes around the parameters in my bash script doesn't fix it.

:?: Any ideas?

Not just that but there is a weird path issue that I can't figure out at this line: "File does not exist: ...."

Code: Select all

2022-08-02 19:54:30.553] Run script [fn:amc] at [Tue Aug 02 19:54:30 CDT 2022]
[2022-08-02 19:54:30.573] Parameter: minFileSize = 10000000
[2022-08-02 19:54:30.574] Parameter: minLengthMS = 300000
[2022-08-02 19:54:30.574] Parameter: ut_kind = multi
[2022-08-02 19:54:30.574] Parameter: ut_title = "BBC.Proms.2022.Sir.Mark.Elder.and.the.Halle.Play.Puccini.1080p.HDTV.x265.AAC.MVGroup.mkv"
[2022-08-02 19:54:30.574] Parameter: ut_label = "TV_Shows"
[2022-08-02 19:54:30.574] Parameter: ut_dir = "/Volumes/SeedDrive/complete/BBC.Proms.2022.Sir.Mark.Elder.and.the.Halle.Play.Puccini.1080p.HDTV.x265.AAC.MVGroup.Forum.mkv"
[2022-08-02 19:54:30.574] Parameter: ut_rpath = ""
[2022-08-02 19:54:30.574] Parameter: ut_spath = "/Volumes/SeedDrive/complete"
[2022-08-02 19:54:30.575] Parameter: ut_files = "1"
[2022-08-02 19:54:30.575] Parameter: ut_bytes = "1583957633"
[2022-08-02 19:54:30.575] Parameter: ut_track = "udp://9.rarbg.me:2780"
[2022-08-02 19:54:30.575] Parameter: ut_info = "aa7280d87033ce65cfba05e76e4ade32f4b65fa1"
[2022-08-02 19:54:30.575] Parameter: ut_tags = ""
[2022-08-02 19:54:30.575] Parameter: excludeList = /Users/john/.filebot/amc_excludes.txt
[2022-08-02 19:54:30.576] Parameter: pushover = *****
[2022-08-02 19:54:30.576] Parameter: unsorted = y
[2022-08-02 19:54:30.576] Parameter: music = y
[2022-08-02 19:54:30.576] Parameter: skipExtract = y
[2022-08-02 19:54:30.577] Parameter: movieDB = TheMovieDB
[2022-08-02 19:54:30.577] Parameter: seriesDB = TheTVDB
[2022-08-02 19:54:30.577] Parameter: animeDB = AniDB
[2022-08-02 19:54:30.577] Parameter: musicDB = ID3
[2022-08-02 19:54:30.577] Parameter: seriesFormat = /Volumes/PlexMedia/PlexServer_1/{plex.derive{' {thetvdb-'}{id}{'}'}{' - ['+allOf{tags}{vf}{vs}{crc32}.join(' ')}{']'}}{if (dc > 1) '.'+di}
[2022-08-02 19:54:30.578] Parameter: 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}{runtime}{crc32}.join(' ')}{']'}}{if (dc > 1) '.'+di}
[2022-08-02 19:54:30.698] Bad ut_title value: "BBC.Proms.2022.Sir.Mark.Elder.and.the.Halle.Play.Puccini.1080p.HDTV.x265.AAC.MVGroup.mkv"
[2022-08-02 19:54:30.698] Bad ut_label value: "TV_Shows"
[2022-08-02 19:54:30.698] Bad ut_dir value: "/Volumes/SeedDrive/complete/BBC.Proms.2022.Sir.Mark.Elder.and.the.Halle.Play.Puccini.1080p.HDTV.x265.AAC.MVGroup.Forum.mkv"
[2022-08-02 19:54:30.698] Bad ut_rpath value: ""
[2022-08-02 19:54:30.698] Bad ut_spath value: "/Volumes/SeedDrive/complete"
[2022-08-02 19:54:30.699] Bad ut_files value: "1"
[2022-08-02 19:54:30.699] Bad ut_bytes value: "1583957633"
[2022-08-02 19:54:30.699] Bad ut_track value: "udp://9.rarbg.me:2780"
[2022-08-02 19:54:30.699] Bad ut_info value: "aa7280d87033ce65cfba05e76e4ade32f4b65fa1"
[2022-08-02 19:54:30.699] Bad ut_tags value: ""
[2022-08-02 19:54:30.993] Use excludes: /Users/john/.filebot/amc_excludes.txt (5724)
[2022-08-02 19:54:30.995] File does not exist: /"/Volumes/SeedDrive/complete/BBC.Proms.2022.Sir.Mark.Elder.and.the.Halle.Play.Puccini.1080p.HDTV.x265.AAC.MVGroup.Forum.mkv"
[2022-08-02 19:54:30.998] No files selected for processing
[2022-08-02 19:54:30.998] Done ¯\_(ツ)_/¯

This was the result before they applied the commit to qBittorrent master.

Code: Select all

[2022-04-28 01:37:06.860] Run script [fn:amc] at [Thu Apr 28 01:37:06 CDT 2022]
[2022-04-28 01:37:06.881] Parameter: minFileSize = 10000000
[2022-04-28 01:37:06.881] Parameter: minLengthMS = 300000
[2022-04-28 01:37:06.881] Parameter: ut_kind = multi
[2022-04-28 01:37:06.881] Parameter: ut_title = Star.Trek.Picard.S02E09.1080p.WEB.H264-CAKES[rartv]
[2022-04-28 01:37:06.882] Parameter: ut_label = TV Shows
[2022-04-28 01:37:06.882] Parameter: ut_dir = /Volumes/SeedDrive/complete/Star.Trek.Picard.S02E09.1080p.WEB.H264-CAKES[rarbg]
[2022-04-28 01:37:06.882] Parameter: ut_rpath = /Volumes/SeedDrive/complete/Star.Trek.Picard.S02E09.1080p.WEB.H264-CAKES[rarbg]
[2022-04-28 01:37:06.882] Parameter: ut_spath = /Volumes/SeedDrive/complete
[2022-04-28 01:37:06.882] Parameter: ut_files = 4
[2022-04-28 01:37:06.882] Parameter: ut_bytes = 1817499874
[2022-04-28 01:37:06.882] Parameter: ut_track = udp://tracker.thinelephant.org:12710
[2022-04-28 01:37:06.883] Parameter: ut_info = b6cf0e88400965a67dfc81e52e885935493a0d28
[2022-04-28 01:37:06.883] Parameter: ut_tags = 
[2022-04-28 01:37:06.883] Parameter: excludeList = /Users/john/.filebot/amc_excludes.txt
[2022-04-28 01:37:06.883] Parameter: pushover = *****
[2022-04-28 01:37:06.884] Parameter: unsorted = y
[2022-04-28 01:37:06.884] Parameter: music = y
[2022-04-28 01:37:06.884] Parameter: skipExtract = y
[2022-04-28 01:37:06.884] Parameter: movieDB = TheMovieDB
[2022-04-28 01:37:06.884] Parameter: seriesDB = TheTVDB
[2022-04-28 01:37:06.884] Parameter: animeDB = AniDB
[2022-04-28 01:37:06.885] Parameter: musicDB = ID3
[2022-04-28 01:37:06.885] Parameter: seriesFormat = /Volumes/PlexMedia/PlexServer_1/{plex.derive{' {thetvdb-'}{id}{'}'}{' - ['+allOf{tags}{vf}{vs}{crc32}.join(' ')}{']'}}{if (dc > 1) '.'+di}
[2022-04-28 01:37:06.885] Parameter: 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}{runtime}{crc32}.join(' ')}{']'}}{if (dc > 1) '.'+di}
[2022-04-28 01:37:07.425] Use excludes: /Users/john/.filebot/amc_excludes.txt (4445)
[2022-04-28 01:37:07.618] Input: /Volumes/SeedDrive/complete/Star.Trek.Picard.S02E09.1080p.WEB.H264-CAKES[rarbg]/star.trek.picard.s02e09.1080p.web.h264-cakes.mkv
[2022-04-28 01:37:07.624] Process as TV Series [TV Shows]
[2022-04-28 01:37:07.625] Group: {Series=true} => [star.trek.picard.s02e09.1080p.web.h264-cakes.mkv]
[2022-04-28 01:37:07.650] Rename episodes using [TheTVDB] with [Airdate]
[2022-04-28 01:37:08.637] Lookup via [Star Trek: Picard, Star Trek, Star Trek: The Animated Series]
[2022-04-28 01:37:10.799] Fetching episode data for [Star Trek: Picard]
[2022-04-28 01:37:11.137] └─ 20 episodes
—
[2022-04-28 01:37:22.591] [COPY] from [/Volumes/SeedDrive/complete/Star.Trek.Picard.S02E09.1080p.WEB.H264-CAKES[rarbg]/star.trek.picard.s02e09.1080p.web.h264-cakes.mkv] to [/Volumes/PlexMedia/PlexServer_1/TV Shows/Star Trek - Picard/Season 02/Star Trek - Picard - S02E09 - Hide and Seek {thetvdb-364093} - [1080p WEB-DL 19263D85].mkv]
jprokos
Posts: 173
Joined: 09 Oct 2016, 02:01

Re: qBittorrent parameters change causing issues

Post by jprokos »

I tried to remove the double quotes using bash parameter expansion (search and replace) inside my shell script and now getting inconsistent quoting of the parameters - some quotes are removed and others remain :lol:

using the following in my shell script

Code: Select all

...
--def "ut_kind"="multi" \
--def "ut_title"="${1//\"}" \
--def "ut_label"="${2//\"}" \
--def "ut_dir"="${3//\"}" \
--def "ut_rpath"="${4//\"}" \
--def "ut_spath"="${5//\"}" \
--def "ut_files"="${6//\"}" \
--def "ut_bytes"="${7//\"}" \
--def "ut_track"="${8//\"}" \
--def "ut_info"="${9//\"}" \
--def "ut_tags"="${10//\"}" \
results in this output

Code: Select all

[2022-08-02 21:23:23.074] Run script [fn:amc] at [Tue Aug 02 21:23:23 CDT 2022]
[2022-08-02 21:23:23.098] Parameter: minFileSize = 10000000
[2022-08-02 21:23:23.099] Parameter: minLengthMS = 300000
[2022-08-02 21:23:23.099] Parameter: ut_kind = multi
[2022-08-02 21:23:23.099] Parameter: ut_title = "Patagonia.Life.on.the.Edge.of.the.World.S01E04.The.Far.South.1080p.AMZN.WEBRip.DDP2.0.x264-NTb[rarbg]"
[2022-08-02 21:23:23.099] Parameter: ut_label = "Software"
[2022-08-02 21:23:23.100] Parameter: ut_dir = "/Volumes/SeedDrive/complete/Patagonia.Life.on.the.Edge.of.the.World.S01E04.The.Far.South.1080p.AMZN.WEBRip.DDP2.0.x264-NTb[rarbg]"
[2022-08-02 21:23:23.100] Parameter: ut_rpath = /Volumes/SeedDrive/complete/Patagonia.Life.on.the.Edge.of.the.World.S01E04.The.Far.South.1080p.AMZN.WEBRip.DDP2.0.x264-NTb[rarbg]
[2022-08-02 21:23:23.100] Parameter: ut_spath = /Volumes/SeedDrive/complete
[2022-08-02 21:23:23.100] Parameter: ut_files = 3
[2022-08-02 21:23:23.101] Parameter: ut_bytes = 2984355308
[2022-08-02 21:23:23.101] Parameter: ut_track = 
[2022-08-02 21:23:23.101] Parameter: ut_info = e59b567e5e466986be18619c621b824b05804b82
[2022-08-02 21:23:23.101] Parameter: ut_tags = 
[2022-08-02 21:23:23.102] Parameter: excludeList = /Users/john/.filebot/amc_excludes.txt
[2022-08-02 21:23:23.102] Parameter: pushover = *****
[2022-08-02 21:23:23.103] Parameter: unsorted = y
[2022-08-02 21:23:23.103] Parameter: music = y
[2022-08-02 21:23:23.103] Parameter: skipExtract = y
[2022-08-02 21:23:23.104] Parameter: movieDB = TheMovieDB
[2022-08-02 21:23:23.104] Parameter: seriesDB = TheTVDB
[2022-08-02 21:23:23.104] Parameter: animeDB = AniDB
[2022-08-02 21:23:23.104] Parameter: musicDB = ID3
[2022-08-02 21:23:23.105] Parameter: seriesFormat = /Volumes/PlexMedia/PlexServer_1/{plex.derive{' {thetvdb-'}{id}{'}'}{' - ['+allOf{tags}{vf}{vs}{crc32}.join(' ')}{']'}}{if (dc > 1) '.'+di}
[2022-08-02 21:23:23.105] Parameter: 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}{runtime}{crc32}.join(' ')}{']'}}{if (dc > 1) '.'+di}
[2022-08-02 21:23:23.262] Bad ut_title value: "Patagonia.Life.on.the.Edge.of.the.World.S01E04.The.Far.South.1080p.AMZN.WEBRip.DDP2.0.x264-NTb[rarbg]"
[2022-08-02 21:23:23.262] Bad ut_label value: "Software"
[2022-08-02 21:23:23.262] Bad ut_dir value: "/Volumes/SeedDrive/complete/Patagonia.Life.on.the.Edge.of.the.World.S01E04.The.Far.South.1080p.AMZN.WEBRip.DDP2.0.x264-NTb[rarbg]"
[2022-08-02 21:23:23.618] Use excludes: /Users/john/.filebot/amc_excludes.txt (5724)
[2022-08-02 21:23:23.622] File does not exist: /"/Volumes/SeedDrive/complete/Patagonia.Life.on.the.Edge.of.the.World.S01E04.The.Far.South.1080p.AMZN.WEBRip.DDP2.0.x264-NTb[rarbg]"
[2022-08-02 21:23:23.627] No files selected for processing
[2022-08-02 21:23:23.627] Done ¯\_(ツ)_/¯
User avatar
rednoah
The Source
Posts: 21078
Joined: 16 Nov 2011, 08:59

Re: qBittorrent parameters change causing issues

Post by rednoah »

Your code is very different from the official qBT integration example, but my general advice is to start at the entry point where qBT calls your code:
rednoah wrote: 12 May 2014, 17:30 Instructions for macOS and Linux:

Options ► Downloads ► Run an external program on torrent completion:

Code: Select all

filebot -script fn:amc --output "/path/to/media" --action duplicate --conflict skip -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y music=y artwork=y "ut_label=%L" "ut_title=%N" "ut_kind=multi" "ut_dir=%F"
:idea: On macOS, please use /usr/local/bin/filebot instead of filebot because /usr/local/bin is not in the system $PATH by default.
Image

:?: What is your qBT entry point?


:?: What argument values does qBT pass along?


:?: What does this do?

Code: Select all

${1//\"}

:idea: According to the log, you're doing something like this:

Code: Select all

$ filebot -script fn:amc --def ut_label='"Software"'
Parameter: ut_label = "Software"

Code: Select all

$ filebot -script fn:amc --def ut_label="\"Software\""
Parameter: ut_label = "Software"

:idea: Please read Cmdline and Argument Passing for details.
:idea: Please read the FAQ and How to Request Help.
jprokos
Posts: 173
Joined: 09 Oct 2016, 02:01

Re: qBittorrent parameters change causing issues

Post by jprokos »

I changed nothing in the script or the qBT "call program" commands. Until this commit to the master branch everything was normal for years. With this patch, that contains changes in how the positional parameters are handled, the quoting of the parameters has gone goofy. This points to a qBittorrent issue really, not a FileBot issue, but wanted to open this here as well in case anyone else runs into it. I downgraded to the release version of qBT and this issue went away.

This is the exit command in qBT

Code: Select all

~/.filebot/scripts/qBT_e-program.sh "%N" "%L" "%F" "%R" "%D" "%C" "%Z" "%T" "%I" "%G"
This is the "qBT_e-program.sh" shell script after modifying the parameter expansion to remove quotes. Eventually the quotes are removed from parameters $4 through $10, but $1 - $3 remain quoted when FileBot receives the parameter values - after my parameter expansion modification.

Code: Select all

#!/bin/sh
{
  /usr/local/bin/filebot -script fn:amc --output "/Volumes/PlexMedia/PlexServer_1" \
--action copy \
-non-strict \
--conflict index \
--log-file amc.log \
--def minFileSize=10000000 \
--def minLengthMS=300000 \
--def "ut_kind"="multi" \
--def "ut_title"="${1//\"}" \
--def "ut_label"="${2//\"}" \
--def "ut_dir"="${3//\"}" \
--def "ut_rpath"="${4//\"}" \
--def "ut_spath"="${5//\"}" \
--def "ut_files"="${6//\"}" \
--def "ut_bytes"="${7//\"}" \
--def "ut_track"="${8//\"}" \
--def "ut_info"="${9//\"}" \
--def "ut_tags"="${10//\"}" \
--def excludeList="/Users/john/.filebot/amc_excludes.txt" \
--def pushover=****** \
--def unsorted=y \
--def music=y \
--def skipExtract=y \
--def movieDB=TheMovieDB seriesDB=TheTVDB animeDB=AniDB musicDB=ID3 \
--def seriesFormat="/Volumes/PlexMedia/PlexServer_1/{plex.derive{' {thetvdb-'}{id}{'}'}{' - ['+allOf{tags}{vf}{vs}{crc32}.join(' ')}{']'}}{if (dc > 1) '.'+di}" \
--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}{runtime}{crc32}.join(' ')}{']'}}{if (dc > 1) '.'+di}" \
"ut_title"="${1}" "ut_label"="${2}" "ut_dir"="${3}" \
-exec /Users/john/.filebot/scripts/fb_remove_non-eng_subs.sh {folder}
} >> /Users/john/.filebot/scripts/qBT_e-program_out.txt 2>&1
Regarding "${1//\"}" in the shell script:
https://wiki.bash-hackers.org/syntax/pe ... nd_replace
This "searches and removes" " when expanding the parameter. I only edited this from "${1}" when the quotes appeared after qBT changes, and FileBot didn't like them.


heading out of town for the weekend and won't be able to dig into this and answer all of your questions or fiddle with things but will get to it when I am back.
User avatar
rednoah
The Source
Posts: 21078
Joined: 16 Nov 2011, 08:59

Re: qBittorrent parameters change causing issues

Post by rednoah »

Note that your qBT_e-program.sh does:

Code: Select all

--def "ut_title"="${1//\"}"
but then you overwrite that value a few lines later, thus adding unnecessary confusion and inconsistency to your test case when you think you're doing the former but actually doing the latter:

Code: Select all

"ut_title"="${1}"

For the purpose of testing, you'll want to do something like this:

Code: Select all

echo "Argument 1 = $1"
echo "Argument 2 = $2"
...
:idea: Please read the FAQ and How to Request Help.
Post Reply