Closed philgoetz closed 3 months ago
The problem is the parentheses in the filename. The input filename is passed to ffmpeg inside double-quotes. It needs each parentheses within the double-quotes escaped. That is, decrypt calls something like
ffmpeg -i "foo(bar)"
when it needs
ffmpeg -i "foo\(bar\)"
Probably the same thing will happen if the name contains [, *, or other characters interpreted as part of a regexp.
@philgoetz The problem is the opposite, the filename is escaped even though it's passed to ffmpeg directly.
It errors out because audible-cli passes this non-existent path:
'Consciousness_Confessions_of_a_Romantic_Reductionist(MIT_Press)-AAX_22_32.aaxc'
Instead it should pass:
Consciousness_Confessions_of_a_Romantic_Reductionist(MIT_Press)-AAX_22_32.aaxc
See https://github.com/mkb79/audible-cli/pull/202 for a fix.
@devnoname120 Have you verified your solution with folder or file names which contains whitespaces?!
@mkb79 I didn't see a reason why it wouldn't work, but I just tried and I confirm that it works fine.
❯ ls -lFh
Alias tip: l
Permissions User Group Size Date Modified Name
.rw-r--r-- root root 438 MB Sun Apr 7 09:32:19 2024 A Redacted Book Name (that contains parentheses)(Some Editor)-AAX_44_128.aaxc
.rw-r--r-- root root 18 KB Sun Apr 7 09:32:02 2024 A Redacted Book Name (that contains parentheses)(Some Editor)_(500).jpg
.rw-r--r-- root root 5.9 KB Sun Apr 7 09:32:02 2024 A Redacted Book Name (that contains parentheses)(Some Editor)-chapters.json
.rw-r--r-- root root 2.5 KB Sun Apr 7 09:32:02 2024 A Redacted Book Name (that contains parentheses)(Some Editor)-AAX_44_128.voucher
❯ audible --verbosity DEBUG --profile de decrypt --all --rebuild-chapters --force-rebuild-chapters
debug: Audible-cli version: 0.3.1
debug: App dir: /root/.audible
debug: Plugin dir: /root/dev/audible-cli/plugin_cmds
debug: Config loaded from config.toml
debug: Auth file de.json for profile de loaded.
size= 3kB time=-577014:32:22.77 bitrate=N/A speed=N/A
Using chapters from /tmp/tmp.uhgH4qSdKf/folder with spaces/A Redacted Book Name (that contains parentheses)(Some Editor)-chapters.json
Found 18 chapters to prepare.
frame= 1 fps=0.1 q=-1.0 Lsize= 441863kB time=07:55:07.11 bitrate= 127.0kbits/s speed=2.27e+03x
File decryption successful: /tmp/tmp.uhgH4qSdKf/folder with spaces/A Redacted Book Name (that contains parentheses)(Some Editor)-AAX_44_128.m4b
@devnoname120 I had some issues with the Windows shell and whitespaces in the past. But I don’t have a Windows machine anymore, so I can’t test this.
(this reply is @devnoname120)
@mkb79 I didn't see a reason why it wouldn't work, but I just tried and I confirm that it works fine.
Where is the fix you speak of? It isn't here, and it isn't in #202 either.
@mkb79 I spinned up a Windows 11 virtual machine and I tested both using cmd.exe
and PowerShell.exe
.
I confirm that it didn't work without my changes, and it now works after applying my changes.
Before:
After:
@devnoname120 Thank you for your work and time. I'll merge your pr now.
[ADDED: You can skip all of this comment and just read the next one, which explains what the problem is.]
I was running
and it crashed while decrypting the 88th file:
However, when I constructed the same ffmpeg call and ran it from the command line, it succeeded:
And when I re-ran
it successfully decrypted that same file. [ADDED: Hmm, probably not. Probably the output file already existed, and it skipped it.]