From fc4285933a304c3d1f8af0f5a4a0c8cfaa0ec38e Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 7 Feb 2010 17:45:10 +0530 Subject: [PATCH] add some files, rename stream128 to stream96p --- oxdb/backend/migrations/__init__.py | 0 oxdb/backend/models.py | 31 +++++++++++++------------ oxdb/backend/views.py | 9 +++---- oxdb/oxuser/templates/recover_email.txt | 10 ++++++++ oxdb/settings.py | 6 +++-- 5 files changed, 35 insertions(+), 21 deletions(-) create mode 100644 oxdb/backend/migrations/__init__.py create mode 100644 oxdb/oxuser/templates/recover_email.txt diff --git a/oxdb/backend/migrations/__init__.py b/oxdb/backend/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/oxdb/backend/models.py b/oxdb/backend/models.py index 511d824d3..77ffe756f 100644 --- a/oxdb/backend/models.py +++ b/oxdb/backend/models.py @@ -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 diff --git a/oxdb/backend/views.py b/oxdb/backend/views.py index 21f272c74..5970f8561 100644 --- a/oxdb/backend/views.py +++ b/oxdb/backend/views.py @@ -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,10 +515,10 @@ 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() - f.available = False - f.save() + if f.stream96p: + f.stream96p.delete() + f.available = False + f.save() response = { 'uploadUrl': request.build_absolute_uri('/api/upload/?oshash=%s' % f.oshash), 'result': 1 diff --git a/oxdb/oxuser/templates/recover_email.txt b/oxdb/oxuser/templates/recover_email.txt new file mode 100644 index 000000000..85fd1772b --- /dev/null +++ b/oxdb/oxuser/templates/recover_email.txt @@ -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}} diff --git a/oxdb/settings.py b/oxdb/settings.py index 8d8422a19..53b26fbc5 100644 --- a/oxdb/settings.py +++ b/oxdb/settings.py @@ -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