Skip to content

Commit

Permalink
Feat:subtitles edit & glossary
Browse files Browse the repository at this point in the history
  • Loading branch information
jianchang512 committed Sep 3, 2024
1 parent 6535bc5 commit cf1e875
Show file tree
Hide file tree
Showing 27 changed files with 859 additions and 232 deletions.
6 changes: 6 additions & 0 deletions docs/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ Contribute to the project to help with its ongoing maintenance
| *飞(支付宝) | 2024-8-19 | 捐助 10.00 元 |
| *D | 2024-8-20 | 捐助 5.00 元 |
| *根(zhangjiangen11) | 2024-8-21 | 捐助 100.00 元 |
| *| 2024-8-25 | 捐助 2.00 元 |
| *| 2024-8-25 | 捐助 5.00 元 |
| *| 2024-8-26 | 捐助 20.00 元 |
| *| 2024-8-29 | 捐助 8.8 元 |
| *| 2024-9-2 | 捐助 20 元 |
|*) | 2024-9-3 | 捐助 20 元 |



Expand Down
171 changes: 0 additions & 171 deletions mac-requirements.txt

This file was deleted.

6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contourpy==1.1.1
ctranslate2
cycler==0.12.1
decorator==4.4.2
deepl==1.16.1
deepl
distro==1.8.0
edge-tts==6.1.11
elevenlabs==0.2.27
Expand Down Expand Up @@ -150,8 +150,8 @@ srt==3.5.2
stack-data==0.6.3
sympy==1.12
tbb==2021.11.0;sys_platform == 'win32'
tencentcloud-sdk-python-common==3.0.1032
tencentcloud-sdk-python-tmt==3.0.1032
tencentcloud-sdk-python-common
tencentcloud-sdk-python-tmt
termcolor==2.3.0
threadpoolctl==3.2.0
tiktoken==0.6.0
Expand Down
44 changes: 44 additions & 0 deletions test2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from PySide6.QtWidgets import QApplication, QWidget, QVBoxLayout, QTimeEdit, QPushButton, QLabel
from PySide6.QtCore import QTime

class TimeWidget(QWidget):
def __init__(self):
super().__init__()

# 创建布局
layout = QVBoxLayout(self)

# 创建时间选择组件
self.time_edit = QTimeEdit(self)
self.time_edit.setDisplayFormat("HH:mm:ss.zzz")

# 设置默认时间为 02:15:26
default_time = QTime(2, 15, 26,126)
self.time_edit.setTime(default_time)

# 添加到布局
layout.addWidget(self.time_edit)

# 创建一个按钮用于获取时间值
self.get_time_button = QPushButton("Get Time", self)
self.get_time_button.clicked.connect(self.display_time)
layout.addWidget(self.get_time_button)

# 用于展示时间值的标签
self.time_label = QLabel("Selected Time: ", self)
layout.addWidget(self.time_label)

def display_time(self):
# 获取选择的时间
selected_time = self.time_edit.time()
self.time_label.setText(f"Selected Time: {selected_time.msecsSinceStartOfDay()}")

if __name__ == "__main__":
app = QApplication([])

# 创建并显示主窗口
main_window = TimeWidget()
main_window.setWindowTitle("Time Selector")
main_window.show()

app.exec()
4 changes: 2 additions & 2 deletions videotrans/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-

VERSION = "v2.43"
VERSION_NUM = 1200243
VERSION = "v2.44"
VERSION_NUM = 1200244
5 changes: 3 additions & 2 deletions videotrans/component/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
GPTSoVITSForm, TransapiForm, ArticleForm, AzurettsForm, ZhrecognForm, ChatttsForm, LocalLLMForm, ZijiehuoshanForm, \
HebingsrtForm, DoubaoForm, FishTTSForm, CosyVoiceForm, AI302Form, AI302TTSForm, SetINIForm, WatermarkForm, \
GetaudioForm, HunliuForm, VASForm, Fanyisrt, Recognform, Peiyinform, Videoandaudioform, Videoandsrtform, \
OpenAITTSForm, RecognAPIForm, OpenaiRecognAPIForm, DownloadModelForm, FormatcoverForm, SubtitlescoverForm
OpenAITTSForm, RecognAPIForm, OpenaiRecognAPIForm, DownloadModelForm, FormatcoverForm, SubtitlescoverForm,SubtitleEditer

__all__ = [
"BaiduForm",
Expand Down Expand Up @@ -50,5 +50,6 @@
"OpenaiRecognAPIForm",
"DownloadModelForm",
"FormatcoverForm",
"SubtitlescoverForm"
"SubtitlescoverForm",
"SubtitleEditer"
]
7 changes: 7 additions & 0 deletions videotrans/component/set_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from videotrans.ui.setini import Ui_setini
from videotrans.ui.setlinerole import Ui_setlinerole
from videotrans.ui.srthebing import Ui_srthebing
from videotrans.ui.subtitle_editor import Ui_subtitleEditor
from videotrans.ui.subtitlescover import Ui_subtitlescover
from videotrans.ui.tencent import Ui_tencentform
from videotrans.ui.transapi import Ui_transapiform
Expand Down Expand Up @@ -372,3 +373,9 @@ def __init__(self, parent=None):
super(SubtitlescoverForm, self).__init__(parent)
self.setupUi(self)
self.setWindowIcon(QIcon(f"{config.ROOT_DIR}/videotrans/styles/icon.ico"))

class SubtitleEditer(Ui_subtitleEditor): # <===
def __init__(self):
super(SubtitleEditer, self).__init__()
# self.setupUi(self)
self.setWindowIcon(QIcon(f"{config.ROOT_DIR}/videotrans/styles/icon.ico"))
3 changes: 3 additions & 0 deletions videotrans/configure/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,15 @@ def getset_params(obj=None):

"deepl_authkey": "",
"deepl_api": "",
"deepl_gid": "",

"deeplx_address": "",

"ott_address": "",

"tencent_SecretId": "",
"tencent_SecretKey": "",
"tencent_termlist":"",

"baidu_appid": "",
"baidu_miyue": "",
Expand Down
2 changes: 2 additions & 0 deletions videotrans/mainwin/spwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from videotrans.task.job import start_thread
from videotrans.tts import CLONE_VOICE_TTS, CHATTTS, TTS_API, GPTSOVITS_TTS, COSYVOICE_TTS, FISHTTS, OPENAI_TTS
from videotrans.winform import fn_editer

warnings.filterwarnings('ignore')

Expand Down Expand Up @@ -98,6 +99,7 @@ def start_subform(self):
self.action_yinshipinfenli.triggered.connect(fn_audiofromvideo.open)
self.action_hun.triggered.connect(fn_hunliu.open)
self.action_yingyinhebing.triggered.connect(fn_vas.open)
self.action_subtitleediter.triggered.connect(fn_editer.open)
self.action_fanyi.triggered.connect(fn_fanyisrt.open)
self.action_yuyinshibie.triggered.connect(fn_recogn.open)
self.action_yuyinhecheng.triggered.connect(fn_peiyin.open)
Expand Down
2 changes: 2 additions & 0 deletions videotrans/task/_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ def _merge_audio_segments(self):
"-y",
"-i",
Path(wavfile).as_posix(),
"-ar",
"48000",
self.target_audio
]
tools.runffmpeg(cmd)
Expand Down
6 changes: 4 additions & 2 deletions videotrans/task/fanyiwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class FanyiWorker(QThread):
uito = Signal(str)

def __init__(self, type=type, target_language=None, files=None, parent=None,bilingual=0):
def __init__(self, type=type, target_language=None, files=None, parent=None,bilingual=0,source_code=None):
super(FanyiWorker, self).__init__(parent)
self.type = type
self.target_language = target_language
Expand All @@ -26,6 +26,7 @@ def __init__(self, type=type, target_language=None, files=None, parent=None,bili
self.bilingual=bilingual
self.uuid = tools.get_md5(f"{time.time()}{','.join(files)}{type}{target_language}")
self.end = False
self.source_code=source_code

def post(self, msg):
self.uito.emit(json.dumps(msg))
Expand All @@ -51,7 +52,7 @@ def getqueulog(uuid):
# 开始翻译,从目标文件夹读取原始字幕
config.box_trans = "ing"
if not self.files:
self.post({"type": 'error', 'text': 'no srt file'})
self.post({"type": 'error', 'text': '必须导入srt字幕文件' if config.defaulelang=='zh' else 'Must import srt subtitle files'})
return
target = config.HOME_DIR + '/translate'
Path(target).mkdir(parents=True, exist_ok=True)
Expand All @@ -78,6 +79,7 @@ def getqueulog(uuid):
text_list=copy.deepcopy(rawsrt),
target_language_name=self.target_language,
uuid=self.uuid,
source_code=self.source_code,
set_p=True)
srts_tmp = ""
for i,it in enumerate(srt):
Expand Down
Loading

0 comments on commit cf1e875

Please sign in to comment.