load subtitles async

This commit is contained in:
j 2012-03-23 17:37:32 +01:00
parent 8fac4c558d
commit a4ac2e03d4
3 changed files with 6 additions and 4 deletions

View file

@ -132,7 +132,8 @@ attrs = {
'volume': models.FloatField(default=0, null=True, db_index=True),
'sortvalue': models.CharField(max_length=1000, null=True, db_index=True),
'findvalue': models.TextField(null=True),
#run this CREATE INDEX clip_clip_findvalue_idx ON clip_clip USING gin (findvalue gin_trgm_ops);
'findvalue': models.TextField(null=True, db_index=True),
}
for name in settings.CONFIG['clipLayers']:
attrs[name] = models.BooleanField(default=False, db_index=True)

View file

@ -1039,7 +1039,7 @@ class Item(models.Model):
self.make_icon()
if settings.CONFIG['video']['download']:
self.make_torrent()
self.load_subtitles()
tasks.load_subtitles.delay(self.itemId)
self.rendered = streams.count() > 0
self.save()
@ -1294,7 +1294,8 @@ class ItemFind(models.Model):
item = models.ForeignKey('Item', related_name='find', db_index=True)
key = models.CharField(max_length=200, db_index=True)
value = models.TextField(blank=True)
#CREATE INDEX item_itemfind_value_idx ON item_itemfind USING gin (value gin_trgm_ops);
value = models.TextField(blank=True, db_index=True)
def __unicode__(self):
return u"%s=%s" % (self.key, self.value)

View file

@ -64,7 +64,7 @@ def update_timeline(itemId):
item = models.Item.objects.get(itemId=itemId)
item.update_timeline()
@task(queue="default")
@task(queue="encoding")
def load_subtitles(itemId):
item = models.Item.objects.get(itemId=itemId)
item.load_subtitles()