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']:
|
for f in config['formats']:
|
||||||
derivative, created = Stream.objects.get_or_create(file=self.file,
|
derivative, created = Stream.objects.get_or_create(file=self.file,
|
||||||
resolution=resolution, format=f)
|
resolution=resolution, format=f)
|
||||||
|
|
||||||
name = derivative.name()
|
|
||||||
name = os.path.join(os.path.dirname(self.media.name), name)
|
|
||||||
if created:
|
if created:
|
||||||
derivative.source = self
|
derivative.source = self
|
||||||
derivative.save()
|
derivative.save()
|
||||||
derivative.media.name = name
|
|
||||||
derivative.encode()
|
derivative.encode()
|
||||||
derivative.save()
|
|
||||||
elif rebuild or not derivative.available:
|
elif rebuild or not derivative.available:
|
||||||
if not derivative.media:
|
|
||||||
derivative.media.name = name
|
|
||||||
derivative.encode()
|
derivative.encode()
|
||||||
return True
|
|
||||||
|
|
||||||
def encode(self):
|
def encode(self):
|
||||||
media = self.source.media.path if self.source else self.file.data.path
|
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:
|
if not self.media:
|
||||||
self.media.name = self.path(self.name())
|
self.media.name = self.path(self.name())
|
||||||
target = self.media.path
|
target = self.media.path
|
||||||
|
|
||||||
info = ox.avinfo(media)
|
info = ox.avinfo(media)
|
||||||
ok, error = extract.stream(media, target, self.name(), info, ffmpeg)
|
ok, error = extract.stream(media, target, self.name(), info, ffmpeg)
|
||||||
# file could have been moved while encoding
|
# file could have been moved while encoding
|
||||||
# get current version from db and update
|
# get current version from db and update
|
||||||
_self = Stream.objects.get(id=self.id)
|
_self = Stream.objects.get(id=self.id)
|
||||||
_self.update_status(ok, error)
|
_self.update_status(ok, error)
|
||||||
|
return _self
|
||||||
|
|
||||||
def update_status(self, ok, error):
|
def update_status(self, ok, error):
|
||||||
if ok:
|
if ok:
|
||||||
|
|
|
@ -130,11 +130,12 @@ def extract_stream(fileId):
|
||||||
)
|
)
|
||||||
if created:
|
if created:
|
||||||
stream.media.name = stream.path(stream.name())
|
stream.media.name = stream.path(stream.name())
|
||||||
stream.encode()
|
stream = stream.encode()
|
||||||
if stream.available:
|
if stream.available:
|
||||||
stream.make_timeline()
|
stream.make_timeline()
|
||||||
stream.extract_derivatives()
|
stream.extract_derivatives()
|
||||||
file.item.update_selected()
|
# get current version from db
|
||||||
|
file = models.File.objects.get(id=fileId)
|
||||||
if not file.item.rendered:
|
if not file.item.rendered:
|
||||||
file.item.update_timeline()
|
file.item.update_timeline()
|
||||||
if file.item.rendered:
|
if file.item.rendered:
|
||||||
|
|
Loading…
Reference in a new issue