Skip to content

Commit

Permalink
Add (close #7) audio preprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
BingLingGroup committed Jul 20, 2019
1 parent 70abec8 commit 28b8e55
Show file tree
Hide file tree
Showing 12 changed files with 2,469 additions and 2,295 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Click up arrow to go back to TOC.
- Add py-googletrans control args. [issue #36](https://github.com/BingLingGroup/autosub/issues/36)
- Add lang codes support.(Depend on langcodes package) [issue #34](https://github.com/BingLingGroup/autosub/issues/34)
- Add complex ass json output. [issue #39](https://github.com/BingLingGroup/autosub/issues/39)
- Add audio preprocessing. [issue #7](https://github.com/BingLingGroup/autosub/issues/7)

#### Changed(Unreleased)

Expand Down
34 changes: 33 additions & 1 deletion autosub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,46 @@ def main(): # pylint: disable=too-many-branches, too-many-statements, too-many-

styles_list = []
validate_result = cmdline_utils.validate_io(args, styles_list)

if validate_result == 0:
if args.audio_process:
if args.audio_process == 'y':
args.input = ffmpeg_utils.audio_pre_prcs(
filename=args.input,
is_keep=args.keep,
cmds=args.audio_process_cmd,
input_m=input_m,
ffmpeg_cmd=ffmpeg_cmd
)
print("Audio pre-processing complete.")
is_flac = True
elif args.audio_process == 'o':
args.keep = True
args.input = ffmpeg_utils.audio_pre_prcs(
filename=args.input,
is_keep=args.keep,
cmds=args.audio_process_cmd,
input_m=input_m,
ffmpeg_cmd=ffmpeg_cmd
)
raise core.PrintAndStopException(
"Audio pre-processing complete.\nAll works done."
)
elif args.audio_process == 'n':
is_flac = True
else:
is_flac = False
else:
is_flac = False

cmdline_utils.validate_aovp_args(args)
cmdline_utils.fix_args(args)
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)
styles_list=styles_list,
is_flac=is_flac)

elif validate_result == 1:
cmdline_utils.validate_sp_args(args)
Expand Down
58 changes: 29 additions & 29 deletions autosub/__main__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Defines autosub's entry point.
"""

from __future__ import absolute_import, print_function, unicode_literals

# Import built-in modules
# pylint: disable=no-member, protected-access
import multiprocessing
import sys


if __package__ is None and not hasattr(sys, "frozen"):
# direct call of __main__.py
# Reference: https://github.com/rg3/youtube-dl/blob/master/youtube_dl/__main__.py
import os.path
PATH = os.path.realpath(os.path.abspath(__file__))
sys.path.insert(0, os.path.dirname(os.path.dirname(PATH)))

# Any changes to the path and your own modules

if __name__ == "__main__":
# On Windows calling this function is necessary.
if sys.platform.startswith('win'):
multiprocessing.freeze_support()
import autosub
autosub.main()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Defines autosub's entry point.
"""

from __future__ import absolute_import, print_function, unicode_literals

# Import built-in modules
# pylint: disable=no-member, protected-access
import multiprocessing
import sys


if __package__ is None and not hasattr(sys, "frozen"):
# direct call of __main__.py
# Reference: https://github.com/rg3/youtube-dl/blob/master/youtube_dl/__main__.py
import os.path
PATH = os.path.realpath(os.path.abspath(__file__))
sys.path.insert(0, os.path.dirname(os.path.dirname(PATH)))

# Any changes to the path and your own modules

if __name__ == "__main__":
# On Windows calling this function is necessary.
if sys.platform.startswith('win'):
multiprocessing.freeze_support()
import autosub
autosub.main()
Loading

0 comments on commit 28b8e55

Please sign in to comment.