Skip to content

Commit

Permalink
Refactor method sub_conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
BingLingGroup committed May 7, 2021
1 parent 0d66878 commit b400a54
Show file tree
Hide file tree
Showing 11 changed files with 314 additions and 257 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@ Click up arrow to go back to TOC.
- Add current working directory support in file renaming.
- Add join-events support for youtube automatic caption in json format.
- Add support for googletrans v4.0.0rc1 in class ManualTranslator.
- Add more subtitles format support in method sub_processing to join and split the events of the subtitles.

#### Changed(Unreleased)

- Change the default value for `-et` option into 50.
- Change the control flow in method audio_or_video_prcs by using args.output_files to control.
- Change ci to github actions by [@jitingcn](https://github.com/jitingcn).
- Refactor method sub_conversion.

#### Fixed(Unreleased)

Expand All @@ -89,6 +91,8 @@ Click up arrow to go back to TOC.
- Fix style_name issue in method split_dst_lf_src_assfile.
- Fix unable to type into the terminal after running by [@9mido](https://github.com/9mido).

<escape><a href = "#TOC">&nbsp;&nbsp;</a></escape>

### [0.5.7-alpha] - 2020-05-06

#### Added(0.5.7-alpha)
Expand Down
24 changes: 19 additions & 5 deletions autosub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

# Import third-party modules
import pysubs2
import auditok

# Any changes to the path and your own modules
from autosub import ffmpeg_utils
Expand Down Expand Up @@ -56,6 +57,12 @@ def main(): # pylint: disable=too-many-branches, too-many-statements, too-many-
if args.proxy_password:
os.environ['proxy_password'] = args.proxy_password

if not args.auditok_mode:
if not args.not_strict_min_length:
args.auditok_mode = auditok.StreamTokenizer.STRICT_MIN_LENGTH
if args.drop_trailing_silence:
args.auditok_mode = args.auditok_mode | auditok.StreamTokenizer.DROP_TRAILING_SILENCE

try:
if args.speech_config:
cmdline_utils.validate_speech_config(args)
Expand Down Expand Up @@ -184,11 +191,18 @@ def main(): # pylint: disable=too-many-branches, too-many-statements, too-many-
"[sample_rate]",
"{sample_rate}".format(sample_rate=args.api_sample_rate))

cmdline_utils.sub_conversion(
args,
input_m=input_m,
fps=fps
)
if args.join_control:
cmdline_utils.sub_processing(
args,
input_m=input_m,
fps=fps
)
else:
cmdline_utils.sub_conversion(
args,
input_m=input_m,
fps=fps
)

raise exceptions.AutosubException(_("\nAll work done."))

Expand Down
2 changes: 1 addition & 1 deletion autosub/api_baidu.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Defines Baidu API used by autosub.
Expand Down
Loading

0 comments on commit b400a54

Please sign in to comment.