From a39bb01460610efca6799ef404cea88ce8ed0f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Sat, 4 Feb 2017 18:38:08 +0100 Subject: [PATCH] refined work of previous commit --- coub-dl.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/coub-dl.py b/coub-dl.py index 0fb5418..f054670 100644 --- a/coub-dl.py +++ b/coub-dl.py @@ -32,15 +32,15 @@ class File(Enum): FRACTION = 3 OUTPUT = 4 -def call_verbose(before_message=''): - def wrap(f): +def call_verbose(before_message='', after_message='Done!'): + def tag(f): @wraps(f) def wrapper(*args, **kwargs): - print_opt(before_message+' ', end='', flush=True) + print_opt(before_message, end='', flush=True) f(*args, **kwargs) - print_opt('Done!') + print_opt(after_message) return wrapper - return wrap + return tag def print_opt(*args, **kwargs): if VERBOSE: @@ -59,7 +59,7 @@ def getDuration(ffprobe_output): raise ValueError('Cannot process ffprobe output!') return duration -@call_verbose(before_message='Downloading audio stream...') +@call_verbose(before_message='Downloading audio stream... ') def download_audio_stream(): call(('youtube-dl', '--ignore-config', '--extract-audio', @@ -67,7 +67,7 @@ def download_audio_stream(): URL), stdout=DEVNULL, stderr=DEVNULL) -@call_verbose(before_message='Downloading video stream...') +@call_verbose(before_message='Downloading video stream... ') def download_video_stream(): call(('youtube-dl', '--ignore-config', '--output', '{}.%(ext)s'.format(FILES[Stream.VIDEO]),