diff --git a/.gitignore b/.gitignore index ca46faeb..16d8680a 100644 --- a/.gitignore +++ b/.gitignore @@ -171,4 +171,5 @@ config.backup.yaml # runtime runtime/ dev/ -installer_files/ \ No newline at end of file +installer_files/ +config.yaml diff --git a/config.yaml b/config.yaml.example similarity index 100% rename from config.yaml rename to config.yaml.example diff --git a/core/_5_split_sub.py b/core/_5_split_sub.py index 76669646..c2252b76 100644 --- a/core/_5_split_sub.py +++ b/core/_5_split_sub.py @@ -43,6 +43,11 @@ def valid_align(response_data): align_data = parsed['align'] src_parts = src_part.split('\n') tr_parts = [item[f'target_part_{i+1}'].strip() for i, item in enumerate(align_data)] + + # bugfix: if the src_parts and tr_parts have different lengths, merge them into one part + if len(src_parts) != len(tr_parts): + src_parts = ["\n".join(src_parts)] + tr_parts = ["\n".join(tr_parts)] whisper_language = load_key("whisper.language") language = load_key("whisper.detected_language") if whisper_language == 'auto' else whisper_language diff --git a/install.py b/install.py index 697f1752..2bb6b636 100644 --- a/install.py +++ b/install.py @@ -1,6 +1,7 @@ import os, sys import platform import subprocess +import shutil sys.path.append(os.path.dirname(os.path.abspath(__file__))) ascii_logo = """ @@ -87,6 +88,10 @@ def main(): from core.utils.decorator import except_handler console = Console() + + # copy defaule config.yaml to config.yaml + if not os.path.exists("config.yaml"): + shutil.copy("config.yaml.example", "config.yaml") width = max(len(line) for line in ascii_logo.splitlines()) + 4 welcome_panel = Panel(