add some files, rename stream128 to stream96p

This commit is contained in:
j 2010-02-07 17:45:10 +05:30
parent 50f014f622
commit fc4285933a
5 changed files with 35 additions and 21 deletions

View file

View file

@ -306,7 +306,7 @@ class Movie(models.Model):
#stream related fields
'''
'''
stream128 = models.FileField(default=None, blank=True, upload_to=lambda f, x: movie_path(f, '128'))
stream96p = models.FileField(default=None, blank=True, upload_to=lambda f, x: movie_path(f, '96p'))
stream320 = models.FileField(default=None, blank=True, upload_to=lambda f, x: movie_path(f, '320'))
stream640 = models.FileField(default=None, blank=True, upload_to=lambda f, x: movie_path(f, '640'))
#FIXME: is this still required? should this not be aspect ratio? depends on stream???
@ -1044,16 +1044,17 @@ class File(models.Model):
#stream related fields
available = models.BooleanField(default=False)
stream128 = models.FileField(default=None, upload_to=lambda f, x: stream_path(f, '128'))
stream96p = models.FileField(default=None, upload_to=lambda f, x: stream_path(f, '96p'))
stream320 = models.FileField(default=None, upload_to=lambda f, x: stream_path(f, '320'))
stream640 = models.FileField(default=None, upload_to=lambda f, x: stream_path(f, '640'))
timeline = models.ImageField(default=None, null=True, upload_to=lambda f, x: timeline_path(f))
def timeline_base_url(self):
return '%s/timeline' % os.path.dirname(self.stream96p.url)
def save_chunk(self, chunk, name='video.ogv'):
if not self.available:
#FIXME: this should use stream128 or stream640 depending on configuration
video = getattr(self, 'stream128')
#FIXME: this should use stream96p or stream640 depending on configuration
video = getattr(self, 'stream96p')
if not video:
video.save(name, chunk)
self.save()
@ -1062,7 +1063,7 @@ class File(models.Model):
f.write(chunk.read())
f.close()
return True
print "somehing failed, not sure what?"
print "somehing failed, not sure what?", self.available
return False
objects = managers.FileManager()
@ -1119,8 +1120,8 @@ class File(models.Model):
video = self.stream640.path
elif stream320:
video = self.stream320.path
elif stream128:
video = self.stream128.path
elif stream96p:
video = self.stream96p.path
else:
return False
prefix = os.path.join(os.path.dirname(video), 'timeline')
@ -1136,14 +1137,14 @@ class File(models.Model):
self.stream320.name = stream_path(self, '320')
self.stream320.save()
ogg.encode(self.stream640.path, self.stream320.path, settings.VIDEO320)
#128 stream
self.stream128.name = stream_path(self, '128')
self.stream128.save()
ogg.encode(self.stream640.path, self.stream128.path, settings.VIDEO128)
#96p stream
self.stream96p.name = stream_path(self, '96p')
self.stream96p.save()
ogg.encode(self.stream640.path, self.stream96p.path, settings.VIDEO96P)
elif self.stream320:
self.stream128.name = stream_path(self, '128')
self.stream128.save()
ogg.encode(self.stream320.path, self.stream128.path, settings.VIDEO128)
self.stream96p.name = stream_path(self, '96p')
self.stream96p.save()
ogg.encode(self.stream320.path, self.stream96p.path, settings.VIDEO96P)
def extract(self):
#FIXME: do stuff, like create timeline or create smaller videos etc

View file

@ -474,6 +474,7 @@ class VideoChunkForm(forms.Form):
chunk = forms.FileField()
done = forms.IntegerField(required=False)
@login_required_json
def api_upload(request): #video, timeline, frame
'''
upload video, timeline or frame
@ -514,8 +515,8 @@ def firefogg_upload(request):
#FIXME: what to do if requested oshash is not in db?
#FIXME: should existing data be reset here? or better, should this fail if an upload was there
f = get_object_or_404(models.File, oshash=request.POST['oshash'])
if f.stream128:
f.stream128.delete()
if f.stream96p:
f.stream96p.delete()
f.available = False
f.save()
response = {

View file

@ -0,0 +1,10 @@
Somebody requested a new password for your {{sitename}} account.
If it is you, and if you forgot your password, you can login
by clicking the following url:
{{recover_url}}
If you did not request a password, you can safely ignore this e-mail.
{{sitename}}

View file

@ -109,8 +109,10 @@ BROKER_PASSWORD = "0xdb"
BROKER_VHOST = "/oxdb"
#Video encoding settings
VIDEO128 = {'profile': 'padma-stream', 'samplerate': 44100, 'noUpscaling': True}
VIDEO320 = {'maxSize': 320, 'samplerate': 44100, 'videoBitrate': 500, 'audioQuality': 0, 'channels': 1, 'noUpscaling': True}
VIDEO96P = {'height': 96, 'videoBitrate': 180, 'softTarget': True,
'samplerate': 44100, 'audioQuality': -1, 'channels': 1, 'noUpscaling': True}
VIDEO320 = {'maxSize': 320, 'videoBitrate': 500,
'samplerate': 44100, 'audioQuality': 0, 'channels': 1, 'noUpscaling': True}
VIDEO640 = {'profile': 'padma'}
#overwrite default settings with local settings