reorder code so that item status does not get overwritten

This commit is contained in:
j 2012-09-08 14:41:19 +02:00
parent 570d9ed0ff
commit e3d0893a00
2 changed files with 8 additions and 7 deletions

View file

@ -1055,10 +1055,10 @@ class Item(models.Model):
self.make_icon()
if settings.CONFIG['video']['download']:
self.make_torrent()
tasks.load_subtitles.delay(self.itemId)
get_sequences.delay(self.itemId)
self.rendered = streams.count() > 0
self.save()
tasks.load_subtitles.delay(self.itemId)
get_sequences.delay(self.itemId)
def delete_poster(self):
if self.poster:
@ -1207,7 +1207,7 @@ class Item(models.Model):
def load_subtitles(self):
if not utils.get_by_id(settings.CONFIG['layers'], 'subtitles'):
return
return False
with transaction.commit_on_success():
layer = 'subtitles'
Annotation.objects.filter(layer=layer,item=self).delete()
@ -1268,6 +1268,7 @@ class Item(models.Model):
offset += f.duration
#remove left over clips without annotations
Clip.objects.filter(item=self, annotations__id=None).delete()
return True
def srt(self, layer):
def format_value(value):

View file

@ -76,7 +76,7 @@ def rebuild_timeline(itemId):
@task(queue="encoding")
def load_subtitles(itemId):
item = models.Item.objects.get(itemId=itemId)
item.load_subtitles()
if item.load_subtitles():
item.update_find()
item.update_sort()
item.update_facets()