RecursiveForest/whatmp3

replay gain fails if folder/file has a single quote in the path

Closed this issue · 2 comments

sh: -c: line 0: syntax error near unexpected token '('
sh: -c: line 0: 'mp3gain -q -c -s i '/path/to/whatmp3/directory with spaces and accents éé and a ' (2016) [320]'/*.mp3'

The single quote is causing a problem, here is the command:
mp3gain -q -c -s i '/path/to/whatmp3/dirname with a single ' quote and parenthesis after ('/*.mp3

diff --git a/whatmp3.py b/whatmp3.py
index 638e0a7..10d61e1 100755
--- a/whatmp3.py
+++ b/whatmp3.py
@@ -169,7 +169,7 @@ def replaygain(opts, codec, outdir):
        if opts.verbose:
                print("APPLYING replaygain")
                print(encoders[enc_opts[codec]['enc']]['regain'] % outdir)
-       r = system(encoders[enc_opts[codec]['enc']]['regain'] % outdir)
+       r = system(encoders[enc_opts[codec]['enc']]['regain'] % escape_quote(outdir))
        if r: failure(r, "replaygain")
        for dirpath, dirs, files in os.walk(outdir, topdown=False):
                for name in dirs:

that fixes it for me

Thanks!