reset possible error if enoding again

This commit is contained in:
j 2014-01-24 12:05:07 +00:00
parent b7c4d9af41
commit 4387d8e97e

View file

@ -388,10 +388,16 @@ class File(models.Model):
return [self.path] + [i.path for i in self.instances.all()] return [self.path] + [i.path for i in self.instances.all()]
def extract_stream(self): def extract_stream(self):
'''
extract stream from direct upload
'''
import tasks import tasks
return tasks.extract_stream.delay(self.id) return tasks.extract_stream.delay(self.id)
def process_stream(self): def process_stream(self):
'''
extract derivatives from webm upload
'''
import tasks import tasks
return tasks.process_stream.delay(self.id) return tasks.process_stream.delay(self.id)
@ -585,6 +591,10 @@ class Stream(models.Model):
ok, error = extract.stream(media, target, self.name(), info) ok, error = extract.stream(media, target, self.name(), info)
if ok: if ok:
self.available = True self.available = True
self.error = ''
if self.file.failed:
self.file.failed = False
self.file.save()
else: else:
self.media = None self.media = None
self.available = False self.available = False
@ -604,6 +614,10 @@ class Stream(models.Model):
ok, error = extract.stream(media, target, self.name(), info, ffmpeg) ok, error = extract.stream(media, target, self.name(), info, ffmpeg)
if ok: if ok:
self.available = True self.available = True
self.error = ''
if self.file.failed:
self.file.failed = False
self.file.save()
else: else:
self.media = None self.media = None
self.available = False self.available = False