forked from 0x2620/pandora
only update clip values after creation
This commit is contained in:
parent
e33c218c6b
commit
e3b5e2a6e7
2 changed files with 18 additions and 16 deletions
|
@ -35,7 +35,9 @@ class MetaClip:
|
||||||
streams = self.item.streams()
|
streams = self.item.streams()
|
||||||
if streams:
|
if streams:
|
||||||
self.aspect_ratio = streams[0].aspect_ratio
|
self.aspect_ratio = streams[0].aspect_ratio
|
||||||
|
if self.id:
|
||||||
sortvalue = ''
|
sortvalue = ''
|
||||||
|
if self.id:
|
||||||
for l in settings.CONFIG['clipLayers']:
|
for l in settings.CONFIG['clipLayers']:
|
||||||
sortvalue += ''.join(filter(lambda s: s,
|
sortvalue += ''.join(filter(lambda s: s,
|
||||||
[a.sortvalue
|
[a.sortvalue
|
||||||
|
@ -45,7 +47,6 @@ class MetaClip:
|
||||||
else:
|
else:
|
||||||
self.sortvalue = None
|
self.sortvalue = None
|
||||||
self.findvalue = '\n'.join(filter(None, [a.findvalue for a in self.annotations.all()]))
|
self.findvalue = '\n'.join(filter(None, [a.findvalue for a in self.annotations.all()]))
|
||||||
if self.id:
|
|
||||||
for l in settings.CONFIG['clipLayers']:
|
for l in settings.CONFIG['clipLayers']:
|
||||||
setattr(self, l, self.annotations.filter(layer=l).count()>0)
|
setattr(self, l, self.annotations.filter(layer=l).count()>0)
|
||||||
models.Model.save(self, *args, **kwargs)
|
models.Model.save(self, *args, **kwargs)
|
||||||
|
|
|
@ -97,9 +97,10 @@ def findClips(request):
|
||||||
def add(p):
|
def add(p):
|
||||||
ids.append(p.id)
|
ids.append(p.id)
|
||||||
return p.json(keys=keys)
|
return p.json(keys=keys)
|
||||||
response['data']['items'] = [add(p) for p in qs]
|
|
||||||
|
|
||||||
|
response['data']['items'] = [add(p) for p in qs]
|
||||||
keys = data['keys']
|
keys = data['keys']
|
||||||
|
|
||||||
def add_annotations(key, qs, add_layer=False):
|
def add_annotations(key, qs, add_layer=False):
|
||||||
values = ['public_id', 'value', 'clip__public_id']
|
values = ['public_id', 'value', 'clip__public_id']
|
||||||
if add_layer:
|
if add_layer:
|
||||||
|
@ -120,12 +121,12 @@ def findClips(request):
|
||||||
i[key].append(l)
|
i[key].append(l)
|
||||||
if response['data']['items']:
|
if response['data']['items']:
|
||||||
if 'annotations' in keys:
|
if 'annotations' in keys:
|
||||||
add_annotations('annotations',
|
aqs = Annotation.objects.filter(layer__in=settings.CONFIG['clipLayers'],
|
||||||
Annotation.objects.filter(layer__in=settings.CONFIG['clipLayers'],
|
clip__in=ids)
|
||||||
clip__in=ids), True)
|
add_annotations('annotations',aqs , True)
|
||||||
for layer in filter(lambda l: l in keys, settings.CONFIG['clipLayers']):
|
for layer in filter(lambda l: l in keys, settings.CONFIG['clipLayers']):
|
||||||
add_annotations(layer,
|
aqs = Annotation.objects.filter(layer=layer, clip__in=ids)
|
||||||
Annotation.objects.filter(layer=layer, clip__in=ids))
|
add_annotations(layer, aqs)
|
||||||
elif 'position' in query:
|
elif 'position' in query:
|
||||||
qs = order_query(qs, query['sort'])
|
qs = order_query(qs, query['sort'])
|
||||||
ids = [i['public_id'] for i in qs.values('public_id')]
|
ids = [i['public_id'] for i in qs.values('public_id')]
|
||||||
|
|
Loading…
Reference in a new issue