Skip to content

app crash when merging audio files #20

Closed
@KhaledMahm0vd

Description

when converting epub book to audio using audiblez, it skips empty chapters, then it crashes because of searching for audio files for empty chapters

audiblez books/pentester.epub -l en-gb -v am_michael  ✔
/home/user/.local/share/pipx/venvs/audiblez/lib/python3.12/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.')
/home/user/.local/share/pipx/venvs/audiblez/lib/python3.12/site-packages/ebooklib/epub.py:1423: FutureWarning: This search incorrectly ignores the root element, and will be fixed in a future version. If you rely on the current behaviour, change it to './/xmlns:rootfile[@media-type]'
for root_file in tree.findall('//xmlns:rootfile[@media-type]', namespaces={'xmlns': NAMESPACES['CONTAINERNS']}):
The Pentester BluePrint by Phillip L. Wylie
Found Chapters: ['cover.xhtml', 'navigation.xhtml', 'f01.xhtml', 'f02.xhtml', 'f03.xhtml', 'f04.xhtml', 'f05.xhtml', 'f06.xhtml', 'f07.xhtml', 'c01.xhtml', 'c02.xhtml', 'c03.xhtml', 'c04.xhtml', 'c05.xhtml', 'c06.xhtml', 'c07.xhtml', 'c08.xhtml', 'c09.xhtml', 'b01.xhtml', 'b02.xhtml', 'b03.xhtml', 'eula.xhtml']
Not easy to find the chapters, defaulting to all available documents.
Selected chapters: ['cover.xhtml', 'navigation.xhtml', 'f01.xhtml', 'f02.xhtml', 'f03.xhtml', 'f04.xhtml', 'f05.xhtml', 'f06.xhtml', 'f07.xhtml', 'c01.xhtml', 'c02.xhtml', 'c03.xhtml', 'c04.xhtml', 'c05.xhtml', 'c06.xhtml', 'c07.xhtml', 'c08.xhtml', 'c09.xhtml', 'b01.xhtml', 'b02.xhtml', 'b03.xhtml', 'eula.xhtml']
Started at: 20:26:42
Total characters: 294,456
Total words: 46696
Reading chapter 1 (67 characters)...
Estimated time remaining: 00d 06h 17m 44s
Chapter written to pentester_chapter_1.wav
Chapter 1 read in 8.70 seconds (13 characters per second)
Progress: 0%
Reading chapter 2 (92 characters)...
Estimated time remaining: 00d 04h 22m 18s
Chapter written to pentester_chapter_2.wav
Chapter 2 read in 4.92 seconds (19 characters per second)
Progress: 0%
Reading chapter 3 (3,225 characters)...
WARNING [init.py:50] Phonemes are too long, truncating to 510 phonemes
Estimated time remaining: 00d 06h 38m 35s
Chapter written to pentester_chapter_3.wav
Chapter 3 read in 261.99 seconds (12 characters per second)
Progress: 0%
File for chapter 4 already exists. Skipping
File for chapter 5 already exists. Skipping
File for chapter 6 already exists. Skipping
File for chapter 7 already exists. Skipping
File for chapter 8 already exists. Skipping
File for chapter 9 already exists. Skipping
File for chapter 10 already exists. Skipping
File for chapter 11 already exists. Skipping
File for chapter 12 already exists. Skipping
File for chapter 13 already exists. Skipping
File for chapter 14 already exists. Skipping
File for chapter 15 already exists. Skipping
File for chapter 16 already exists. Skipping
File for chapter 17 already exists. Skipping
File for chapter 18 already exists. Skipping
Skipping empty chapter 19
Skipping empty chapter 20
File for chapter 21 already exists. Skipping
Traceback (most recent call last):
File "/home/user/.local/bin/audiblez", line 8, in
sys.exit(cli_main())
^^^^^^^^^^
File "/home/user/.local/share/pipx/venvs/audiblez/lib/python3.12/site-packages/audiblez.py", line 194, in cli_main
main(kokoro, args.epub_file_path, args.lang, args.voice, args.pick, args.speed)
File "/home/user/.local/share/pipx/venvs/audiblez/lib/python3.12/site-packages/audiblez.py", line 80, in main
create_m4b(chapter_mp3_files, filename, title, creator)
File "/home/user/.local/share/pipx/venvs/audiblez/lib/python3.12/site-packages/audiblez.py", line 153, in create_m4b
audio = AudioSegment.from_wav(wav_file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/share/pipx/venvs/audiblez/lib/python3.12/site-packages/pydub/audio_segment.py", line 808, in from_wav
return cls.from_file(file, 'wav', parameters=parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/share/pipx/venvs/audiblez/lib/python3.12/site-packages/pydub/audio_segment.py", line 651, in from_file
file, close_file = _fd_or_path_or_tempfile(file, 'rb', tempfile=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/share/pipx/venvs/audiblez/lib/python3.12/site-packages/pydub/utils.py", line 60, in _fd_or_path_or_tempfile
fd = open(fd, mode=mode)
^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'pentester_chapter_19.wav'

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions