From 906aec4301f34255690a77fd6c6c44e02f51fdce Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 19 Oct 2011 16:40:52 +0000 Subject: [PATCH] add clips query --- static/js/pandora/ui/itemClips.js | 10 ++++++---- static/js/pandora/ui/list.js | 14 +++++++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/static/js/pandora/ui/itemClips.js b/static/js/pandora/ui/itemClips.js index d7e2dd34..87cc3d9a 100644 --- a/static/js/pandora/ui/itemClips.js +++ b/static/js/pandora/ui/itemClips.js @@ -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') diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index cc92a234..236f0475 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -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,