From 29395aeefffebe31fb6aa4d8ab3176e55efbc0de Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 2 Jan 2012 09:20:54 +0530 Subject: [PATCH] ignore text files --- pandora/archive/management/commands/import_streams.py | 7 ++++++- pandora/archive/models.py | 3 +++ pandora/archive/views.py | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pandora/archive/management/commands/import_streams.py b/pandora/archive/management/commands/import_streams.py index 9b4dbe09f..06ecfa434 100644 --- a/pandora/archive/management/commands/import_streams.py +++ b/pandora/archive/management/commands/import_streams.py @@ -5,7 +5,7 @@ from django.conf import settings import os from glob import glob -from ... import models +from ... import models, extract class Command(BaseCommand): @@ -51,6 +51,11 @@ class Command(BaseCommand): for s in models.Stream.objects.filter(source=None): if not glob("%s*"%s.timeline_prefix): s.make_timeline() + if not s.color: + s.cuts = tuple(extract.cuts(self.timeline_prefix)) + s.color = tuple(extract.average_color(self.timeline_prefix)) + s.save() + s.file.selected = True s.file.save() s.file.item.update_timeline() diff --git a/pandora/archive/models.py b/pandora/archive/models.py index d8ca22aa4..c8c2de376 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -97,8 +97,11 @@ class File(models.Model): self.is_audio = False if self.path.endswith('.jpg') or \ self.path.endswith('.png') or \ + self.path.endswith('.txt') or \ + self.video_codec == 'ansi' or \ self.duration == 0.04: self.is_video = False + self.video_codec = '' else: self.is_video = False self.display_aspect_ratio = "4:3" diff --git a/pandora/archive/views.py b/pandora/archive/views.py index 1738435c2..7aa4e6aff 100644 --- a/pandora/archive/views.py +++ b/pandora/archive/views.py @@ -184,7 +184,7 @@ def firefogg_upload(request): chunk_id = form.cleaned_data['chunkId'] response = { 'result': 1, - 'resultUrl': request.build_absolute_uri('/') + 'resultUrl': request.build_absolute_uri('/%s'%f.item.itemId) } if not f.save_chunk(c, chunk_id, form.cleaned_data['done']): response['result'] = -1 @@ -210,7 +210,7 @@ def firefogg_upload(request): f.save() response = { 'uploadUrl': request.build_absolute_uri('/api/upload/?id=%s&profile=%s' % (f.oshash, profile)), - 'url': request.build_absolute_uri('/%s/files' % f.item.itemId), + 'url': request.build_absolute_uri('/%s' % f.item.itemId), 'result': 1 } return render_to_json_response(response)