support only_e

This commit is contained in:
j 2021-10-29 14:45:21 +01:00
parent 4dc8719091
commit b801c52847
2 changed files with 18 additions and 3 deletions

View file

@ -352,7 +352,14 @@ function loadAnnotations(config) {
return
}
annotation.title = clip.title
annotations.push(annotation)
if (config.only_e) {
if (annotation.value.slice(0, 2) == 'E:') {
annotation.value = annotation.value.slice(2).trim()
annotations.push(annotation)
}
} else {
annotations.push(annotation)
}
})
})
loadClips(annotations).then(annotations => {

View file

@ -86,7 +86,10 @@ class Text(models.Model):
'id': self.data['edit'],
'keys': []
}
clips = api.getEdit(**query)['data']['clips']
r = api.getEdit(**query)
if 'data' not in r:
return []
clips = r['data']['clips']
annotations = []
layer = self.data.get('layer', None) or DEFAULT_LAYER
for clip in clips:
@ -94,7 +97,12 @@ class Text(models.Model):
if 'user' in self.data and annotation['user'] == self.data['user']:
continue
annotation['title'] = clip['title']
annotations.append(annotation)
if self.data.get('only_e'):
if annotation['value'].startswith('E:'):
annotation['value'] = annotation['value'][2:].strip()
annotations.append(annotation)
else:
annotations.append(annotation)
return self.get_clips(api, annotations)
def get_clips(self, api, annotations):