comchap
comchap copied to clipboard
escaping special characters
Any chance somebody could add code to escape special characters in $infile? Some TV program titles include things like "&" or "@" that crashes the Comcut script with "$infile does not exist".
You should just be able to wrap quotes around your input file name as that is handled automatically by bash.
example:
comcut "/path/to/my/file with spaces.mp4"
Thanks, I'll try that. I don't know why I didn't think of it myself! I spent most of a day figuring what was wrong, then got rattled trying to fix it.
Didn't work. I am using a incron job to send it to comcut /'recordings/ IN_CLOSE,IN_MOVED_TO bash /comcut/comcut.sh "$@$#" /processed
that script works fine, with or without the Quotes, unless the title has a special character. $infile and $0 already have quotes in comcut. comcut gets stuck when file does not exist, is there a graceful way to break it when running in the background? It keeps writing the lockfile.
First, FANTASTIC JOB on this. Using comchap/comcut, I'm able to create a shell script to remove commercials from ChannelsDVR and move them to my Plex library.
I'm also having this issue in my script. When I echo the parameter I'm using, I get:
$HOME/Comskip/comcut --ffmpeg="/usr/bin/ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi" '/mnt/Public/Shared Videos/ChannelsDVR/TV/Gordon Ramsay's 24 Hours to Hell and Back/Gordon Ramsay's 24 Hours to Hell and Back S03E10 2020-05-12 Save Our Town 2020-06-30-1959.mpg' '/mnt/Public/Shared Videos/ChannelsDVR/TV/Gordon Ramsay's 24 Hours to Hell and Back/Gordon Ramsay's 24 Hours to Hell and Back S03E10 2020-05-12 Save Our Town 2020-06-30-1959.mp4'
When the parameter passes to comcut (via an eval statement), I get:
Inputfile '/mnt/Public/Shared Videos/ChannelsDVR/TV/Gordon Ramsays' doesn't exist. Please check.
It looks like even though the parameter is quoted, comcut doesn't see the whole entire string after it's passed. It looks like it's only an issue when there are special characters in the file name. When the script runs on a show like The Profit, I get this:
/mnt/Public/Shared Videos/ChannelsDVR/TV/The Profit/The Profit S03E11 2015-11-10 Blues Jean Bar 2020-06-21-0059.edl
$HOME/Comskip/comcut --ffmpeg="/usr/bin/ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi" '/mnt/Public/Shared Videos/ChannelsDVR/TV/The Profit/The Profit S03E11 2015-11-10 Blues Jean Bar 2020-06-21-0059.mpg' '/mnt/Public/Shared Videos/ChannelsDVR/TV/The Profit/The Profit S03E11 2015-11-10 Blues Jean Bar 2020-06-21-0059.mp4'
[h264 @ 0x55720bb110a0] non-existing PPS 0 referenced
(which is the status line that it's working successfully)
Looks like you need to escape the single quotes in your file names since you're using single quotes to specify the file path. Bash cannot tell whether or not those single quotes are supposed to be part of the file path and assumes it's the end of your quoted file path string.
Add backslashes to escape each single quote in your file path.