From c54f47590bf5d057a05cbe3576695b20d98ca3ba Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 26 Aug 2011 17:52:08 +0200 Subject: [PATCH] cleanup file state --- pandora/archive/models.py | 3 ++- pandora/archive/views.py | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pandora/archive/models.py b/pandora/archive/models.py index cbb66530..f7fae818 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -154,7 +154,8 @@ class File(models.Model): if self.is_subtitle: self.available = self.data and True or False else: - self.available = self.streams.filter(source=None, available=True).count() > 0 + self.available = not self.uploading and \ + self.streams.filter(source=None, available=True).count() > 0 super(File, self).save(*args, **kwargs) #upload and data handling diff --git a/pandora/archive/views.py b/pandora/archive/views.py index 933c728a..00535908 100644 --- a/pandora/archive/views.py +++ b/pandora/archive/views.py @@ -153,7 +153,6 @@ def upload(request): if f.data: f.data.delete() f.data.save('data.raw', request.FILES['file']) - f.available = True f.save() item.tasks.load_subtitles.delay(f.item.itemId) response = json_response(text='file saved') @@ -192,7 +191,6 @@ def firefogg_upload(request): if not f.save_chunk(c, chunk_id, form.cleaned_data['done']): response['result'] = -1 elif form.cleaned_data['done']: - f.available = True f.uploading = False f.save() #FIXME: this fails badly if rabbitmq goes down @@ -210,7 +208,6 @@ def firefogg_upload(request): f = get_object_or_404(models.File, oshash=oshash) if f.editable(request.user): f.streams.all().delete() - f.available = False f.uploading = True f.save() response = {