show results in timelines view

This commit is contained in:
rolux 2011-10-20 12:58:21 +00:00
parent c0273eac2d
commit 96f60e4184
2 changed files with 42 additions and 11 deletions

View file

@ -232,10 +232,7 @@ pandora.ui.list = function() {
pandora.api.find(Ox.extend(data, { pandora.api.find(Ox.extend(data, {
query: pandora.user.ui.find, query: pandora.user.ui.find,
clips: { clips: {
query: { query: pandora.getClipsQuery(),
conditions: [],
operator: '&'
},
items: 5, items: 5,
keys: [] keys: []
} }
@ -256,6 +253,8 @@ pandora.ui.list = function() {
} }
}); });
} else if (view == 'timelines') { } else if (view == 'timelines') {
var clipsQuery = pandora.getClipsQuery(),
isClipsQuery = clipsQuery.conditions.length;
that = Ox.InfoList({ that = Ox.InfoList({
borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16, borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16,
defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1, defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1,
@ -303,24 +302,35 @@ pandora.ui.list = function() {
id: data.id, id: data.id,
options: { options: {
duration: data.duration, duration: data.duration,
// find: '...', find: 'cinema',
getImageURL: function(i) { getImageURL: function(i) {
return '/' + data.id + '/timeline16p' + i + '.png'; return '/' + data.id + '/timeline16p' + i + '.png';
}, },
position: pandora.user.ui.videoPoints[data.id] position: pandora.user.ui.videoPoints[data.id]
? pandora.user.ui.videoPoints[data.id].position : 0, ? pandora.user.ui.videoPoints[data.id].position : 0,
// subtitles: data.subtitles results: data.clips ? data.clips.map(function(clip) {
return {'in': clip['in'], out: clip.out};
}) : [],
subtitles: data.clips ? data.clips.map(function(clip) {
return {'in': clip['in'], out: clip.out, text: clip.annotations[0].value};
}) : []
} }
} }
}; };
}, },
items: function(data, callback) { items: function(data, callback) {
pandora.api.find(Ox.extend(data, { pandora.api.find(Ox.extend(data, Ox.extend({
query: pandora.user.ui.find, query: pandora.user.ui.find
// clipsQuery: ... }, isClipsQuery ? {clips: {
}), callback); query: clipsQuery,
items: 1000000,
keys: []
}} : {})), callback);
}, },
keys: ['director', 'duration', 'id', 'posterRatio', 'title', 'year'], keys: Ox.merge(
['director', 'duration', 'id', 'posterRatio', 'title', 'year'],
isClipsQuery ? ['clips'] : []
),
selected: pandora.user.ui.listSelection, selected: pandora.user.ui.listSelection,
size: 192, size: 192,
sort: pandora.user.ui.listSort, sort: pandora.user.ui.listSort,

View file

@ -416,6 +416,27 @@ pandora.exitFullscreen = function() {
pandora.user.ui.showBrowser && pandora.$ui.contentPanel.size(0, 112 + Ox.UI.SCROLLBAR_SIZE); pandora.user.ui.showBrowser && pandora.$ui.contentPanel.size(0, 112 + Ox.UI.SCROLLBAR_SIZE);
}; };
pandora.getClipsQuery = function() {
function addClipsConditions(conditions) {
conditions.forEach(function(condition) {
if (condition.conditions) {
addClipsConditions(condition.conditions);
} else if (
Ox.getPositionById(pandora.site.layers, condition.key) > -1
&& condition.operator == '='
) {
clipsQuery.conditions.push(condition);
}
});
}
var clipsQuery = {
conditions: []
};
addClipsConditions(pandora.user.ui.find.conditions);
clipsQuery.operator = clipsQuery.conditions.length ? '|' : '&';
return clipsQuery;
};
pandora.getFoldersHeight = function() { pandora.getFoldersHeight = function() {
var height = 0; var height = 0;
pandora.site.sectionFolders[pandora.user.ui.section].forEach(function(folder, i) { pandora.site.sectionFolders[pandora.user.ui.section].forEach(function(folder, i) {