remove cached frames

This commit is contained in:
j 2012-01-07 16:18:05 +05:30
parent e89c0e30b2
commit fa05c9d297
3 changed files with 14 additions and 1 deletions

View file

@ -126,8 +126,14 @@ def stream(video, target, profile, info):
#'-vf', 'yadif', #'-vf', 'yadif',
'-vf', 'hqdn3d,scale=%s:%s'%(width, height), '-vf', 'hqdn3d,scale=%s:%s'%(width, height),
'-g', '%d' % int(fps*5), '-g', '%d' % int(fps*5),
'-keyint_min', '%d' % int(fps*2),
] ]
if format == 'webm':
video_settings += [
'-deadline', 'good',
'-cpu-used', '0',
'-lag-in-frames', '16',
'-auto-alt-ref', '1',
]
if format == 'mp4': if format == 'mp4':
#quicktime does not support bpyramid #quicktime does not support bpyramid
''' '''

View file

@ -5,6 +5,7 @@ from __future__ import division, with_statement
import os.path import os.path
import re import re
import time import time
import shutil
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
@ -276,6 +277,11 @@ class File(models.Model):
return instance.path return instance.path
return self.path return self.path
def delete_frames(self):
frames = os.path.join(settings.MEDIA_ROOT, self.get_path('frames'))
if os.path.exists(frames):
shutil.rmtree(frames)
def delete_file(sender, **kwargs): def delete_file(sender, **kwargs):
f = kwargs['instance'] f = kwargs['instance']
#FIXME: delete streams here #FIXME: delete streams here

View file

@ -206,6 +206,7 @@ def firefogg_upload(request):
f = get_object_or_404(models.File, oshash=oshash) f = get_object_or_404(models.File, oshash=oshash)
if f.editable(request.user): if f.editable(request.user):
f.streams.all().delete() f.streams.all().delete()
f.delete_frames()
f.uploading = True f.uploading = True
f.save() f.save()
response = { response = {