refactored some method names

This commit is contained in:
Kjistóf 2017-02-04 23:15:33 +01:00
parent e4283ee3b7
commit 424a6e156a
1 changed files with 6 additions and 6 deletions

View File

@ -38,13 +38,13 @@ def print_opt(*args, **kwargs):
print(*args, **kwargs)
def getCmdStdErr(command):
def get_command_stderr(command):
process = Popen(command, stderr=PIPE, stdout=PIPE)
out, err = process.communicate()
return err
def getDuration(ffprobe_output):
def get_duration(ffprobe_output):
durationPattern = r'.*Duration:\s(.+),\sstart.*'
regex = match(durationPattern, str(ffprobe_output))
duration = regex.groups()[0] if regex else None
@ -70,7 +70,7 @@ def download_video_stream():
stdout=DEVNULL, stderr=DEVNULL)
def readExtensions():
def read_extensions():
for file in listdir():
for filename in FILES:
if match('^{}.*'.format(FILES[filename]), file):
@ -171,11 +171,11 @@ if exists(FILES[File.OUTPUT]):
# download streams and update FILE dict with extensions
download_audio_stream()
download_video_stream()
readExtensions()
read_extensions()
# get stream lengths via ffprobe
audioData= getDuration(getCmdStdErr(('ffprobe', FILES[Stream.AUDIO]))).split(':')
videoData = getDuration(getCmdStdErr(('ffprobe', FILES[Stream.VIDEO]))).split(':')
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]))