Skip to content

Commit

Permalink
Merge pull request #46 from sayunkim/sayunkim
Browse files Browse the repository at this point in the history
Remove redundant progress statement, and clean up the part that skips the word "title" at the beginning of the audio file.
  • Loading branch information
aedocw authored Dec 3, 2024
2 parents e8d1b81 + e1dd8bc commit 845953e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ pip-log.txt
.tox

.python-version
/venv
/.idea
13 changes: 10 additions & 3 deletions epub2tts_edge/epub2tts_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ def append_silence(tempfile, duration=1200):

def read_book(book_contents, speaker, paragraphpause, sentencepause):
segments = []
# Do not read these into the audio file:
title_names_to_skip_reading = ['Title', 'blank']

for i, chapter in enumerate(book_contents, start=1):
files = []
partname = f"part{i}.flac"
Expand All @@ -247,15 +250,19 @@ def read_book(book_contents, speaker, paragraphpause, sentencepause):
print(f"{partname} exists, skipping to next chapter")
segments.append(partname)
else:
print(f"Chapter: {chapter['title']}\n")
print(f"Section name: \"{chapter['title']}\"")
if chapter["title"] in title_names_to_skip_reading:
print(f"Chapter name: \"{chapter['title']}\" - Note: The word \"{chapter['title']}\" will not be read into audio file.")
else:
print(f"Chapter name: \"{chapter['title']}\"")

if chapter["title"] == "":
chapter["title"] = "blank"
if chapter["title"] != "Title":
if chapter["title"] not in title_names_to_skip_reading:
asyncio.run(
parallel_edgespeak([chapter["title"]], [speaker], ["sntnc0.mp3"])
)
append_silence("sntnc0.mp3", 1200)

for pindex, paragraph in enumerate(
tqdm(chapter["paragraphs"], desc=f"Generating audio files: ",unit='pg')
):
Expand Down

0 comments on commit 845953e

Please sign in to comment.