Edit book: A new tool to create audio narration of all text in the book using Text-to-speech

This commit is contained in:
Kovid Goyal 2024-10-20 11:20:22 +05:30
parent 8e22f1c7ce
commit 1f87c3c87a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 6 additions and 0 deletions

View File

@ -534,6 +534,7 @@ def embed_tts(container, report_progress=None, callback_to_download_voices=None)
html_item.set('media-overlay', smilitem.get('id'))
duration_map[smilitem.get('id')] = file_duration
container.set_media_overlay_durations(duration_map)
return True
def develop():

View File

@ -196,6 +196,8 @@ def develop():
outpath = b + '-tts' + e
container.commit(outpath)
print('Output saved to:', outpath)
else:
print('Failed')
del d
del app

View File

@ -468,6 +468,8 @@ class Main(MainWindow):
self.action_get_ext_resources = treg('download-metadata.png', _('Download external &resources'),
self.boss.get_external_resources, 'get-external-resources', (), _(
'Download external resources in the book (images/stylesheets/etc/ that are not included in the book)'))
self.action_embed_tts = treg('bullhorn.png', _('Add Text-to-speech narration'), self.boss.embed_tts, 'embed-tts', (), _(
'Add audio narration for all the book text using Text-to-speech generation'))
def ereg(icon, text, target, sid, keys, description):
return reg(icon, text, partial(self.boss.editor_action, target), sid, keys, description)
@ -639,6 +641,7 @@ class Main(MainWindow):
e.addAction(self.action_transform_styles)
e.addAction(self.action_transform_html)
e.addAction(self.action_fix_html_all)
e.addAction(self.action_embed_tts)
e.addAction(self.action_pretty_all)
e.addAction(self.action_rationalize_folders)
e.addAction(self.action_add_cover)