Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
accessibility_movie_2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵心治
accessibility_movie_2
Commits
97421bf6
Commit
97421bf6
authored
Sep 05, 2022
by
xuanweiace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upd 增加 修改旁白的同时生成音频
parent
54e9918a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
7 deletions
+51
-7
assemble_dialog.py
assemble_dialog.py
+1
-1
main_window.py
main_window.py
+18
-3
management.py
management.py
+29
-2
setting_dialog.py
setting_dialog.py
+1
-1
testTableWidget.py
testTableWidget.py
+2
-0
No files found.
assemble_dialog.py
View file @
97421bf6
...
...
@@ -36,7 +36,7 @@ class Assemble_Dialog(QDialog, Ui_Dialog):
self
.
lineEdit_4
.
setText
(
projectContext
.
speaker_speed
)
# self.show.connect(self.init_self_slot)
def
init_self
(
self
):
print
(
"self.projectContext.speaker_info"
,
self
.
projectContext
.
speaker_info
)
#
print("self.projectContext.speaker_info", self.projectContext.speaker_info)
self
.
lineEdit
.
setText
(
self
.
projectContext
.
video_path
)
self
.
lineEdit_2
.
setText
(
self
.
projectContext
.
excel_path
)
self
.
lineEdit_3
.
setText
(
self
.
projectContext
.
speaker_info
)
...
...
main_window.py
View file @
97421bf6
...
...
@@ -537,13 +537,28 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
projectContext
.
history_push
(
row
,
text
,
text
)
def
rewriteHistory
(
self
,
item
):
if
self
.
projectContext
.
initial_ing
==
True
:
return
from
speech_synthesis
import
speech_synthesis
,
Speaker
,
choose_speaker
audio_dir
=
os
.
path
.
dirname
(
self
.
projectContext
.
excel_path
)
print
(
"self.pb_tableWidget.itemAt(item.row(), 0).text()"
,
self
.
projectContext
.
aside_list
[
item
.
row
()]
.
st_time_sec
)
wav_path
=
audio_dir
+
'/
%.2
f.wav'
%
float
(
self
.
projectContext
.
aside_list
[
item
.
row
()]
.
st_time_sec
)
print
(
"wav_path:"
,
wav_path
)
speed_info
=
self
.
projectContext
.
speaker_speed
speaker_info
=
self
.
projectContext
.
speaker_info
speed
=
float
(
speed_info
.
split
(
'('
)[
0
])
speaker_name
=
speaker_info
.
split
(
","
)[
0
]
speaker
=
self
.
projectContext
.
choose_speaker
(
speaker_name
)
speech_synthesis
(
item
.
text
(),
wav_path
,
speaker
,
speed
)
if
self
.
can_write_history
==
False
:
self
.
can_write_history
=
True
return
if
self
.
projectContext
.
initial_ing
==
True
:
return
print
(
"re writeHistory"
)
# print("re writeHistory")
if
item
is
None
:
print
(
"WRONG!!!! item Is None"
)
return
...
...
management.py
View file @
97421bf6
...
...
@@ -10,7 +10,7 @@ import constant
from
openpyxl.styles
import
PatternFill
,
Alignment
from
utils
import
replace_path_suffix
from
speech_synthesis
import
Speaker
class
RunThread
(
threading
.
Thread
):
"""复写线程类,用于解决主线程无法捕捉子线程中异常的问题
"""
...
...
@@ -80,7 +80,7 @@ class OperateRecord:
# 每一行的具体信息,"起始时间", "终止时间", "字幕", '建议', '解说脚本'
class
Element
:
def
__init__
(
self
,
st_time_sec
:
float
,
ed_time_sec
:
float
,
subtitle
,
suggest
,
aside
):
def
__init__
(
self
,
st_time_sec
:
str
,
ed_time_sec
:
str
,
subtitle
,
suggest
,
aside
):
self
.
st_time_sec
=
st_time_sec
self
.
ed_time_sec
=
ed_time_sec
self
.
subtitle
=
subtitle
...
...
@@ -126,6 +126,10 @@ class ProjectContext:
#是否处于初始化中
self
.
initial_ing
=
False
self
.
speakers
=
[]
self
.
init_speakers
()
def
clear
(
self
):
self
.
subtitle_list
=
[]
self
.
aside_list
=
[]
...
...
@@ -237,6 +241,29 @@ class ProjectContext:
","
.
join
([
speaker
[
"name"
],
speaker
[
"gender"
],
speaker
[
"age_group"
]]))
return
tuple
(
speaker_name
)
def
init_speakers
(
self
):
"""初始化说话人信息
相关配置文件为"speaker.json",如果有信息需要修改,请在speaker.json中修改
"""
f
=
open
(
"speakers.json"
,
encoding
=
"utf-8"
)
content
=
json
.
load
(
f
)
for
speaker_info
in
content
[
"speaker_details"
]:
self
.
speakers
.
append
(
Speaker
(
speaker_info
))
def
choose_speaker
(
self
,
speaker_name
:
str
)
->
Speaker
:
"""选择说话人
Args:
speaker_name (str): 用户选择的说话人名字
Returns:
Speaker: 返回对应说话人,如果没有这个说话人则报错
"""
for
speaker
in
self
.
speakers
:
if
speaker
.
name
==
speaker_name
:
return
speaker
raise
ValueError
def
save_excel_to_to_path
(
all_element
,
new_excel_path
,
header
,
excel_sheet_name
):
if
os
.
path
.
exists
(
new_excel_path
):
...
...
setting_dialog.py
View file @
97421bf6
...
...
@@ -31,7 +31,7 @@ class Setting_Dialog(QDialog, Ui_Dialog):
def
speaker_change_slot
(
self
):
self
.
projectContext
.
speaker_info
=
self
.
comboBox
.
currentText
()
print
(
"self.projectContext.speaker_info:"
,
self
.
projectContext
.
speaker_info
)
#
print("self.projectContext.speaker_info:", self.projectContext.speaker_info)
def
speed_change_slot
(
self
):
self
.
projectContext
.
speaker_speed
=
self
.
comboBox_2
.
currentText
()
...
...
testTableWidget.py
View file @
97421bf6
...
...
@@ -55,6 +55,7 @@ class TableWidget(QWidget):
tablewidget
.
itemDoubleClicked
.
connect
(
self
.
show_data
)
# tablewidget.itemActivated.connect(self.show_data2)
tablewidget
.
itemChanged
.
connect
(
self
.
show_data2
)
self
.
table
=
tablewidget
# tablewidget.itemPressed.connect(self.show_data2)
# tablewidget.itemEntered.connect(self.show_data2)
# tablewidget.cellEntered.connect(self.show_data4)
...
...
@@ -81,6 +82,7 @@ class TableWidget(QWidget):
print
(
'row = '
,
row
)
print
(
'col ='
,
col
)
print
(
'text = '
,
text
)
print
(
self
.
table
.
itemAt
(
0
,
0
)
.
text
())
def
show_data2
(
self
,
Item
):
print
(
"in show_data2"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment