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
146a444a
Commit
146a444a
authored
Nov 05, 2022
by
xuanweiace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
881ebacb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
12 deletions
+22
-12
conf.ini
conf.ini
+2
-2
main_window.py
main_window.py
+20
-10
No files found.
conf.ini
View file @
146a444a
{"video_path":
"F:/mystudy/Eagle/test2/\u4f55\u4ee5\u7b19\u7bab\u9ed8.mp4",
"excel_path":
"F:/mystudy/Eagle/test2/\u4f55\u4ee5\u7b19\u7bab\u9ed8.xlsx",
"detection_info":
{"detected":
false,
"nd_process":
0.0,
"last_time":
0.0,
"caption_boundings":
[]
,
"has_subtitle":
true},
"speaker_info":
{"speaker_id":
"\u6653\u6653\uff0c\u5973\uff0c\u5e74\u8f7b\u4eba",
"speaker_speed":
"1.10(4.5\u5b57/\u79d2)"}}
{"video_path":
"F:/mystudy/Eagle/test2/\u4f55\u4ee5\u7b19\u7bab\u9ed8.mp4",
"excel_path":
"F:/mystudy/Eagle/test2/\u4f55\u4ee5\u7b19\u7bab\u9ed8.xlsx",
"detection_info":
{"detected":
false,
"nd_process":
0.12199690880989182,
"last_time":
789.32,
"caption_boundings":
[]
,
"has_subtitle":
true},
"speaker_info":
{"speaker_id":
"\u6653\u6653\uff0c\u5973\uff0c\u5e74\u8f7b\u4eba",
"speaker_speed":
"1.00(4\u5b57/\u79d2)"}}
\ No newline at end of file
\ No newline at end of file
main_window.py
View file @
146a444a
...
@@ -167,7 +167,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -167,7 +167,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
pb_tableWidget
.
itemDoubleClicked
.
connect
(
self
.
pb_item_changed_by_double_clicked_slot
)
self
.
pb_tableWidget
.
itemDoubleClicked
.
connect
(
self
.
pb_item_changed_by_double_clicked_slot
)
self
.
pb_tableWidget
.
itemChanged
.
connect
(
self
.
rewriteHistory
)
self
.
pb_tableWidget
.
itemChanged
.
connect
(
self
.
rewriteHistory
)
self
.
pb_tableWidget
.
itemChanged
.
connect
(
self
.
generate_audio_slot
)
self
.
pb_tableWidget
.
itemChanged
.
connect
(
self
.
generate_audio_slot
)
# todo 现在只在【旁白】tab上双击修改,会保存表格到本地,【字幕旁白】tab上不行。
# todo 现在只在【旁白】tab上双击修改,会保存表格到本地,【字幕旁白】tab上不行。
(【字幕旁白】tab上无法修改旁白)
self
.
pb_tableWidget
.
itemChanged
.
connect
(
self
.
write2ProjectFromAside
)
self
.
pb_tableWidget
.
itemChanged
.
connect
(
self
.
write2ProjectFromAside
)
self
.
zm_tableWidget
.
itemDoubleClicked
.
connect
(
self
.
change_video_time
)
self
.
zm_tableWidget
.
itemDoubleClicked
.
connect
(
self
.
change_video_time
)
self
.
pb_tableWidget
.
itemDoubleClicked
.
connect
(
self
.
change_video_time
)
self
.
pb_tableWidget
.
itemDoubleClicked
.
connect
(
self
.
change_video_time
)
...
@@ -600,7 +600,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -600,7 +600,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
user_operation=True的情况:用户双击操作表格,通过【操作表格】进行增删改,通过【在此处添加旁白】来添加一行
user_operation=True的情况:用户双击操作表格,通过【操作表格】进行增删改,通过【在此处添加旁白】来添加一行
initial_ing为true时,不会生成音频,不会写入历史记录
initial_ing为true时,不会生成音频,不会写入历史记录
"""
"""
if
user_operation
:
if
not
user_operation
:
self
.
projectContext
.
initial_ing
=
True
self
.
projectContext
.
initial_ing
=
True
header
=
self
.
projectContext
.
header
header
=
self
.
projectContext
.
header
subtitle_list
=
self
.
projectContext
.
subtitle_list
subtitle_list
=
self
.
projectContext
.
subtitle_list
...
@@ -639,7 +639,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -639,7 +639,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
pb_tableWidget_idx
=
len
(
aside_list
)
self
.
pb_tableWidget_idx
=
len
(
aside_list
)
self
.
zm_tableWidget_idx
=
len
(
subtitle_list
)
self
.
zm_tableWidget_idx
=
len
(
subtitle_list
)
if
user_operation
:
if
not
user_operation
:
self
.
projectContext
.
initial_ing
=
False
self
.
projectContext
.
initial_ing
=
False
def
setElememtToTable
(
self
,
table
:
QTableWidget
,
elem
:
Element
,
idx
:
int
):
def
setElememtToTable
(
self
,
table
:
QTableWidget
,
elem
:
Element
,
idx
:
int
):
...
@@ -744,9 +744,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -744,9 +744,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if
item
is
None
:
if
item
is
None
:
print
(
"WRONG!!!! item Is None"
)
print
(
"WRONG!!!! item Is None"
)
return
return
if
self
.
is_user_editing
()
==
False
:
if
self
.
is_user_editing
()
==
False
:
return
return
self
.
set_user_edit
(
False
)
# 不需要set为False
row
=
item
.
row
()
# 获取行数
row
=
item
.
row
()
# 获取行数
col
=
item
.
column
()
# 获取列数 注意是column而不是col
col
=
item
.
column
()
# 获取列数 注意是column而不是col
...
@@ -756,15 +757,17 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -756,15 +757,17 @@ class MainWindow(QMainWindow, Ui_MainWindow):
return
return
self
.
excel_content_changed
=
True
self
.
excel_content_changed
=
True
# 合成这一段语音
# 合成这一段语音
self
.
do_generate_audio_by_aside_row
(
int
(
row
))
def
do_generate_audio_by_aside_row
(
self
,
row
):
"""
传入pb_tableWidget的一个下标,生成对应音频
"""
from
speech_synthesis
import
speech_synthesis
,
Speaker
,
choose_speaker
from
speech_synthesis
import
speech_synthesis
,
Speaker
,
choose_speaker
print
(
"self.projectContext.excel_path:"
,
self
.
projectContext
.
excel_path
)
audio_dir
=
os
.
path
.
dirname
(
self
.
projectContext
.
excel_path
)
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
+
\
wav_path
=
audio_dir
+
\
'/tmp/
%.2
f.wav'
%
float
(
'/tmp/
%.2
f.wav'
%
float
(
self
.
projectContext
.
aside_list
[
i
tem
.
row
(
)]
.
st_time_sec
)
self
.
projectContext
.
aside_list
[
i
nt
(
row
)]
.
st_time_sec
)
print
(
"wav_path:"
,
wav_path
)
print
(
"wav_path:"
,
wav_path
)
# speed_info = self.projectContext.speaker_speed
# speed_info = self.projectContext.speaker_speed
# 使用私有 语速
# 使用私有 语速
...
@@ -785,6 +788,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -785,6 +788,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
return
self
.
user_editing_content
or
self
.
user_editing_aside
return
self
.
user_editing_content
or
self
.
user_editing_aside
def
set_user_edit
(
self
,
val
:
bool
):
def
set_user_edit
(
self
,
val
:
bool
):
print
(
"set_user_edit: "
,
val
)
self
.
user_editing_content
=
val
self
.
user_editing_content
=
val
self
.
user_editing_aside
=
val
self
.
user_editing_aside
=
val
...
@@ -793,7 +797,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -793,7 +797,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
return
return
if
self
.
is_user_editing
()
==
False
:
if
self
.
is_user_editing
()
==
False
:
return
return
self
.
set_user_edit
(
False
)
# 这里不需要加,因为按照槽函数的顺序 还有一个要执行的
# self.set_user_edit(False)
if
item
is
None
:
if
item
is
None
:
print
(
"WRONG!!!! item Is None"
)
print
(
"WRONG!!!! item Is None"
)
return
return
...
@@ -859,6 +864,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -859,6 +864,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
return
return
if
self
.
is_user_editing
()
==
False
:
if
self
.
is_user_editing
()
==
False
:
return
return
self
.
set_user_edit
(
False
)
if
item
is
None
:
if
item
is
None
:
print
(
"WRONG!!!! item Is None"
)
print
(
"WRONG!!!! item Is None"
)
return
return
...
@@ -895,6 +901,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -895,6 +901,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
def
undo_slot
(
self
):
def
undo_slot
(
self
):
self
.
can_write_history
=
False
self
.
can_write_history
=
False
self
.
user_editing_aside
=
True
record
=
self
.
projectContext
.
history_pop
()
record
=
self
.
projectContext
.
history_pop
()
print
(
'[undo_slot] record=
%
s'
%
(
record
.
to_string
()))
print
(
'[undo_slot] record=
%
s'
%
(
record
.
to_string
()))
item
=
QTableWidgetItem
(
record
.
old_str
)
item
=
QTableWidgetItem
(
record
.
old_str
)
...
@@ -906,6 +913,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -906,6 +913,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
def
redo_slot
(
self
):
def
redo_slot
(
self
):
self
.
can_write_history
=
False
self
.
can_write_history
=
False
self
.
user_editing_aside
=
True
record
=
self
.
projectContext
.
history_redo
()
record
=
self
.
projectContext
.
history_redo
()
if
record
is
None
:
if
record
is
None
:
self
.
action_redo
.
setEnabled
(
False
)
self
.
action_redo
.
setEnabled
(
False
)
...
@@ -1009,6 +1017,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1009,6 +1017,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
idx
+=
1
idx
+=
1
self
.
projectContext
.
aside_list
.
insert
(
idx
,
new_element
)
self
.
projectContext
.
aside_list
.
insert
(
idx
,
new_element
)
self
.
pb_tableWidget_idx
=
idx
self
.
pb_tableWidget_idx
=
idx
self
.
do_generate_audio_by_aside_row
(
idx
)
else
:
else
:
idx
=
0
idx
=
0
while
idx
<
len
(
self
.
projectContext
.
subtitle_list
):
while
idx
<
len
(
self
.
projectContext
.
subtitle_list
):
...
@@ -1036,6 +1045,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1036,6 +1045,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if
to_be_modify_element
.
equalTo
(
self
.
projectContext
.
aside_list
[
i
]):
if
to_be_modify_element
.
equalTo
(
self
.
projectContext
.
aside_list
[
i
]):
self
.
pb_tableWidget_idx
=
i
self
.
pb_tableWidget_idx
=
i
self
.
setElememtToTable
(
self
.
pb_tableWidget
,
self
.
projectContext
.
aside_list
[
i
],
i
)
self
.
setElememtToTable
(
self
.
pb_tableWidget
,
self
.
projectContext
.
aside_list
[
i
],
i
)
self
.
do_generate_audio_by_aside_row
(
i
)
break
break
else
:
else
:
for
i
in
range
(
len
(
self
.
projectContext
.
subtitle_header
)):
for
i
in
range
(
len
(
self
.
projectContext
.
subtitle_header
)):
...
...
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