From b9afe210fded6081501d52fe5703721a0e3b822f Mon Sep 17 00:00:00 2001 From: jameson512 <2867557054@qq.com> Date: Wed, 8 May 2024 09:35:58 +0800 Subject: [PATCH] fix: bugs and update --- requirements.txt | 7 +++---- videotrans/__init__.py | 4 ++-- videotrans/configure/config.py | 2 +- videotrans/translator/chatgpt.py | 2 ++ videotrans/translator/freegoogle.py | 2 ++ videotrans/translator/gemini.py | 2 ++ videotrans/translator/google.py | 2 ++ 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/requirements.txt b/requirements.txt index 3859a51a..083dd52d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,7 +29,7 @@ edge-tts==6.1.11 elevenlabs==0.2.27 exceptiongroup==1.1.3 executing==2.0.1 -faster-whisper==1.0.1 +faster-whisper==1.0.2 ffmpeg-python==0.2.0 filelock==3.12.4 flatbuffers==1.12 @@ -76,7 +76,6 @@ llvmlite==0.42.0 Markdown==3.5 MarkupSafe==2.1.3 matplotlib-inline==0.1.6 -mkl==2021.4.0 more-itertools==10.1.0 moviepy==1.0.3 mpmath==1.3.0 @@ -154,8 +153,8 @@ termcolor==2.3.0 threadpoolctl==3.2.0 tiktoken==0.6.0 tokenizers==0.15.2 -torch==2.3.0 -torchaudio==2.3.0 +torch==2.2.0 +torchaudio==2.2.0 tqdm==4.66.1 traitlets==5.14.1 typer==0.3.2 diff --git a/videotrans/__init__.py b/videotrans/__init__.py index d5024c67..e10d8911 100644 --- a/videotrans/__init__.py +++ b/videotrans/__init__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- -VERSION="v1.69" -VERSION_NUM=110690 \ No newline at end of file +VERSION="v1.70" +VERSION_NUM=110700 \ No newline at end of file diff --git a/videotrans/configure/config.py b/videotrans/configure/config.py index af805216..48c94374 100644 --- a/videotrans/configure/config.py +++ b/videotrans/configure/config.py @@ -150,7 +150,7 @@ def parse_init(): # ffmpeg if sys.platform == 'win32': PWD=rootdir.replace('/','\\') - os.environ['PATH'] = PWD + f';{PWD}\\ffmpeg;{PWD}\\_internal\torch\lib;' + os.environ['PATH'] + os.environ['PATH'] = PWD + f';{PWD}\\ffmpeg;' + os.environ['PATH'] else: os.environ['PATH'] = rootdir + f':{rootdir}/ffmpeg:' + os.environ['PATH'] diff --git a/videotrans/translator/chatgpt.py b/videotrans/translator/chatgpt.py index d998c7f3..b470042e 100644 --- a/videotrans/translator/chatgpt.py +++ b/videotrans/translator/chatgpt.py @@ -177,6 +177,8 @@ def trans(text_list, target_language="English", *, set_p=True,inst=None,stop=0,s if err: config.logger.error(f'[ChatGPT]翻译请求失败:{err=}') + if err.lower().find("Connection error")>-1: + err='连接失败 '+err raise Exception(f'ChatGPT:{err}') if not is_srt: diff --git a/videotrans/translator/freegoogle.py b/videotrans/translator/freegoogle.py index 638329ab..aaef5017 100644 --- a/videotrans/translator/freegoogle.py +++ b/videotrans/translator/freegoogle.py @@ -130,6 +130,8 @@ def trans(text_list, target_language="en", *, set_p=True,inst=None,stop=0,source if err: config.logger.error(f'[FreeGoogle]翻译请求失败:{err=}') + if err.lower().find("Connection error")>-1: + err='连接失败 '+err raise Exception(f'FreeGoogle:{err}') if isinstance(text_list, str): return "\n".join(target_text) diff --git a/videotrans/translator/gemini.py b/videotrans/translator/gemini.py index 44168328..c3de38fb 100644 --- a/videotrans/translator/gemini.py +++ b/videotrans/translator/gemini.py @@ -207,6 +207,8 @@ def trans(text_list, target_language="English", *, set_p=True, inst=None, stop=0 if err: config.logger.error(f'[Gemini]翻译请求失败:{err=}') + if err.lower().find("Connection error")>-1: + err='连接失败 '+err raise Exception(f'Gemini:{err}') if not is_srt: diff --git a/videotrans/translator/google.py b/videotrans/translator/google.py index e044bfb9..31e65eb9 100644 --- a/videotrans/translator/google.py +++ b/videotrans/translator/google.py @@ -117,6 +117,8 @@ def trans(text_list, target_language="en", *, set_p=True,inst=None,stop=0,source if err: config.logger.error(f'[Google]翻译请求失败:{err=}') + if err.lower().find("Connection error")>-1: + err='连接失败 '+err raise Exception(f'Google:{err}')