Skip to content

Commit

Permalink
Merge branch 'dev' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
BingLingGroup committed Feb 2, 2020
2 parents e50e080 + d9a474b commit 67f71e5
Show file tree
Hide file tree
Showing 36 changed files with 2,027 additions and 1,286 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ MANIFEST
/.build_and_dist_win32
/.release
*.po~
Pipfile
*.lock
20 changes: 18 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## TOC

- [Unreleased](#unreleased)
- [0.5.4-alpha - 2020-01-31](#054-alpha---2020-01-31)
- [Added](#added054-alpha)
- [Changed](#changed054-alpha)
- [0.5.3-alpha - 2019-12-30](#053-alpha---2019-12-30)
- [Changed](#changed053-alpha)
- [0.5.2-alpha - 2019-11-05](#052-alpha---2019-11-05)
Expand All @@ -29,7 +32,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Click up arrow to go back to TOC.

### [Unreleased]
### Unreleased

### [0.5.4-alpha] - 2020-01-31

#### Added(0.5.4-alpha)

- Add basic Google Cloud Speech-to-Text support. [issue #10](https://github.com/BingLingGroup/autosub/issues/10)
- Add more bilingual subtitles formats output support. [issue #72](https://github.com/BingLingGroup/autosub/issues/72)

#### Changed(0.5.4-alpha)

- Fix output format limits when input is a subtitles file.
- Remove gtransv2 support.

### [0.5.3-alpha] - 2019-12-30

Expand Down Expand Up @@ -156,7 +171,8 @@ Click up arrow to go back to TOC.

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

[Unreleased]: https://github.com/BingLingGroup/autosub/compare/0.5.3-alpha...HEAD
[Unreleased]: https://github.com/BingLingGroup/autosub/compare/0.5.4-alpha...HEAD
[0.5.4-alpha]: https://github.com/BingLingGroup/autosub/compare/0.5.3-alpha...0.5.4-alpha
[0.5.3-alpha]: https://github.com/BingLingGroup/autosub/compare/0.5.2-alpha...0.5.3-alpha
[0.5.2-alpha]: https://github.com/BingLingGroup/autosub/compare/0.5.1-alpha...0.5.2-alpha
[0.5.1-alpha]: https://github.com/BingLingGroup/autosub/compare/0.5.0-alpha...0.5.1-alpha
Expand Down
243 changes: 167 additions & 76 deletions README.md

Large diffs are not rendered by default.

61 changes: 33 additions & 28 deletions autosub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,21 @@ def main(): # pylint: disable=too-many-branches, too-many-statements, too-many-
if not ffmpeg_cmd:
raise exceptions.AutosubException(
_("Error: Dependency ffmpeg"
" not found on this machine.")
)
" not found on this machine."))

ffmpeg_cmd = ffmpeg_cmd + ' '

cmdline_utils.fix_args(args,
ffmpeg_cmd=ffmpeg_cmd)

if args.audio_process:
args.audio_process = {k.lower() for k in args.audio_process}
args.audio_process = \
args.audio_process & constants.DEFAULT_AUDIO_PRCS_MODE_SET
if not args.audio_process:
raise exceptions.AutosubException(
_("Error: The args of \"-ap\"/\"--audio-process\" are wrong."
"\nNo works done.")
)
"\nNo works done."))
if 'o' in args.audio_process:
args.keep = True
prcs_file = ffmpeg_utils.audio_pre_prcs(
Expand All @@ -91,17 +92,14 @@ def main(): # pylint: disable=too-many-branches, too-many-statements, too-many-
cmds=args.audio_process_cmd,
output_name=args.output,
input_m=input_m,
ffmpeg_cmd=ffmpeg_cmd
)
ffmpeg_cmd=ffmpeg_cmd)
if not prcs_file:
raise exceptions.AutosubException(
_("No works done.")
)
else:
args.input = prcs_file
raise exceptions.AutosubException(
_("Audio pre-processing complete.\nAll works done.")
)
_("No works done."))

args.input = prcs_file
raise exceptions.AutosubException(
_("Audio pre-processing complete.\nAll works done."))

if 's' in args.audio_process:
args.keep = True
Expand All @@ -113,33 +111,40 @@ def main(): # pylint: disable=too-many-branches, too-many-statements, too-many-
cmds=args.audio_process_cmd,
output_name=args.output,
input_m=input_m,
ffmpeg_cmd=ffmpeg_cmd
)
ffmpeg_cmd=ffmpeg_cmd)
args.audio_split_cmd = \
args.audio_split_cmd.replace(
"-vn -ac [channel] -ar [sample_rate] ", "")
if not prcs_file:
no_audio_prcs = False
print(_("Audio pre-processing failed."
"\nUse default method."))
else:
args.input = prcs_file
print(_("Audio pre-processing complete."))
no_audio_prcs = True
elif 'n' in args.audio_process:
print(_("No extra check/conversion "
"before the speech-to-text procedure."))
no_audio_prcs = True
else:
no_audio_prcs = False

else:
no_audio_prcs = False
args.audio_split_cmd = \
args.audio_split_cmd.replace(
"[channel]",
"{channel}".format(channel=args.api_audio_channel))
args.audio_split_cmd = \
args.audio_split_cmd.replace(
"[sample_rate]",
"{sample_rate}".format(sample_rate=args.api_sample_rate))

if args.api_suffix == ".ogg":
# regard ogg as ogg_opus
args.audio_split_cmd = \
args.audio_split_cmd.replace(
"-vn",
"-vn -c:a libopus")

cmdline_utils.validate_aovp_args(args)
cmdline_utils.fix_args(args,
ffmpeg_cmd=ffmpeg_cmd)
fps = cmdline_utils.get_fps(args=args, input_m=input_m)
cmdline_utils.audio_or_video_prcs(args,
fps=fps,
input_m=input_m,
styles_list=styles_list,
no_audio_prcs=no_audio_prcs)
styles_list=styles_list)

elif validate_result == 1:
cmdline_utils.validate_sp_args(args)
Expand Down
Loading

0 comments on commit 67f71e5

Please sign in to comment.