removed all ui logic from coub_dl class
This commit is contained in:
parent
093bcb5567
commit
8622f35fdc
14
coub-dl.py
14
coub-dl.py
@ -83,7 +83,6 @@ class coub_dl:
|
||||
self.mux_streams()
|
||||
|
||||
|
||||
@call_verbose(before_message='Downloading audio stream... ')
|
||||
def download_audio_stream(self):
|
||||
call(('youtube-dl', '--ignore-config',
|
||||
'--extract-audio',
|
||||
@ -92,7 +91,6 @@ class coub_dl:
|
||||
stdout=DEVNULL, stderr=DEVNULL)
|
||||
|
||||
|
||||
@call_verbose(before_message='Downloading video stream... ')
|
||||
def download_video_stream(self):
|
||||
call(('youtube-dl', '--ignore-config',
|
||||
'--output', '{}.%(ext)s'.format(self._files_dict[Stream.VIDEO]),
|
||||
@ -121,7 +119,6 @@ class coub_dl:
|
||||
f.write(bytes(2))
|
||||
|
||||
|
||||
@call_verbose(before_message='Looping shorter stream... ')
|
||||
def loop_shorter_stream(self, shorter, shorter_file, loop_fraction):
|
||||
# prepare last fractional loop
|
||||
call(('ffmpeg', '-i', shorter_file, '-t', str(loop_fraction * shorter.total_seconds()),
|
||||
@ -134,7 +131,6 @@ class coub_dl:
|
||||
stdout=DEVNULL, stderr=DEVNULL)
|
||||
|
||||
|
||||
@call_verbose(before_message='Muxing streams... ')
|
||||
def mux_streams(self):
|
||||
call(('ffmpeg', '-i', self._files_dict[File.LOOP],
|
||||
'-i', self._files_dict[Stream.AUDIO],
|
||||
@ -216,10 +212,20 @@ def parse_cmd_arguments():
|
||||
return args
|
||||
|
||||
|
||||
def decorate_coubdl_uimsgs(*args):
|
||||
for item in args:
|
||||
setattr(coub_dl, item[0],
|
||||
call_verbose(**item[1])(getattr(coub_dl, item[0])))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
signal(SIGINT, lambda a, b: exit('\nExiting!'))
|
||||
args = parse_cmd_arguments()
|
||||
utility.VERBOSE = False if args.nonverbose else True
|
||||
decorate_coubdl_uimsgs(('download_audio_stream', {'before_message': 'Downloading audio stream... '}),
|
||||
('download_video_stream', {'before_message': 'Downloading video stream... '}),
|
||||
('loop_shorter_stream', {'before_message': 'Looping shorter stream... '}),
|
||||
('mux_streams', {'before_message': 'Muxing streams... '}))
|
||||
|
||||
check_dependencies((('youtube-dl', '--version'), ('ffmpeg', '-version')))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user