diff --git a/coub-dl.py b/coub-dl.py index 40545b0..0b45922 100755 --- a/coub-dl.py +++ b/coub-dl.py @@ -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 *