From f614ed39793b3c4d4daafffd5a09ab309ae6224a Mon Sep 17 00:00:00 2001 From: Claudio Santini Date: Tue, 14 Jan 2025 23:22:06 +0100 Subject: [PATCH] fix --- .github/workflows/pip-install.yaml | 39 ++++++++++++++++++++++++------ .github/workflows/publish.yaml | 34 ++++++++++++++++++++++++++ audiblez.py | 5 ++++ 3 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/pip-install.yaml b/.github/workflows/pip-install.yaml index 5e204a7..461132a 100644 --- a/.github/workflows/pip-install.yaml +++ b/.github/workflows/pip-install.yaml @@ -2,19 +2,42 @@ name: GitHub Action for installing and testing the package on Python 3.11 run-name: pip install and run on: [ push, pull_request ] jobs: - install-and-run: + install-and-run-on-python-3-11: runs-on: ubuntu-latest steps: - - name: Set up Python 3.11 + - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.11' - name: Install audiblez - run: | - python -m pip install audiblez + run: python -m pip install audiblez - name: Check it runs as module - run: | - python -m audiblez --help + run: python -m audiblez --help - name: check it runs as script - run: | - audiblez --help + run: audiblez --help + install-and-run-on-python-3-12: + runs-on: ubuntu-latest + steps: + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.12' + - name: Install audiblez + run: python -m pip install audiblez + - name: Check it runs as module + run: python -m audiblez --help + - name: check it runs as script + run: audiblez --help + install-and-run-on-python-3-10: + runs-on: ubuntu-latest + steps: + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Install audiblez + run: python -m pip install audiblez + - name: Check it runs as module + run: python -m audiblez --help + - name: check it runs as script + run: audiblez --help diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..1b47f78 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,34 @@ +name: Publish Python wheel to PyPI with poetry +on: + push: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install poetry + run: python -m pip install poetry + - name: Install dependencies + run: poetry install --sync --no-interaction + - name: Build wheel + run: poetry build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + publish-to-pypi: + name: Publish to PyPI + if: startsWith(github.ref, 'refs/tags/') + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/audiblez + permissions: + id-token: write diff --git a/audiblez.py b/audiblez.py index aff525b..c8688d8 100755 --- a/audiblez.py +++ b/audiblez.py @@ -128,6 +128,11 @@ def create_m4b(chaptfer_files, filename): if __name__ == '__main__': + if not Path('kokoro-v0_19.onnx').exists() or not Path('voices.json').exists(): + print('Error: kokoro-v0_19.onnx and voices.json must be in the current directory. Please download them with:') + print('wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/kokoro-v0_19.onnx') + print('wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/voices.json') + sys.exit(1) voices = list(kokoro.get_voices()) voices_str = ', '.join(voices) epilog = 'example:\n' + \