also encode audio files
This commit is contained in:
parent
d78ccaeeda
commit
15da3c1d5b
1 changed files with 11 additions and 10 deletions
|
@ -38,8 +38,7 @@ def encode(filename, prefix, profile, info=None, extract_frames=True):
|
|||
oshash = info['oshash']
|
||||
frames = []
|
||||
cache = os.path.join(prefix, os.path.join(*utils.hash_prefix(oshash)))
|
||||
if info.get('video'):
|
||||
if extract_frames:
|
||||
if info.get('video') and extract_frames:
|
||||
for pos in utils.video_frame_positions(info['duration']):
|
||||
frame_name = '%s.png' % pos
|
||||
frame_f = os.path.join(cache, frame_name)
|
||||
|
@ -47,8 +46,10 @@ def encode(filename, prefix, profile, info=None, extract_frames=True):
|
|||
print frame_f
|
||||
extract.frame(filename, frame_f, pos)
|
||||
frames.append(frame_f)
|
||||
if info.get('video') or info.get('audio'):
|
||||
media_f = os.path.join(cache, profile)
|
||||
if not os.path.exists(media_f):
|
||||
if not os.path.exists(media_f) \
|
||||
or os.stat(media_f).st_size == 0:
|
||||
extract.video(filename, media_f, profile, info)
|
||||
else:
|
||||
print info
|
||||
|
|
Loading…
Reference in a new issue