make derivatives more generic

This commit is contained in:
j 2011-02-06 18:10:28 +05:30
commit 0feeef6d7d
7 changed files with 34 additions and 41 deletions

View file

@ -196,10 +196,13 @@ def stream(video, target, profile, info):
+ audio_settings \
+ video_settings
if format == 'mp4':
cmd += ["%s.mp4"%target]
else:
if format == 'webm':
cmd += ['-f', 'webm', target]
if format == 'mp4':
#mp4 needs postprocessing(qt-faststart), write to temp file
cmd += ["%s.mp4"%target]
else :
cmd += [target]
print cmd
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=open('/dev/null', 'w'), stderr=subprocess.STDOUT)

View file

@ -139,7 +139,7 @@ class File(models.Model):
#upload and data handling
video = models.FileField(null=True, blank=True,
upload_to=lambda f, x: f.path('%s.webm'%settings.VIDEO_PROFILE))
upload_to=lambda f, x: f.path(settings.VIDEO_PROFILE))
data = models.FileField(null=True, blank=True,
upload_to=lambda f, x: f.path('data.bin'))
@ -221,7 +221,7 @@ class File(models.Model):
def save_chunk(self, chunk, chunk_id=-1):
if not self.available:
if not self.video:
self.video.save('%s.webm'%settings.VIDEO_PROFILE, chunk)
self.video.save(settings.VIDEO_PROFILE, chunk)
else:
f = open(self.video.path, 'a')
#FIXME: should check that chunk_id/offset is right

View file

@ -161,8 +161,6 @@ class VideoChunkForm(forms.Form):
@login_required_json
def firefogg_upload(request):
profile = request.GET['profile']
if profile.endswith('.webm'):
profile = os.path.splitext(profile)[0]
oshash = request.GET['oshash']
#handle video upload
if request.method == 'POST':