finished refactoring coub_dl.__call__(). closes #7

This commit is contained in:
Kjistóf 2017-10-30 14:54:05 +01:00
parent 65c62260b5
commit 831a1a17dc
1 changed files with 9 additions and 6 deletions

View File

@ -58,13 +58,9 @@ class coub_dl:
self.check_downloads()
self.fix_video_stream()
self.calculate_loops()
# write concat helper file for ffmpeg
with open(self._files_dict[File.LIST], 'w') as f:
for i in range(self._loopdata.base):
print("file '{}'".format(self._loopdata.file), file=f)
print("file '{}'".format(self._files_dict[File.FRACTION]), file=f)
self.calculate_loops()
self.write_concat_helper()
# loop & mux streams
self.loop_shorter_stream()
@ -122,6 +118,13 @@ class coub_dl:
self._loopdata.fraction = times % 1
def write_concat_helper(self):
with open(self._files_dict[File.LIST], 'w') as f:
for i in range(self._loopdata.base):
f.write("file '{}'\n".format(self._loopdata.file))
f.write("file '{}'\n".format(self._files_dict[File.FRACTION]))
def loop_shorter_stream(self):
# prepare last fractional loop
call(('ffmpeg', '-i', self._loopdata.file, '-t', str(self._loopdata.fraction *