continued refactor-streak
This commit is contained in:
parent
bb680ad5b7
commit
abc7d96b04
12
coub-dl.py
12
coub-dl.py
@ -107,6 +107,11 @@ def cleanup(file_dict, outputs):
|
||||
pass
|
||||
|
||||
|
||||
def get_length(file):
|
||||
data = get_duration(get_command_stderr(('ffprobe', file))).split(':')
|
||||
return timedelta(hours=float(data[0]), minutes=float(data[1]), seconds=float(data[2]))
|
||||
|
||||
|
||||
def yes_no_question(question, default):
|
||||
valid = {"yes": True, "y": True, "ye": True,
|
||||
"no": False, "n": False}
|
||||
@ -176,11 +181,8 @@ download_video_stream(URL, FILES)
|
||||
read_extensions(FILES)
|
||||
|
||||
# get stream lengths via ffprobe
|
||||
audioData= get_duration(get_command_stderr(('ffprobe', FILES[Stream.AUDIO]))).split(':')
|
||||
videoData = get_duration(get_command_stderr(('ffprobe', FILES[Stream.VIDEO]))).split(':')
|
||||
|
||||
audioLen = timedelta(hours=float(audioData[0]), minutes=float(audioData[1]), seconds=float(audioData[2]))
|
||||
videoLen = timedelta(hours=float(videoData[0]), minutes=float(videoData[1]), seconds=float(videoData[2]))
|
||||
audioLen = get_length(FILES[Stream.AUDIO])
|
||||
videoLen = get_length(FILES[Stream.VIDEO])
|
||||
|
||||
# decide which stream needs some looping
|
||||
longer = audioLen if audioLen > videoLen else videoLen
|
||||
|
Loading…
Reference in New Issue
Block a user