cli/gui modes

This commit is contained in:
Claudio Santini 2025-02-07 16:04:32 +01:00
parent 676110adf6
commit b7ae9080e6
5 changed files with 47 additions and 9 deletions

View file

@ -0,0 +1,3 @@
import os, sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)))

View file

@ -5,6 +5,10 @@ from voices import voices, available_voices_str
def cli_main():
if len(sys.argv) == 1:
from ui import main
return main()
voices_str = ', '.join(voices)
epilog = ('example:\n' +
' audiblez book.epub -l en-us -v af_sky\n\n' +
@ -17,6 +21,7 @@ def cli_main():
parser.add_argument('-p', '--pick', default=False, help=f'Interactively select which chapters to read in the audiobook', action='store_true')
parser.add_argument('-s', '--speed', default=1.0, help=f'Set speed from 0.5 to 2.0', type=float)
parser.add_argument('-c', '--cuda', default=False, help=f'Use GPU via Cuda in Torch if available', action='store_true')
parser.add_argument('-g', '--gui', default=False, help=f'Run graphical application instead of command line', action='store_true')
if len(sys.argv) == 1:
parser.print_help(sys.stderr)
@ -36,8 +41,4 @@ def cli_main():
if __name__ == '__main__':
if len(sys.argv) == 1:
from ui import main
main()
else:
cli_main()
cli_main()

View file

@ -23,7 +23,7 @@ class MainWindow(wx.Frame):
self.create_layout()
self.Centre()
self.Show(True)
self.open_epub('./epub/dragon.epub')
# self.open_epub('./epub/dragon.epub')
def create_menu(self):
menubar = wx.MenuBar()

35
poetry.lock generated
View file

@ -3311,6 +3311,39 @@ files = [
{file = "wrapt-1.17.2.tar.gz", hash = "sha256:41388e9d4d1522446fe79d3213196bd9e3b301a336965b9e27ca2788ebd122f3"},
]
[[package]]
name = "wxpython"
version = "4.2.2"
description = "Cross platform GUI toolkit for Python, \"Phoenix\" version"
optional = false
python-versions = "*"
groups = ["main"]
files = [
{file = "wxPython-4.2.2-cp310-cp310-macosx_12_0_x86_64.whl", hash = "sha256:a83bc118417b715ee8fd7143faaf51adaa041ccae22cc6de99bc7f7bb7fc44ef"},
{file = "wxPython-4.2.2-cp310-cp310-win32.whl", hash = "sha256:68923029a7e236374002af25c14aa311922b80f8d63e1f088e6176e12640fa3e"},
{file = "wxPython-4.2.2-cp310-cp310-win_amd64.whl", hash = "sha256:a1f506144173010ae3354980d1a1da6ffcaeed87f2b1be9eef43f60fc8faeaa4"},
{file = "wxPython-4.2.2-cp311-cp311-macosx_10_10_universal2.whl", hash = "sha256:0fe3cb940f5da4f0ec61c3cf37e63c0f577f09a7b9a5d3d7cfc59399eb18cb3b"},
{file = "wxPython-4.2.2-cp311-cp311-win32.whl", hash = "sha256:f63863d52272f8c841b22e7128a339b6d93f3e4d8307d98ea346fa1ec6fbc13b"},
{file = "wxPython-4.2.2-cp311-cp311-win_amd64.whl", hash = "sha256:008c55c60abb3dd66229e1849f10f6a7d5b9af9cc62de40fb9dec144686b5c4d"},
{file = "wxPython-4.2.2-cp312-cp312-macosx_10_10_universal2.whl", hash = "sha256:5d536110a674cb44ff6112d910b26fe6b062d670a6c3840a41036abfe83acc6b"},
{file = "wxPython-4.2.2-cp312-cp312-win32.whl", hash = "sha256:5298662b83792fa8e66e60fdc298dbc317fcf61c68facc506182c2914faef0db"},
{file = "wxPython-4.2.2-cp312-cp312-win_amd64.whl", hash = "sha256:ea0cc206d40d6749f98f60eae2105382685e26bbf6c5a62a853543a0f3fd0ad7"},
{file = "wxPython-4.2.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:e3a6f0eebb8176135991851adbb1648da7f3beb0378752117c3b7ee05e8e55c6"},
{file = "wxPython-4.2.2-cp313-cp313-win32.whl", hash = "sha256:c9310864b088d0f68d212360f261c8fec46a543c952da21805177519622b8524"},
{file = "wxPython-4.2.2-cp313-cp313-win_amd64.whl", hash = "sha256:d8548ce4165e214601083d0d5767dba854a5e14f4e0ed4dbe56e2daf193a4575"},
{file = "wxPython-4.2.2-cp38-cp38-macosx_12_0_x86_64.whl", hash = "sha256:e5ba9b29f64b466d2926c4a5c5a1b624f635c20b1c23ba27064ac9216d858b90"},
{file = "wxPython-4.2.2-cp38-cp38-win32.whl", hash = "sha256:a391eacd10d0ba16333a186819307641803b0dc7a066d5fe4bd1c13f1cd2f44e"},
{file = "wxPython-4.2.2-cp38-cp38-win_amd64.whl", hash = "sha256:b68a4cc0e5b648a0856ffd399ce04e6b750d9dbfba325c4a1f6201dc8e9e4886"},
{file = "wxPython-4.2.2-cp39-cp39-macosx_12_0_x86_64.whl", hash = "sha256:a8c58154e05bb63e7b45dfd0ee379d354dc3372199a858260575e2817908434f"},
{file = "wxPython-4.2.2-cp39-cp39-win32.whl", hash = "sha256:f7b879f29d91ef847c5e88bfb7c34a732a35f016896b1b7f87bc3e3d2d0a5a96"},
{file = "wxPython-4.2.2-cp39-cp39-win_amd64.whl", hash = "sha256:c8d6509f5579732329df70070966a5d8152890e0213f9305801048f5e7408158"},
{file = "wxPython-4.2.2.tar.gz", hash = "sha256:5dbcb0650f67fdc2c5965795a255ffaa3d7b09fb149aa8da2d0d9aa44e38e2ba"},
]
[package.dependencies]
numpy = {version = "*", markers = "python_version >= \"3.0\" and python_version < \"3.12\""}
six = "*"
[[package]]
name = "yaspin"
version = "3.1.0"
@ -3350,4 +3383,4 @@ type = ["pytest-mypy"]
[metadata]
lock-version = "2.1"
python-versions = ">=3.9,<3.13"
content-hash = "829044f7303c59761717b50cc1346c3a0799d0d75442cec322b65f0d3fcc3bac"
content-hash = "77214b41b4424395465f8973bd250e4abebf48bf60a205e75cb322939ee3f6be"

View file

@ -16,7 +16,8 @@ dependencies = [
"spacy (>=3.8.3,<4.0.0)",
"yaspin (>=3.1.0,<4.0.0)",
"kokoro (>=0.7.9,<0.8.0)",
"misaki[zh] (>=0.7.10,<0.8.0)"
"misaki[zh] (>=0.7.10,<0.8.0)",
"wxpython (>=4.2.2,<5.0.0)"
]
@ -31,7 +32,7 @@ Repository = "https://github.com/santinic/audiblez"
Issues = "https://github.com/santinic/audiblez/issues"
[project.scripts]
audiblez = "audiblez:cli_main"
audiblez = "audiblez.cli:cli_main"
[tool.poetry.group.dev.dependencies]
deptry = "^0.23.0"