diff --git a/pandora/archive/models.py b/pandora/archive/models.py index cbb6653..f7fae81 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 933c728..0053590 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 = {