Auto-M4B-Tool icon indicating copy to clipboard operation
Auto-M4B-Tool copied to clipboard

Conversion fails, original .mp3 files are deleted, and no .m4b files are created

Open harmolipi opened this issue 4 years ago • 7 comments

First of all, thank you for all the work you put into this tool and the entire workflow. I'm excited to get my audiobook collection organized.

When I run the auto-m4b-tool.sh script, I get this error from each audiobook it attempts to convert: mv: cannot stat '/path/to/temp/untagged/Big Finish Productions – Hamlet.chapters.txt': No such file or directory

At the end it says "Finished Converting", it deletes the original mp3 files, and all that's added to the /untagged directory is an empty "Title-tmpfiles" directory for each book, as well as a log that says: ERROR 1890ms could not convert /mnt/Big Finish Productions – Hamlet/Big Finish Productions – Hamlet Act 1.mp3 to /untagged/Big Finish Productions – Hamlet-tmpfiles/01-Big Finish Productions – Hamlet Act 1-finished.m4b

harmolipi avatar Dec 11 '20 14:12 harmolipi

You have to update all the folder paths to whichever folders you want to use. The folder locations are specific to each person so anywhere you see /path/to... You need to modify to the folder location you want to use. For example: /mnt/Share/Audiobooks/temp/untagged /mnt/Share/Audiobooks/temp/mp3ab /mnt/Share/Audiobooks/temp/original ...

Also this should not delete the original mp3 files. The original mp3 files should be COPIED from /original to /mp3ab.

seanap avatar Dec 11 '20 14:12 seanap

Oh sorry for not specifying - I did change out my file paths, but just shortened it here. The actual path listed in the error is correct, and points to my proper /untagged folder: mv: cannot stat '/srv/ba480c5c-9963-44a8-a7f5-a138aabe6811/media/library/temp/untagged/BowlingAlone.chapters.txt': No such file or directory

Also you're right - it's not deleting the original .mp3 files, just the ones I've copied to the /mp3merge directory.

harmolipi avatar Dec 11 '20 17:12 harmolipi

M4b-tool needs to create the chapters.txt file, make sure the script has the right permissions. Not having the right permissions would also explain the inability to convert as well.

Does your docker run command work outside of the script (just in the terminal)?

seanap avatar Dec 11 '20 17:12 seanap

Sounds like it could be a permissions problem. So far I ran sudo chmod +x auto-m4b-tool.sh

And the script itself doesn't run at all unless I do sudo ./auto-m4b-tool.sh. Is there anything else I should do to ensure the permissions are correct?

Running this test command does work: sudo docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd)":/mnt m4b-tool --version

Running the docker run command from the script in the terminal like this: sudo docker run -it --rm -u 1001:100 -v /srv/ba480c5c-9963-44a8-a7f5-a138aabe6811/media/library/temp/mp3merge:/mnt -v /srv/ba480c5c-9963-44a8-a7f5-a138aabe6811/media/library/temp/untagged:/untagged m4b-tool merge "BowlingAlone" -n -q --audio-bitrate="32000" --skip-cover --use-filenames-as-chapters --audio-codec=libfdk_aac --jobs=4 --output-file="/untagged/BowlingAlone.m4b" --logfile="/untagged/BowlingAlone.log"

Just creates a tmpfiles directory for the book, as well as a log with the same error as above.

harmolipi avatar Dec 11 '20 18:12 harmolipi

Your first command is run as sudo using the environment variables id -u and id -g . Your second command, while also running as sudo, is forcing the user/group to 1001/100. I would guess the discrepancy lies here. Try running the second command with the $(id -u):$(id -g) instead of the hard coded values.

Your folder locations look like OMV directories. Could there be any smb or omv permissions that need addressing?

seanap avatar Dec 11 '20 18:12 seanap

Oh yes, I was trying different things, so I tried using the user/group I normally use with the rest of my dockers via portainer. I changed it back to $(id -u):$(id -g) and I also added my current user to the "docker" group, so it can run the docker commands without needing "sudo".

Correct, they are OMV directories. I went into OMV to the shared folders and modified the ACLs to give my user full read/write/execute permission. And under the SMB share settings, that share is set to inherit ACLs and permissions. Is there anything else I should take a look at for permissions issues?

harmolipi avatar Dec 11 '20 19:12 harmolipi

Had the same issue with one folder. The root cause is somewhere directly in m4b-tool. Didn't find out what it caused and ignored this book and left it as mp3s..

9Mad-Max5 avatar Nov 30 '21 19:11 9Mad-Max5