forked from 0x2620/pandora
really fix #2442
This commit is contained in:
parent
fec6258f71
commit
df0c24628c
2 changed files with 4 additions and 11 deletions
|
@ -636,20 +636,12 @@ class Stream(models.Model):
|
|||
for f in config['formats']:
|
||||
derivative, created = Stream.objects.get_or_create(file=self.file,
|
||||
resolution=resolution, format=f)
|
||||
|
||||
name = derivative.name()
|
||||
name = os.path.join(os.path.dirname(self.media.name), name)
|
||||
if created:
|
||||
derivative.source = self
|
||||
derivative.save()
|
||||
derivative.media.name = name
|
||||
derivative.encode()
|
||||
derivative.save()
|
||||
elif rebuild or not derivative.available:
|
||||
if not derivative.media:
|
||||
derivative.media.name = name
|
||||
derivative.encode()
|
||||
return True
|
||||
|
||||
def encode(self):
|
||||
media = self.source.media.path if self.source else self.file.data.path
|
||||
|
@ -660,13 +652,13 @@ class Stream(models.Model):
|
|||
if not self.media:
|
||||
self.media.name = self.path(self.name())
|
||||
target = self.media.path
|
||||
|
||||
info = ox.avinfo(media)
|
||||
ok, error = extract.stream(media, target, self.name(), info, ffmpeg)
|
||||
# file could have been moved while encoding
|
||||
# get current version from db and update
|
||||
_self = Stream.objects.get(id=self.id)
|
||||
_self.update_status(ok, error)
|
||||
return _self
|
||||
|
||||
def update_status(self, ok, error):
|
||||
if ok:
|
||||
|
|
|
@ -130,11 +130,12 @@ def extract_stream(fileId):
|
|||
)
|
||||
if created:
|
||||
stream.media.name = stream.path(stream.name())
|
||||
stream.encode()
|
||||
stream = stream.encode()
|
||||
if stream.available:
|
||||
stream.make_timeline()
|
||||
stream.extract_derivatives()
|
||||
file.item.update_selected()
|
||||
# get current version from db
|
||||
file = models.File.objects.get(id=fileId)
|
||||
if not file.item.rendered:
|
||||
file.item.update_timeline()
|
||||
if file.item.rendered:
|
||||
|
|
Loading…
Reference in a new issue