finished refactoring coub_dl.__call__(). closes #7
This commit is contained in:
parent
65c62260b5
commit
831a1a17dc
15
coub-dl.py
15
coub-dl.py
@ -58,13 +58,9 @@ class coub_dl:
|
|||||||
self.check_downloads()
|
self.check_downloads()
|
||||||
self.fix_video_stream()
|
self.fix_video_stream()
|
||||||
|
|
||||||
self.calculate_loops()
|
|
||||||
|
|
||||||
# write concat helper file for ffmpeg
|
# write concat helper file for ffmpeg
|
||||||
with open(self._files_dict[File.LIST], 'w') as f:
|
self.calculate_loops()
|
||||||
for i in range(self._loopdata.base):
|
self.write_concat_helper()
|
||||||
print("file '{}'".format(self._loopdata.file), file=f)
|
|
||||||
print("file '{}'".format(self._files_dict[File.FRACTION]), file=f)
|
|
||||||
|
|
||||||
# loop & mux streams
|
# loop & mux streams
|
||||||
self.loop_shorter_stream()
|
self.loop_shorter_stream()
|
||||||
@ -122,6 +118,13 @@ class coub_dl:
|
|||||||
self._loopdata.fraction = times % 1
|
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):
|
def loop_shorter_stream(self):
|
||||||
# prepare last fractional loop
|
# prepare last fractional loop
|
||||||
call(('ffmpeg', '-i', self._loopdata.file, '-t', str(self._loopdata.fraction *
|
call(('ffmpeg', '-i', self._loopdata.file, '-t', str(self._loopdata.fraction *
|
||||||
|
Loading…
Reference in New Issue
Block a user