Tdarr_Plugins icon indicating copy to clipboard operation
Tdarr_Plugins copied to clipboard

runCli Plugin cannot handle filepaths with single quotes or spaces

Open fireph opened this issue 7 months ago • 3 comments
trafficstars

I am trying to create a simple bash script that gets run inside a runCli plugin in a Tdarr flow. Example: Custom CLI Path: /usr/bin/bash CLI Arguments: -c /app/configs/remove_dovi.sh "{{{args.inputFileObj._id}}}" "${outputFilePath}"

This should work fine and should be able to pass the filepath correctly with spaces/single quotes/etc. but it does not. The issue being that the parseArgsStringToArgv command in the plugin is stripping the double quotes and making any filepath with quotes or spaces break any command that is run.

Example log:

2025-04-07T20:45:09.093Z "customCliPath": "/usr/bin/bash",
2025-04-07T20:45:09.093Z "doesCommandCreateOutputFile": "true",
2025-04-07T20:45:09.093Z "userOutputFilePath": "${cacheDir}/${fileName}.{{{args.inputFileObj.container}}}",
2025-04-07T20:45:09.093Z "cliArguments": "-c /app/configs/remove_dovi.sh \"{{{args.inputFileObj._id}}}\" \"${outputFilePath}\"",
2025-04-07T20:45:09.093Z "outputFileBecomesWorkingFile": "true"
2025-04-07T20:45:09.093Z }
2025-04-07T20:45:09.093Z 1-rGLVusU:Node[tdarrDovi]:Worker[bare-boar]:Running /usr/bin/bash -c /app/configs/remove_dovi.sh /Video/Testing's Movie.mkv /temp/tdarr-workDir2-1-rGLVusU/1744083907084/Testing's Movie.mkv

The double quotes are missing in the final command. It could be that I am doing something wrong, but it seems more like this could be an issue with the runCli plugin and how it handles filepaths. I have tried every combination of additional quotes and escaping quotes I can think of, so any help would be appreciated! ❤️

fireph avatar Apr 08 '25 03:04 fireph

Maybe this helps? https://www.reddit.com/r/Tdarr/s/J55GDJxEez

HaveAGitGat avatar Apr 08 '25 12:04 HaveAGitGat

Maybe this helps? https://www.reddit.com/r/Tdarr/s/J55GDJxEez

unfortunately I seem to be running into a similar issue to this person but the solution won't work in my case with single quotes. The double quotes getting deleted when parsed by the plugin is the core of the issue and I'm not sure of the best way to get around it.

fireph avatar Apr 08 '25 18:04 fireph

Wrapping CLI Arguments w/ 's seems to do the trick, though now I'm running into some other issue even though copying the below to the command line works fine, so YMMV.

'auto-encode -i "{{{args.inputFileObj._id}}}" -e av1_qsv --enc-input init_hw_device=vaapi=va:/dev/dri/card0 --sample-duration 10s --samples 3 --pix-format yuv420p --min-vmaf 93 -o "${outputFilePath}"'

becomes

2025-07-09T21:06:38.075Z glVviZEVd:Node[giddy-grub]:Worker[obese-ox]:Running ab-av1 auto-encode -i "/share/tv/test file.mkv" -e av1_qsv --enc-input init_hw_device=vaapi=va:/dev/dri/card0 --sample-duration 10s --samples 3 --pix-format yuv420p --min-vmaf 93 -o "/share/test-library-folder-tdarr-cache/tdarr-workDir2-glVviZEVd/1752095195462/test file.mkv"

Hope it helps someone. FWIW I didn't used to have this issue; not sure when it cropped up.

jeremylow avatar Jul 09 '25 21:07 jeremylow