Skip to content

Commit 495e407

Browse files
authored
Merge pull request Huanshere#266 from Huanshere/new_tts
v2.0 New tts
2 parents d49bca2 + 74638fd commit 495e407

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2016
-1116
lines changed

.github/ISSUE_TEMPLATE/issue-report.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,5 @@ config.backup.yaml
170170

171171
# runtime
172172
runtime/
173-
dev/
173+
dev/
174+
installer_files/

OneKeyInstall&Start.bat

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
@echo off
2+
3+
cd /D "%~dp0"
4+
5+
set PATH=%PATH%;%SystemRoot%\system32
6+
7+
echo "%CD%"| findstr /C:" " >nul && echo This script relies on Miniconda which can not be silently installed under a path with spaces. && goto end
8+
9+
@rem fix failed install when installing to a separate drive
10+
set TMP=%cd%\installer_files
11+
set TEMP=%cd%\installer_files
12+
13+
@rem config
14+
set INSTALL_DIR=%cd%\installer_files
15+
set CONDA_ROOT_PREFIX=%cd%\installer_files\conda
16+
set INSTALL_ENV_DIR=%cd%\installer_files\env
17+
set MINICONDA_DOWNLOAD_URL=https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Windows-x86_64.exe
18+
set conda_exists=F
19+
20+
@rem figure out whether git and conda needs to be installed
21+
call "%CONDA_ROOT_PREFIX%\_conda.exe" --version >nul 2>&1
22+
if "%ERRORLEVEL%" EQU "0" set conda_exists=T
23+
24+
@rem (if necessary) install git and conda into a contained environment
25+
@rem download conda
26+
if "%conda_exists%" == "F" (
27+
echo Downloading Miniconda from %MINICONDA_DOWNLOAD_URL% to %INSTALL_DIR%\miniconda_installer.exe
28+
29+
mkdir "%INSTALL_DIR%"
30+
call curl -Lk "%MINICONDA_DOWNLOAD_URL%" > "%INSTALL_DIR%\miniconda_installer.exe" || ( echo. && echo Miniconda failed to download. && goto end )
31+
32+
echo Installing Miniconda to %CONDA_ROOT_PREFIX%
33+
start /wait "" "%INSTALL_DIR%\miniconda_installer.exe" /InstallationType=JustMe /NoShortcuts=1 /AddToPath=0 /RegisterPython=0 /NoRegistry=1 /S /D=%CONDA_ROOT_PREFIX%
34+
35+
@rem test the conda binary
36+
echo Miniconda version:
37+
call "%CONDA_ROOT_PREFIX%\_conda.exe" --version || ( echo. && echo Miniconda not found. && goto end )
38+
)
39+
40+
@rem create the installer env
41+
if not exist "%INSTALL_ENV_DIR%" (
42+
echo Packages to install: python=3.10.0 requests rich ruamel.yaml
43+
call "%CONDA_ROOT_PREFIX%\_conda.exe" create --no-shortcuts -y -k --prefix "%INSTALL_ENV_DIR%" python=3.10.0 requests rich "ruamel.yaml" || ( echo. && echo Conda environment creation failed. && goto end )
44+
)
45+
46+
@rem check if conda environment was actually created
47+
if not exist "%INSTALL_ENV_DIR%\python.exe" ( echo. && echo Conda environment is empty. && goto end )
48+
49+
@rem environment isolation
50+
set PYTHONNOUSERSITE=1
51+
set PYTHONPATH=
52+
set PYTHONHOME=
53+
@rem ! may cause error if we use cudnn on windows
54+
set "CUDA_PATH=%INSTALL_ENV_DIR%"
55+
set "CUDA_HOME=%CUDA_PATH%"
56+
57+
@rem activate installer env
58+
call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo Miniconda hook not found. && goto end )
59+
60+
@rem Run pip setup
61+
call python pip_setup.py
62+
63+
echo.
64+
echo Done!
65+
66+
:end
67+
pause

OneKeyStart.bat

Lines changed: 0 additions & 13 deletions
This file was deleted.

batch/OneKeyBatch.bat

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
@echo off
2-
cd /d %~dp0..
3-
4-
if exist runtime (
5-
echo Using runtime folder...
6-
runtime\python.exe batch\utils\batch_processor.py
7-
) else (
8-
echo Runtime folder not found. Using conda environment...
9-
call conda activate videolingo
10-
python batch\utils\batch_processor.py
11-
call conda deactivate
12-
)
2+
cd /D "%~dp0"
3+
cd ..
134

5+
@rem 设置环境变量
6+
set INSTALL_DIR=%cd%\installer_files
7+
set CONDA_ROOT_PREFIX=%cd%\installer_files\conda
8+
set INSTALL_ENV_DIR=%cd%\installer_files\env
9+
10+
@rem 环境隔离设置
11+
set PYTHONNOUSERSITE=1
12+
set PYTHONPATH=
13+
set PYTHONHOME=
14+
set "CUDA_PATH=%INSTALL_ENV_DIR%"
15+
set "CUDA_HOME=%CUDA_PATH%"
16+
17+
@rem 激活conda环境
18+
call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo Conda environment not found && goto end )
19+
20+
@rem 运行批处理脚本
21+
call python batch\utils\batch_processor.py
22+
23+
:end
1424
pause

batch/README.md

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,27 @@
22

33
[English](./README.md) | [简体中文](./README.zh.md)
44

5-
Before utilizing the batch mode, ensure you have familiarized yourself with the Streamlit mode and properly configured the parameters in `config.yaml`.
5+
Before utilizing the batch mode, ensure you have used the Streamlit mode and properly configured the parameters in `config.yaml`.
66

77
## Usage Guide
88

9-
> Note: All referenced files, with the exception of `config.yaml`, are located within the `batch` folder.
10-
119
### 1. Video File Preparation
1210

13-
- Upload your video files for processing to the `input` folder
14-
- YouTube links can be specified in the subsequent step
11+
- Place your video files in the `input` folder
12+
- YouTube links can be specified in the next step
1513

1614
### 2. Task Configuration
1715

18-
Modify the `tasks_setting.xlsx` file as follows:
16+
Edit the `tasks_setting.xlsx` file:
1917

2018
| Field | Description | Acceptable Values |
2119
|-------|-------------|-------------------|
22-
| Video File | Video filename (excluding `input/` prefix) or YouTube URL | - |
23-
| Source Language | Original language of the video | 'en', 'zh', 'auto', or leave empty for default |
24-
| Target Language | Desired translation language | Use natural language description, or leave empty for default |
25-
| Dubbing | Enable or disable dubbing | 0 or empty: no dubbing; 1: enable dubbing |
20+
| Video File | Video filename (without `input/` prefix) or YouTube URL | - |
21+
| Source Language | Source language | 'en', 'zh', ... or leave empty for default |
22+
| Target Language | Translation language | Use natural language description, or leave empty for default |
23+
| Dubbing | Enable dubbing | 0 or empty: no dubbing; 1: enable dubbing |
2624

27-
Example configuration:
25+
Example:
2826

2927
| Video File | Source Language | Target Language | Dubbing |
3028
|------------|-----------------|-----------------|---------|
@@ -33,24 +31,23 @@ Example configuration:
3331

3432
### 3. Executing Batch Processing
3533

36-
1. Launch `OneKeyBatch.bat` with a double-click
37-
2. Processed files will be stored in the `output` folder
38-
3. Monitor task progress in the `Status` column of `tasks_setting.xlsx`
34+
1. Double-click to run `OneKeyBatch.bat`
35+
2. Output files will be saved in the `output` folder
36+
3. Task status can be monitored in the `Status` column of `tasks_setting.xlsx`
3937

4038
> Note: Keep `tasks_setting.xlsx` closed during execution to prevent interruptions due to file access conflicts.
4139
42-
4340
## Important Considerations
4441

4542
### Handling Interruptions
4643

47-
In the event of an unexpected command line closure, language settings in `config.yaml` may be altered. Verify these settings before attempting to resume processing.
44+
If the command line is closed unexpectedly, language settings in `config.yaml` may be altered. Check settings before retrying.
4845

4946
### Error Management
5047

51-
- Files that fail to process will be relocated to the `output/ERROR` folder
52-
- Detailed error messages are logged in the `Status` column of `tasks_setting.xlsx`
53-
- To reattempt processing:
54-
1. Transfer the specific video folder from `ERROR` to the root directory
55-
2. Rename this folder to `output`
56-
3. Utilize the Streamlit mode to reinitiate processing
48+
- Failed files will be moved to the `output/ERROR` folder
49+
- Error messages are recorded in the `Status` column of `tasks_setting.xlsx`
50+
- To retry:
51+
1. Move the single video folder from `ERROR` to the root directory
52+
2. Rename it to `output`
53+
3. Use Streamlit mode to process again

batch/README.zh.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
## 使用方法
88

9-
> 注:以下所说文件除了 `config.yaml` 以外都在 `batch` 文件夹下。
10-
119
### 1. 准备视频文件
1210

1311
- 将要处理的视频文件放入 `input` 文件夹
@@ -20,7 +18,7 @@
2018
| 字段 | 说明 | 可选值 |
2119
|------|------|--------|
2220
| Video File | 视频文件名(无需 `input/` 前缀)或 YouTube 链接 | - |
23-
| Source Language | 源语言 | 'en', 'zh', 'auto',或留空使用默认设置 |
21+
| Source Language | 源语言 | 'en', 'zh', ... 或留空使用默认设置 |
2422
| Target Language | 翻译语言 | 使用自然语言描述,或留空使用默认设置 |
2523
| Dubbing | 是否配音 | 0 或留空:不配音;1:配音 |
2624

batch/utils/settings_check.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44
from rich.console import Console
55
from rich.panel import Panel
66

7+
# Constants
8+
SETTINGS_FILE = 'batch/tasks_setting.xlsx'
9+
INPUT_FOLDER = os.path.join('batch', 'input')
10+
VALID_DUBBING_VALUES = [0, 1]
11+
712
console = Console()
813

914
def check_settings():
10-
df = pd.read_excel('batch/tasks_setting.xlsx')
11-
input_files = set(os.listdir(os.path.join('batch', 'input')))
15+
os.makedirs(INPUT_FOLDER, exist_ok=True)
16+
df = pd.read_excel(SETTINGS_FILE)
17+
input_files = set(os.listdir(INPUT_FOLDER))
1218
excel_files = set(df['Video File'].tolist())
1319
files_not_in_excel = input_files - excel_files
1420

@@ -31,19 +37,14 @@ def check_settings():
3137

3238
if video_file.startswith('http'):
3339
url_tasks += 1
34-
elif os.path.isfile(os.path.join('batch', 'input', video_file)):
40+
elif os.path.isfile(os.path.join(INPUT_FOLDER, video_file)):
3541
local_video_tasks += 1
3642
else:
3743
console.print(Panel(f"Invalid video file or URL 「{video_file}」", title=f"[bold red]Error in row {index + 2}", expand=False))
3844
all_passed = False
3945

40-
if not pd.isna(source_language):
41-
if source_language.lower() not in ['en', 'zh', 'auto']:
42-
console.print(Panel(f"Invalid source language 「{source_language}」", title=f"[bold red]Error in row {index + 2}", expand=False))
43-
all_passed = False
44-
4546
if not pd.isna(dubbing):
46-
if int(dubbing) not in [0, 1]:
47+
if int(dubbing) not in VALID_DUBBING_VALUES:
4748
console.print(Panel(f"Invalid dubbing value 「{dubbing}」", title=f"[bold red]Error in row {index + 2}", expand=False))
4849
all_passed = False
4950

0 commit comments

Comments
 (0)