p0n1 / epub_to_audiobook

EPUB to audiobook converter, optimized for Audiobookshelf
MIT License
1.16k stars 119 forks source link

Program successfully completes but files do not show up? #48

Open Paul10142 opened 9 months ago

Paul10142 commented 9 months ago

Hey y'all,

I apologize if this is a stupid inquiry - I have absolutely no coding experience (although this project is motivating me to learn!). Using docker, I was able to successfully follow the instructions and run the program for 2 different audiobooks. In both cases, the program seemed to successfully complete, however the audio files do not appear in the specified outlook directory. I used separate directories for each book, making a new folder /Users/paulclancy/Desktop/Azure and then copying this pathname to specify where to upload.

After checking the folder post-completion of the program, no audio files are present. My code (with the middle portion appreviated) is shown below. Please let me know if there is any obvious solution to this. Thank you!

'paulclancy@Pauls-MacBook-Pro Azure % docker run -i -t --rm -v ./:/app -e MS_TTS_KEY=b5145331f062491e9e53b1d4e3da942d -e MS_TTS_REGION=eastus ghcr.io/p0n1/epub_to_audiobook lying.epub /Users/paulclancy/Desktop/Azure --tts azure /usr/local/lib/python3.11/site-packages/ebooklib/epub.py:1395: UserWarning: In the future version we will turn default option ignore_ncx to True. warnings.warn('In the future version we will turn default option ignore_ncx to True.') /usr/local/lib/python3.11/site-packages/bs4/builder/init.py:545: XMLParsedAsHTMLWarning: It looks like you're parsing an XML document using an HTML parser. If this really is an HTML document (maybe it's XHTML?), you can ignore or filter this warning. If it's XML, you should know that using an XML parser will be more reliable. To parse this document as XML, make sure you have the lxml package installed, and pass the keyword argument `features="xml" into the BeautifulSoup constructor. warnings.warn( 2024-02-26 05:28:06 [INFO] Chapters count: 12. 2024-02-26 05:28:06 [INFO] Converting chapters from 1 to 12. 2024-02-26 05:28:06 [INFO] ✨ Total characters in selected book: 126647 ✨ Estimate book voiceover would cost you roughly: $2.03

Do you want to continue? (y/n) y 2024-02-26 05:28:24 [INFO] Converting chapter 1/12: 2024-02-26 05:33:39 [INFO] Processing chapter-12 , chunk 1 of 1 ...

2024-02-26 05:33:39 [INFO] Sending request to Azure TTS, data length: 576 2024-02-26 05:33:40 [INFO] Got response from Azure TTS, response length: 172512 paulclancy@Pauls-MacBook-Pro Azure %``

p0n1 commented 9 months ago

Hi @Paul10142. Thanks for reaching out.

When you use the command docker run -i -t --rm -v ./:/app, you are mounting your current working directory to the /app directory within the Docker container. This allows the Docker container to access the files in your current working directory. However, the output path for the audiobook must be a directory that is accessible within the Docker container itself.

In your command:

docker run -i -t --rm -v ./:/app -e MS_TTS_KEY=xxx -e MS_TTS_REGION=eastus ghcr.io/p0n1/epub_to_audiobook lying.epub /Users/paulclancy/Desktop/Azure --tts azure

You are specifying /Users/paulclancy/Desktop/Azure as the output directory, which might not be correctly mounted or accessible within the Docker container. To simplify the process and ensure that the output is accessible, it is best to have the output directory within the mounted volume.

Here's how you can modify the command:

  1. Place the lying.epub file in the current working directory where you are running your Docker command.
  2. Specify a relative path for the output directory that is within the mounted volume.

Based on this, your command should look like this:

docker run -i -t --rm -v ./:/app -e MS_TTS_KEY=xxx -e MS_TTS_REGION=eastus ghcr.io/p0n1/epub_to_audiobook lying.epub my_lying_audiobook --tts azure

After running this command, you should find the generated audiobook files in the my_lying_audiobook directory alongside lying.epub in your current working directory. If you wish to have the output in a different location, you will need to adjust the mounting (-v) parameter to include the desired output path in the Docker container's filesystem.

Remember to replace xxx with your actual Microsoft Text-to-Speech API key before running the command.

Besides, I would suggest you to revoke/renew your current Azure api key since it's exposed to the internet.

Let me know if your have any further issues.