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

View file

@ -76,10 +76,10 @@ def rebuild_timeline(itemId):
@task(queue="encoding") @task(queue="encoding")
def load_subtitles(itemId): def load_subtitles(itemId):
item = models.Item.objects.get(itemId=itemId) item = models.Item.objects.get(itemId=itemId)
item.load_subtitles() if item.load_subtitles():
item.update_find() item.update_find()
item.update_sort() item.update_sort()
item.update_facets() item.update_facets()
@task(ignore_results=True, queue='default') @task(ignore_results=True, queue='default')
def update_sitemap(base_url): def update_sitemap(base_url):