Merge pull request #1 from TimoYoung/official

v1.1
This commit is contained in:
TimoYoung
2025-04-21 18:06:18 +08:00
committed by GitHub
2 changed files with 10 additions and 6 deletions

View File

@@ -25,13 +25,14 @@
"AutoSubv2": {
"name": "AI字幕自动生成(v2)",
"description": "使用whisper自动生成视频文件字幕,使用大模型翻译字幕成中文。",
"version": "1.0",
"version": "1.1",
"icon": "autosubtitles.jpeg",
"author": "TimoYoung",
"level": 1,
"v2": true,
"history": {
"v1.0": "first stable version"
"v1.0": "first stable version",
"v1.1": "优化字幕翻译逻辑,优化日志输出"
}
},
"CustomSites": {

View File

@@ -38,7 +38,7 @@ class AutoSubv2(_PluginBase):
# 主题色
plugin_color = "#2C4F7E"
# 插件版本
plugin_version = "1.0"
plugin_version = "1.1"
# 插件作者
plugin_author = "TimoYoung"
# 作者主页
@@ -294,7 +294,7 @@ class AutoSubv2(_PluginBase):
if self.send_notify:
self.post_message(mtype=NotificationType.Plugin, title="【自动字幕生成】", text=message)
# 打印调用栈
logger.debug(traceback.format_exc())
logger.error(traceback.format_exc())
self.fail_count += 1
def __process_folder_subtitle(self, path):
@@ -789,8 +789,11 @@ class AutoSubv2(_PluginBase):
def __translate_zh_subtitle(self, source_lang: str, source_subtitle: str, dest_subtitle: str):
self._stats = {'total': 0, 'batch_success': 0, 'batch_fail': 0, 'line_fallback': 0}
subs = self.__load_srt(source_subtitle)
valid_subs = self.__merge_srt(subs)
logger.info(f"合并前字幕数: {len(subs)},合并后字幕数: {len(valid_subs)}")
if source_lang in ["en", "eng"]:
valid_subs = self.__merge_srt(subs)
logger.info(f"英文字幕合并:合并前字幕数: {len(subs)},合并后字幕数: {len(valid_subs)}")
else:
valid_subs = subs
self._stats['total'] = len(valid_subs)
processed = []
current_batch = []