使用PySide6-Fluent-Widgets重构整套UI

添加任务列表组件并优化视频加载逻辑
支持可视化显示字幕区域
整理所有模型, 分别为STTN智能擦除, STTN字幕检测, LAMA, ProPainter, OpenCV
提高处理性能
新增CPU运行模式并优化多语言支持
修复Propainter模式部分视频报错

本次提交新增了CPU运行模式,适用于无GPU加速的场景。同时,优化了多语言支持,新增了日语、韩语、越南语等语言配置文件,并更新了README文档以反映新的运行模式和多语言支持。此外,修复了部分代码逻辑,提升了系统的稳定性和兼容性。
This commit is contained in:
Jason
2025-05-12 16:39:48 +08:00
parent 7049a24883
commit f78e985e1c
62 changed files with 5412 additions and 1520 deletions

View File

@@ -0,0 +1,83 @@
# coding: utf-8
import re
import os
import sys
import requests
from PySide6.QtCore import QVersionNumber
from backend.config import VERSION, PROJECT_UPDATE_URLS, tr
class VersionService:
""" Version service """
def __init__(self):
self.current_version = VERSION
self.lastest_version = VERSION
self.version_pattern = re.compile(r'v*((\d+)\.(\d+)\.(\d+))')
self.api_endpoints = PROJECT_UPDATE_URLS
def get_latest_version(self):
""" get latest version """
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.64"
}
proxy = self.get_system_proxy()
proxies = {
"http": proxy,
"https": proxy
}
# 依次尝试不同的API端点
for url in self.api_endpoints:
try:
response = requests.get(url, headers=headers, timeout=5, allow_redirects=True, proxies=proxies)
response.raise_for_status()
# 解析版本
version = response.json()['tag_name'] # type:str
match = self.version_pattern.search(version)
if not match:
continue # 如果版本格式不匹配尝试下一个API
self.lastest_version = match.group(1)
print(tr['VersionService']['VersionInfo'].format(VERSION, self.lastest_version))
return self.lastest_version
except Exception as e:
print(tr['VersionService']['RequestError'].format(url, str(e)))
continue # 出错时尝试下一个API
# 所有API都失败时返回当前版本
return VERSION
def has_new_version(self) -> bool:
""" check whether there is a new version """
version = QVersionNumber.fromString(self.get_latest_version())
current_version = QVersionNumber.fromString(self.current_version)
return version > current_version
def get_system_proxy(self):
""" get system proxy """
if sys.platform == "win32":
try:
import winreg
with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\Windows\CurrentVersion\Internet Settings') as key:
enabled, _ = winreg.QueryValueEx(key, 'ProxyEnable')
if enabled:
return "http://" + winreg.QueryValueEx(key, 'ProxyServer')
except:
pass
elif sys.platform == "darwin":
s = os.popen('scutil --proxy').read()
info = dict(re.findall(r'(?m)^\s+([A-Z]\w+)\s+:\s+(\S+)', s))
if info.get('HTTPEnable') == '1':
return f"http://{info['HTTPProxy']}:{info['HTTPPort']}"
elif info.get('ProxyAutoConfigEnable') == '1':
return info['ProxyAutoConfigURLString']
return os.environ.get("http_proxy")