INNER CODE UNIT · Python

save_chapters_as_text

DrewThomasson/VoxNovel · 2GPU_Audio_generation.py:138

    def save_chapters_as_text(epub_path):
        # Create the directory if it doesn't exist
        directory = "Working_files/temp_ebook"
        #Clean up the text chapter folders by wiping it before creating chapters for selected ebook.
        #Lazily done by just deleting the directly and everything in it.
        if os.path.exists(directory):
            shutil.rmtree(directory)
        ensure_directory(directory)

        # Open the EPUB file
        book = epub.read_epub(epub_path)

        previous_chapter_text = ''
        previous_filename = ''
        chapter_counter = 0

        # Iterate through the items in the EPUB file
        for item in book.get_items():

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…