add clips query
This commit is contained in:
parent
6362b4df39
commit
906aec4301
2 changed files with 17 additions and 7 deletions
|
@ -12,26 +12,28 @@ pandora.ui.itemClips = function(options) {
|
|||
});
|
||||
|
||||
self.options = Ox.extend({
|
||||
clips: 5,
|
||||
clips: [],
|
||||
duration: 0,
|
||||
id: '',
|
||||
ratio: 8/5
|
||||
}, options);
|
||||
|
||||
self.clips = pandora.getClipPoints(self.options.duration, self.options.clips);
|
||||
self.size = 128;
|
||||
self.width = self.options.ratio > 1 ? self.size : Math.round(self.size * self.options.ratio);
|
||||
self.height = self.options.ratio > 1 ? Math.round(self.size / self.options.ratio) : self.size;
|
||||
|
||||
self.clips.forEach(function(clip, i) {
|
||||
self.options.clips.forEach(function(clip, i) {
|
||||
var id = self.options.id + '/' + clip['in'],
|
||||
title = Ox.map(clip.annotations, function(annotation) {
|
||||
return annotation.layer == 'subtitles' ? annotation.value : 0
|
||||
}),
|
||||
url = '/' + self.options.id + '/' + self.height + 'p' + clip['in'] + '.jpg',
|
||||
$item = Ox.IconItem({
|
||||
imageHeight: self.height,
|
||||
imageWidth: self.width,
|
||||
id: id,
|
||||
info: Ox.formatDuration(clip['in']) + ' - ' + Ox.formatDuration(clip.out),
|
||||
title: '',
|
||||
title: title[0] || '',
|
||||
url: url,
|
||||
})
|
||||
.addClass('OxInfoIcon')
|
||||
|
|
|
@ -207,6 +207,7 @@ pandora.ui.list = function() {
|
|||
.apply(this, Ox.merge([data[sortKey]], format.args || []))
|
||||
: data[sortKey];
|
||||
}
|
||||
Ox.print('CLIPS::', data.clips)
|
||||
return {
|
||||
icon: {
|
||||
height: Math.round(ratio <= 1 ? size : size / ratio),
|
||||
|
@ -220,7 +221,7 @@ pandora.ui.list = function() {
|
|||
element: pandora.ui.itemClips,
|
||||
id: data.id,
|
||||
options: {
|
||||
clips: 5,
|
||||
clips: data.clips,
|
||||
duration: data.duration,
|
||||
id: data.id,
|
||||
ratio: data.videoRatio
|
||||
|
@ -231,10 +232,17 @@ pandora.ui.list = function() {
|
|||
items: function(data, callback) {
|
||||
pandora.api.find(Ox.extend(data, {
|
||||
query: pandora.user.ui.find,
|
||||
// clipsQuery: ...
|
||||
clips: {
|
||||
query: {
|
||||
conditions: [],
|
||||
operator: '&'
|
||||
},
|
||||
items: 5,
|
||||
keys: []
|
||||
}
|
||||
}), callback);
|
||||
},
|
||||
keys: ['director', 'duration', 'id', 'posterRatio', 'title', 'videoRatio', 'year'],
|
||||
keys: ['clips', 'director', 'duration', 'id', 'posterRatio', 'title', 'videoRatio', 'year'],
|
||||
selected: pandora.user.ui.listSelection,
|
||||
size: 192,
|
||||
sort: pandora.user.ui.listSort,
|
||||
|
|
Loading…
Reference in a new issue