forked from 0x2620/pandora
findvalue can be Null, clip random sort
This commit is contained in:
parent
be6652f1c9
commit
26c6987178
4 changed files with 18 additions and 3 deletions
|
@ -84,7 +84,7 @@ class Annotation(models.Model):
|
|||
|
||||
layer = models.CharField(max_length=255, db_index=True)
|
||||
value = models.TextField()
|
||||
findvalue = models.TextField()
|
||||
findvalue = models.TextField(null=True)
|
||||
sortvalue = models.CharField(max_length=1000, null=True, blank=True, db_index=True)
|
||||
|
||||
def editable(self, user):
|
||||
|
@ -133,6 +133,7 @@ class Annotation(models.Model):
|
|||
else:
|
||||
self.sortvalue = None
|
||||
else:
|
||||
self.findvalue = None
|
||||
self.sortvalue = None
|
||||
|
||||
#no clip or update clip
|
||||
|
|
|
@ -115,12 +115,14 @@ attrs = {
|
|||
'aspect_ratio': models.FloatField(default=0),
|
||||
|
||||
'item': models.ForeignKey('item.Item', related_name='clips'),
|
||||
'random': models.BigIntegerField(default=0, db_index=True),
|
||||
|
||||
#seconds
|
||||
'start': models.FloatField(default=-1, db_index=True),
|
||||
'end': models.FloatField(default=-1),
|
||||
'duration': models.FloatField(default=0, db_index=True),
|
||||
|
||||
|
||||
#get from annotation
|
||||
'hue': models.FloatField(default=0, db_index=True),
|
||||
'saturation': models.FloatField(default=0, db_index=True),
|
||||
|
@ -130,7 +132,7 @@ attrs = {
|
|||
'director': models.CharField(max_length=1000, null=True, db_index=True),
|
||||
'title': models.CharField(max_length=1000, db_index=True),
|
||||
'sortvalue': models.CharField(max_length=1000, null=True, db_index=True),
|
||||
'findvalue': models.TextField(),
|
||||
'findvalue': models.TextField(null=True),
|
||||
}
|
||||
for name in settings.CONFIG['clipLayers']:
|
||||
attrs[name] = models.BooleanField(default=False, db_index=True)
|
||||
|
|
|
@ -41,7 +41,8 @@ def order_query(qs, sort):
|
|||
operator = ''
|
||||
clip_keys = ('public_id', 'start', 'end', 'hue', 'saturation', 'lightness', 'volume',
|
||||
'duration', 'sortvalue', 'videoRatio',
|
||||
'director', 'title')
|
||||
'director', 'title',
|
||||
'random')
|
||||
key = {
|
||||
'id': 'public_id',
|
||||
'in': 'start',
|
||||
|
|
|
@ -27,6 +27,17 @@ def update_random_sort():
|
|||
models.ItemSort.objects.filter(pk=i).update(random=n)
|
||||
n += 1
|
||||
|
||||
def update_random_clip_sort():
|
||||
if filter(lambda f: f['id'] == 'random', settings.CONFIG['itemKeys']):
|
||||
random.seed()
|
||||
from clip.models import Clip
|
||||
ids = [f['id'] for f in Clip.objects.values('id')]
|
||||
random.shuffle(ids)
|
||||
n = 1
|
||||
for i in ids:
|
||||
Clip.objects.filter(pk=i).update(random=n)
|
||||
n += 1
|
||||
|
||||
@task(ignore_resulsts=True, queue='default')
|
||||
def update_poster(itemId):
|
||||
item = models.Item.objects.get(itemId=itemId)
|
||||
|
|
Loading…
Reference in a new issue