include clip conditions from smart lists in clip queries, fixes #2134

This commit is contained in:
j 2014-02-02 12:45:10 +00:00 committed by rolux
commit 57503c7eb5
3 changed files with 57 additions and 22 deletions

View file

@ -847,7 +847,7 @@ pandora.getClipsItems = function(width) {
return Math.floor((width - 8) / (128 + 8)) - 1;
};
pandora.getClipsQuery = function() {
pandora.getClipsQuery = function(callback) {
// fixme: nice, but not needed
function addClipsConditions(conditions) {
conditions.forEach(function(condition) {
@ -867,7 +867,20 @@ pandora.getClipsQuery = function() {
};
addClipsConditions(pandora.user.ui.find.conditions);
clipsQuery.operator = clipsQuery.conditions.length ? '|' : '&';
return clipsQuery;
if (callback) {
if (pandora.user.ui._list) {
pandora.api.getList({id: pandora.user.ui._list}, function(result) {
if (result.data.type == 'smart') {
addClipsConditions(result.data.query.conditions);
}
callback(clipsQuery)
});
} else {
callback(clipsQuery)
}
} else {
return clipsQuery;
}
};
pandora.getClipVideos = function(clip, resolution) {