only call update_timeline once during first import, adds empty clips twice otherwise

This commit is contained in:
j 2015-02-04 15:10:51 +05:30
parent 1be9bb04a8
commit 9a3c24b2ab
2 changed files with 5 additions and 4 deletions

View file

@ -107,7 +107,7 @@ def process_stream(fileId):
file = models.File.objects.get(id=fileId)
file.encoding = False
file.save()
file.item.update_selected()
file.item.update_selected(update_timeline=False)
if not file.item.rendered:
file.item.update_timeline()
if file.item.rendered:

View file

@ -1164,7 +1164,7 @@ class Item(models.Model):
qs = qs.exclude(id__in=wanted)
qs.update(wanted=False)
def update_selected(self):
def update_selected(self, update_timeline=True):
sets = self.sets()
for s in sets:
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:
self.rendered = False
self.save()
if update_timeline:
tasks.update_timeline.delay(self.public_id)
break
if not sets:
@ -1536,7 +1537,7 @@ class Item(models.Model):
return False
with transaction.commit_on_success():
layer = subtitles['id']
Annotation.objects.filter(layer=layer,item=self).delete()
Annotation.objects.filter(layer=layer, item=self).delete()
offset = 0
language = ''
subtitles = self.files.filter(selected=True, is_subtitle=True, available=True)