only extract keyframe index for video files

This commit is contained in:
j 2018-12-23 14:11:22 +01:00
parent 466c85190f
commit 01f32871fd
2 changed files with 4 additions and 2 deletions

View file

@ -352,6 +352,7 @@ def stream(video, target, profile, info, audio_track=0, flags={}):
shutil.move(enc_target, target) shutil.move(enc_target, target)
for f in glob('%s.log*' % target): for f in glob('%s.log*' % target):
os.unlink(f) os.unlink(f)
if info['video']:
make_keyframe_index(target) make_keyframe_index(target)
return True, None return True, None

View file

@ -370,6 +370,7 @@ class File(models.Model):
self.info.update(stream.info) self.info.update(stream.info)
self.parse_info() self.parse_info()
self.save() self.save()
if stream.info.get('video'):
extract.make_keyframe_index(stream.media.path) extract.make_keyframe_index(stream.media.path)
return True, stream.media.size return True, stream.media.size
return save_chunk(stream, stream.media, chunk, offset, name, done_cb) return save_chunk(stream, stream.media, chunk, offset, name, done_cb)