forked from 0x2620/pandora
text key clip lists
This commit is contained in:
parent
001fbd3ba5
commit
c8b59c34c6
4 changed files with 22 additions and 13 deletions
|
@ -84,7 +84,7 @@ def findClips(request):
|
|||
qs = qs[query['range'][0]:query['range'][1]]
|
||||
|
||||
ids = []
|
||||
keys = filter(lambda k: k not in models.Clip.layers, data['keys'])
|
||||
keys = filter(lambda k: k not in models.Clip.layers + ['annotations'], data['keys'])
|
||||
if filter(lambda k: k not in models.Clip.clip_keys, keys):
|
||||
qs = qs.select_related('item__sort')
|
||||
|
||||
|
@ -95,20 +95,27 @@ def findClips(request):
|
|||
|
||||
keys = data['keys']
|
||||
|
||||
def add_annotations(layer, qs):
|
||||
for a in qs.values('public_id', 'value', 'clip__public_id'):
|
||||
def add_annotations(key, qs, add_layer=False):
|
||||
values = ['public_id', 'value', 'clip__public_id']
|
||||
if add_layer:
|
||||
values.append('layer')
|
||||
for a in qs.values(*values):
|
||||
for i in response['data']['items']:
|
||||
if i['id'] == a['clip__public_id']:
|
||||
if not layer in i:
|
||||
i[layer] = []
|
||||
i[layer].append({
|
||||
if not key in i:
|
||||
i[key] = []
|
||||
l = {
|
||||
'id': a['public_id'],
|
||||
'value': a['value'],
|
||||
})
|
||||
}
|
||||
if add_layer:
|
||||
l['layer'] = a['layer']
|
||||
i[key].append(l)
|
||||
if response['data']['items']:
|
||||
if 'annotations' in keys:
|
||||
add_annotations('annotations',
|
||||
Annotation.objects.filter(layer__in=models.Clip.layers, clip__in=ids))
|
||||
Annotation.objects.filter(layer__in=models.Clip.layers, clip__in=ids),
|
||||
True)
|
||||
for layer in filter(lambda l: l in keys, models.Clip.layers):
|
||||
add_annotations(layer,
|
||||
Annotation.objects.filter(layer=layer, clip__in=ids))
|
||||
|
|
|
@ -7,7 +7,9 @@ pandora.ui.clipList = function(videoRatio) {
|
|||
var ui = pandora.user.ui,
|
||||
fixedRatio = !ui.item ? 16/9 : videoRatio,
|
||||
isClipView = !ui.item ? ui.listView == 'clip' : ui.itemView == 'clips',
|
||||
|
||||
textKey = Ox.getObjectById(pandora.site.layers, 'subtitles')
|
||||
? 'subtitles'
|
||||
: 'annotations',
|
||||
that = Ox.IconList({
|
||||
fixedRatio: fixedRatio,
|
||||
item: function(data, sort, size) {
|
||||
|
@ -22,7 +24,7 @@ pandora.ui.clipList = function(videoRatio) {
|
|||
width = fixedRatio > 1 ? size : Math.round(size * fixedRatio);
|
||||
height = fixedRatio > 1 ? Math.round(size / fixedRatio) : size;
|
||||
}
|
||||
title = data.subtitles ? data.subtitles[0].value : ''; //fixme: could be other layer
|
||||
title = data[textKey] ? data[textKey][0].value : '';
|
||||
url = '/' + data.id.split('/')[0] + '/' + height + 'p' + data['in'] + '.jpg';
|
||||
sortKey = sort[0].key;
|
||||
if (['text', 'position', 'duration'].indexOf(sortKey) > -1) {
|
||||
|
@ -79,7 +81,7 @@ pandora.ui.clipList = function(videoRatio) {
|
|||
}, data), callback);
|
||||
},
|
||||
keys: Ox.merge(
|
||||
['id', 'in', 'out', 'subtitles'], //fixme: could be other layer
|
||||
['id', 'in', 'out', textKey],
|
||||
!ui.item ? ['videoRatio'] : []
|
||||
),
|
||||
max: 1,
|
||||
|
|
|
@ -308,7 +308,7 @@ pandora.ui.posterInfo = function(data) {
|
|||
})
|
||||
.html(
|
||||
data.title + (
|
||||
data.director ? ' (' + data.director.join(', ') + ')' : ''
|
||||
Ox.len(data.director) ? ' (' + data.director.join(', ') + ')' : ''
|
||||
)
|
||||
),
|
||||
that = Ox.SplitPanel({
|
||||
|
|
|
@ -32,7 +32,7 @@ pandora.ui.item = function() {
|
|||
pandora.$ui.itemTitle
|
||||
.options({
|
||||
title: '<b>' + result.data.title
|
||||
+ (result.data.director && result.data.director.length
|
||||
+ (Ox.len(result.data.director)
|
||||
? ' (' + result.data.director.join(', ') + ')'
|
||||
: '')
|
||||
+ (result.data.year ? ' ' + result.data.year : '') + '</b>'
|
||||
|
|
Loading…
Reference in a new issue