dont set path if encoding failes, set path if not set
This commit is contained in:
parent
5969cf5cf9
commit
35eb535b03
1 changed files with 5 additions and 0 deletions
|
@ -505,15 +505,20 @@ class Stream(models.Model):
|
||||||
def encode(self):
|
def encode(self):
|
||||||
if self.source:
|
if self.source:
|
||||||
media = self.source.media.path
|
media = self.source.media.path
|
||||||
|
if not self.media:
|
||||||
|
self.media.name = os.path.join(os.path.dirname(self.source.media.name), self.name())
|
||||||
target = self.media.path
|
target = self.media.path
|
||||||
info = ox.avinfo(media)
|
info = ox.avinfo(media)
|
||||||
if extract.stream(media, target, self.name(), info):
|
if extract.stream(media, target, self.name(), info):
|
||||||
self.available = True
|
self.available = True
|
||||||
else:
|
else:
|
||||||
|
self.media = None
|
||||||
self.available = False
|
self.available = False
|
||||||
self.save()
|
self.save()
|
||||||
elif self.file.data:
|
elif self.file.data:
|
||||||
media = self.file.data.path
|
media = self.file.data.path
|
||||||
|
if not self.media:
|
||||||
|
self.media.name = self.path(self.name())
|
||||||
target = self.media.path
|
target = self.media.path
|
||||||
info = ox.avinfo(media)
|
info = ox.avinfo(media)
|
||||||
if extract.stream(media, target, self.name(), info):
|
if extract.stream(media, target, self.name(), info):
|
||||||
|
|
Loading…
Reference in a new issue