diff --git a/VERSION.txt b/VERSION.txt index 2d25c0e4..9bf1082b 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -25.3.22 \ No newline at end of file +25.4.25 \ No newline at end of file diff --git a/ebook2audiobook.cmd b/ebook2audiobook.cmd index 472cb131..4be2d54f 100755 --- a/ebook2audiobook.cmd +++ b/ebook2audiobook.cmd @@ -16,7 +16,7 @@ set "PYTHONUTF8=1" set "PYTHONIOENCODING=utf-8" set "CURRENT_ENV=" -set "PROGRAMS_LIST=calibre-normal-cjk ffmpeg nodejs espeak-ng sox" +set "PROGRAMS_LIST=calibre-normal ffmpeg nodejs espeak-ng sox" set "TMP=%SCRIPT_DIR%\tmp" set "TEMP=%SCRIPT_DIR%\tmp" @@ -64,6 +64,7 @@ where /Q scoop if %errorlevel% neq 0 ( echo Scoop is not installed. set "SCOOP_CHECK=1" + goto install_components ) goto conda_check exit /b @@ -74,7 +75,7 @@ if %errorlevel% neq 0 ( call rmdir /s /q "%CONDA_INSTALL_DIR%" 2>nul echo Miniforge3 is not installed. set "CONDA_CHECK=1" - goto programs_check + goto install_components ) :: Check if running in a Conda environment if defined CONDA_DEFAULT_ENV ( @@ -110,7 +111,7 @@ set "missing_prog_array=" for %%p in (%PROGRAMS_LIST%) do ( set "prog=%%p" if "%%p"=="nodejs" set "prog=node" - if "%%p"=="calibre-normal-cjk" set "prog=calibre" + if "%%p"=="calibre-normal" set "prog=calibre" where /Q !prog! if !errorlevel! neq 0 ( echo %%p is not installed. @@ -130,12 +131,6 @@ if not "%SCOOP_CHECK%"=="0" ( echo Installing Scoop... call powershell -command "Set-ExecutionPolicy RemoteSigned -scope CurrentUser" call powershell -command "iwr -useb get.scoop.sh | iex" - - where /Q scoop - if !errorlevel! neq 0 ( - echo Scoop installation failed. - goto failed - ) call scoop install git call scoop bucket add muggle https://github.com/hu3rror/scoop-muggle.git call scoop bucket add extras @@ -144,32 +139,8 @@ if not "%SCOOP_CHECK%"=="0" ( if "%PROGRAMS_CHECK%"=="0" ( set "SCOOP_CHECK=0" ) -) -:: Install missing packages one by one -if not "%PROGRAMS_CHECK%"=="0" ( - echo Installing missing programs... - if "%SCOOP_CHECK%"=="0" ( - call scoop bucket add muggle b https://github.com/hu3rror/scoop-muggle.git - call scoop bucket add extras - call scoop bucket add versions - ) - for %%p in (%missing_prog_array%) do ( - call scoop install %%p - set "prog=%%p" - if "%%p"=="nodejs" ( - set "prog=node" - ) - if "%%p"=="calibre-normal-cjk" set "prog=calibre" - where /Q !prog! - if !errorlevel! neq 0 ( - echo %%p installation failed... - goto failed - ) - ) - call powershell -command "[System.Environment]::SetEnvironmentVariable('Path', [System.Environment]::GetEnvironmentVariable('Path', 'User') + '%SCOOP_SHIMS%;%SCOOP_APPS%;%CONDA_PATH%;%NODE_PATH%;', 'User')" - set "SCOOP_CHECK=0" - set "PROGRAMS_CHECK=0" - set "missing_prog_array=" + start "" cmd /k cd /d "%CD%" ^& call "%~f0" + exit ) :: Install Conda if not already installed if not "%CONDA_CHECK%"=="0" ( @@ -186,6 +157,34 @@ if not "%CONDA_CHECK%"=="0" ( del "%CONDA_INSTALLER%" set "CONDA_CHECK=0" echo Conda installed successfully. + start "" cmd /k cd /d "%CD%" ^& call "%~f0" + exit +) +:: Install missing packages one by one +if not "%PROGRAMS_CHECK%"=="0" ( + echo Installing missing programs... + if "%SCOOP_CHECK%"=="0" ( + call scoop bucket add muggle b https://github.com/hu3rror/scoop-muggle.git + call scoop bucket add extras + call scoop bucket add versions + ) + for %%p in (%missing_prog_array%) do ( + call scoop install %%p + set "prog=%%p" + if "%%p"=="nodejs" ( + set "prog=node" + ) + if "%%p"=="calibre-normal" set "prog=calibre" + where /Q !prog! + if !errorlevel! neq 0 ( + echo %%p installation failed... + goto failed + ) + ) + call powershell -command "[System.Environment]::SetEnvironmentVariable('Path', [System.Environment]::GetEnvironmentVariable('Path', 'User') + '%SCOOP_SHIMS%;%SCOOP_APPS%;%CONDA_PATH%;%NODE_PATH%;', 'User')" + set "SCOOP_CHECK=0" + set "PROGRAMS_CHECK=0" + set "missing_prog_array=" ) goto dispatch exit /b diff --git a/lib/classes/tts_manager.py b/lib/classes/tts_manager.py index 45197578..3689a300 100644 --- a/lib/classes/tts_manager.py +++ b/lib/classes/tts_manager.py @@ -321,7 +321,7 @@ class TTSManager: else: raise TypeError(f"Unsupported type for audio_data: {type(audio_data)}") - def _trim_end(self, audio_data, sample_rate, silence_threshold=0.001, buffer_seconds=0.001): + def _trim_end(self, audio_data, sample_rate, silence_threshold=0.010, buffer_seconds=0.010): # Ensure audio_data is a PyTorch tensor if isinstance(audio_data, list): audio_data = torch.tensor(audio_data) # Convert list to tensor diff --git a/lib/functions.py b/lib/functions.py index c700e045..4a0f390f 100644 --- a/lib/functions.py +++ b/lib/functions.py @@ -626,7 +626,7 @@ def get_chapters(epubBook, session): def get_sentences(text, lang): max_tokens = language_mapping[lang]['max_tokens'] - max_chars = max_tokens * 10 + max_chars = (max_tokens * 10) - 4 pattern_split = [re.escape(p) for p in punctuation_split] pattern = f"({'|'.join(pattern_split)})" diff --git a/pyproject.toml b/pyproject.toml index 8d017467..5fd9868f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,7 @@ dependencies = [ "torchvggish" ] readme = "README.md" -requires-python = ">3.11,<3.13" +requires-python = ">3.9,<3.13" classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", diff --git a/setup.py b/setup.py index 7d383ca4..59126b60 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ class PostInstallCommand(install): setup( name='ebook2audiobook', version=get_version(), - python_requires=">3.11,<3.13", + python_requires=">3.9,<3.13", author="Drew Thomasson", description="Convert eBooks to audiobooks with chapters and metadata", long_description=long_description,