diff --git a/pandora/item/models.py b/pandora/item/models.py index 1075406e6..dd626adff 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -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): diff --git a/pandora/item/tasks.py b/pandora/item/tasks.py index bc4d6d310..7480f5efc 100644 --- a/pandora/item/tasks.py +++ b/pandora/item/tasks.py @@ -76,10 +76,10 @@ def rebuild_timeline(itemId): @task(queue="encoding") def load_subtitles(itemId): item = models.Item.objects.get(itemId=itemId) - item.load_subtitles() - item.update_find() - item.update_sort() - item.update_facets() + if item.load_subtitles(): + item.update_find() + item.update_sort() + item.update_facets() @task(ignore_results=True, queue='default') def update_sitemap(base_url):