only call update_timeline once during first import, adds empty clips twice otherwise
This commit is contained in:
parent
1be9bb04a8
commit
9a3c24b2ab
2 changed files with 5 additions and 4 deletions
|
@ -107,7 +107,7 @@ def process_stream(fileId):
|
||||||
file = models.File.objects.get(id=fileId)
|
file = models.File.objects.get(id=fileId)
|
||||||
file.encoding = False
|
file.encoding = False
|
||||||
file.save()
|
file.save()
|
||||||
file.item.update_selected()
|
file.item.update_selected(update_timeline=False)
|
||||||
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:
|
||||||
|
|
|
@ -1164,7 +1164,7 @@ class Item(models.Model):
|
||||||
qs = qs.exclude(id__in=wanted)
|
qs = qs.exclude(id__in=wanted)
|
||||||
qs.update(wanted=False)
|
qs.update(wanted=False)
|
||||||
|
|
||||||
def update_selected(self):
|
def update_selected(self, update_timeline=True):
|
||||||
sets = self.sets()
|
sets = self.sets()
|
||||||
for s in sets:
|
for s in sets:
|
||||||
if s.filter(Q(is_video=True)|Q(is_audio=True)).filter(available=False).count() == 0:
|
if s.filter(Q(is_video=True)|Q(is_audio=True)).filter(available=False).count() == 0:
|
||||||
|
@ -1180,6 +1180,7 @@ class Item(models.Model):
|
||||||
if update:
|
if update:
|
||||||
self.rendered = False
|
self.rendered = False
|
||||||
self.save()
|
self.save()
|
||||||
|
if update_timeline:
|
||||||
tasks.update_timeline.delay(self.public_id)
|
tasks.update_timeline.delay(self.public_id)
|
||||||
break
|
break
|
||||||
if not sets:
|
if not sets:
|
||||||
|
@ -1536,7 +1537,7 @@ class Item(models.Model):
|
||||||
return False
|
return False
|
||||||
with transaction.commit_on_success():
|
with transaction.commit_on_success():
|
||||||
layer = subtitles['id']
|
layer = subtitles['id']
|
||||||
Annotation.objects.filter(layer=layer,item=self).delete()
|
Annotation.objects.filter(layer=layer, item=self).delete()
|
||||||
offset = 0
|
offset = 0
|
||||||
language = ''
|
language = ''
|
||||||
subtitles = self.files.filter(selected=True, is_subtitle=True, available=True)
|
subtitles = self.files.filter(selected=True, is_subtitle=True, available=True)
|
||||||
|
|
Loading…
Reference in a new issue