cleanup file state
This commit is contained in:
parent
56b292619d
commit
c54f47590b
2 changed files with 2 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Reference in a new issue