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
9b46d4c7
Commit
9b46d4c7
authored
Nov 05, 2023
by
wux51
Browse files
Options
Browse Files
Download
Plain Diff
fix:ocr algorithm issue with repetitive subtitle
parents
9b3754fc
2c4cd5c0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
3 deletions
+17
-3
constant.py
constant.py
+2
-1
detect_with_ocr.py
detect_with_ocr.py
+0
-0
main_window.py
main_window.py
+0
-0
main_window_ui.py
main_window_ui.py
+2
-0
management.py
management.py
+8
-1
narratage_detection.py
narratage_detection.py
+5
-1
No files found.
constant.py
View file @
9b46d4c7
...
@@ -12,10 +12,11 @@ import os
...
@@ -12,10 +12,11 @@ import os
class
Content
:
class
Content
:
StartTimeColumn
=
0
StartTimeColumn
=
0
SubtitleColumnNumber
=
2
AsideColumnNumber
=
4
AsideColumnNumber
=
4
SpeedColumnNumber
=
5
SpeedColumnNumber
=
5
# ActivateColumns = [2, 3]
# ActivateColumns = [2, 3]
ActivateColumns
=
[
4
,
5
]
ActivateColumns
=
[
2
,
4
,
5
]
# ColumnCount = 3
# ColumnCount = 3
ObjectName
=
"all_tableWidget"
ObjectName
=
"all_tableWidget"
# TimeFormatColumns = [0]
# TimeFormatColumns = [0]
...
...
detect_with_ocr.py
View file @
9b46d4c7
This diff is collapsed.
Click to expand it.
main_window.py
View file @
9b46d4c7
This diff is collapsed.
Click to expand it.
main_window_ui.py
View file @
9b46d4c7
...
@@ -65,6 +65,8 @@ class MyWidget(QWidget):
...
@@ -65,6 +65,8 @@ class MyWidget(QWidget):
print
(
">>>>>cur_y2 : "
+
str
(
self
.
y
()))
print
(
">>>>>cur_y2 : "
+
str
(
self
.
y
()))
self
.
move
(
0
,
h
)
self
.
move
(
0
,
h
)
def
get_h
(
self
):
return
self
.
y
()
def
down
(
self
,
mov_len
):
def
down
(
self
,
mov_len
):
...
...
management.py
View file @
9b46d4c7
...
@@ -264,6 +264,11 @@ class ProjectContext:
...
@@ -264,6 +264,11 @@ class ProjectContext:
if
not
self
.
initial_ing
:
if
not
self
.
initial_ing
:
save_excel_to_path
(
self
.
all_elements
,
self
.
excel_path
,
self
.
write_header
,
self
.
excel_sheet_name
)
save_excel_to_path
(
self
.
all_elements
,
self
.
excel_path
,
self
.
write_header
,
self
.
excel_sheet_name
)
def
refresh_subtitle
(
self
,
row
,
subtitle
:
str
):
self
.
all_elements
[
int
(
row
)]
.
subtitle
=
subtitle
if
not
self
.
initial_ing
:
save_excel_to_path
(
self
.
all_elements
,
self
.
excel_path
,
self
.
write_header
,
self
.
excel_sheet_name
)
def
refresh_speed
(
self
,
row
,
speed
:
str
)
->
None
:
def
refresh_speed
(
self
,
row
,
speed
:
str
)
->
None
:
self
.
all_elements
[
int
(
row
)]
.
speed
=
speed
self
.
all_elements
[
int
(
row
)]
.
speed
=
speed
if
not
self
.
initial_ing
:
if
not
self
.
initial_ing
:
...
@@ -308,7 +313,7 @@ class ProjectContext:
...
@@ -308,7 +313,7 @@ class ProjectContext:
if
d
[
"终止时间"
][
i
]
is
None
:
if
d
[
"终止时间"
][
i
]
is
None
:
# 如果是最后一条
# 如果是最后一条
if
i
==
len
(
d
[
"字幕"
])
-
1
:
if
i
==
len
(
d
[
"字幕"
])
-
1
:
print
(
1
)
print
(
">>>>>>>>>load_excel_from_path"
)
# ed_time_sec = "360000" if self.duration == 0 else self.duration # todo 默认最大时长是100h
# ed_time_sec = "360000" if self.duration == 0 else self.duration # todo 默认最大时长是100h
else
:
else
:
ed_time_sec
=
"
%.2
f"
%
(
float
(
d
[
"起始时间"
][
i
+
1
])
-
0.01
)
ed_time_sec
=
"
%.2
f"
%
(
float
(
d
[
"起始时间"
][
i
+
1
])
-
0.01
)
...
@@ -429,6 +434,8 @@ def save_excel_to_path(all_element, new_excel_path, header, excel_sheet_name):
...
@@ -429,6 +434,8 @@ def save_excel_to_path(all_element, new_excel_path, header, excel_sheet_name):
backup_path
=
os
.
path
.
dirname
(
new_excel_path
)
+
"/tmp_"
+
str
(
time
.
time
())
+
".xlsx"
backup_path
=
os
.
path
.
dirname
(
new_excel_path
)
+
"/tmp_"
+
str
(
time
.
time
())
+
".xlsx"
# os.remove(new_excel_path)
# os.remove(new_excel_path)
os
.
rename
(
new_excel_path
,
backup_path
)
os
.
rename
(
new_excel_path
,
backup_path
)
# print(">>>>>>new_excel_path:" + new_excel_path)
# print(">>>>>>>>>>backup_path:" + backup_path)
try
:
try
:
create_sheet
(
new_excel_path
,
"旁白插入位置建议"
,
[
header
])
create_sheet
(
new_excel_path
,
"旁白插入位置建议"
,
[
header
])
# for element in all_element:
# for element in all_element:
...
...
narratage_detection.py
View file @
9b46d4c7
...
@@ -65,7 +65,11 @@ def detect(video_path: str, start_time: float, end_time: float, book_path: str,
...
@@ -65,7 +65,11 @@ def detect(video_path: str, start_time: float, end_time: float, book_path: str,
def
process_err
(
mainWindow
:
MainWindow
=
None
):
def
process_err
(
mainWindow
:
MainWindow
=
None
):
from
detect_with_ocr
import
process_err_ocr
from
detect_with_ocr
import
process_err_ocr
process_err_ocr
(
mainWindow
)
try
:
process_err_ocr
(
mainWindow
)
except
Exception
as
e
:
print
(
"process_err err"
)
print
(
e
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
# 定义参数
# 定义参数
...
...
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