itemsQuery/clipsQuery
This commit is contained in:
parent
867bff4e10
commit
80ade383f9
11 changed files with 45 additions and 45 deletions
|
@ -27,8 +27,8 @@ def parse_query(data, user):
|
|||
if key in data:
|
||||
query[key] = data[key]
|
||||
query['qs'] = models.Annotation.objects.find(query, user)
|
||||
if 'itemQuery' in data:
|
||||
item_query = Item.objects.find({'query': data['itemQuery']}, user)
|
||||
if 'itemsQuery' in data:
|
||||
item_query = Item.objects.find({'query': data['itemsQuery']}, user)
|
||||
query['qs'] = query['qs'].filter(item__in=item_query)
|
||||
return query
|
||||
|
||||
|
@ -68,7 +68,7 @@ def findAnnotations(request):
|
|||
'''
|
||||
param data {
|
||||
query: ...
|
||||
itemQuery: ...
|
||||
itemsQuery: ...
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -20,8 +20,8 @@ def parse_query(data, user):
|
|||
if key in data:
|
||||
query[key] = data[key]
|
||||
query['qs'] = models.Clip.objects.find(query, user)
|
||||
if 'itemQuery' in data and data['itemQuery'].get('conditions'):
|
||||
item_query = Item.objects.find({'query': data['itemQuery']}, user)
|
||||
if 'itemsQuery' in data and data['itemsQuery'].get('conditions'):
|
||||
item_query = Item.objects.find({'query': data['itemsQuery']}, user)
|
||||
query['qs'] = query['qs'].filter(item__in=item_query)
|
||||
return query
|
||||
|
||||
|
@ -60,7 +60,7 @@ def findClips(request):
|
|||
'''
|
||||
param data {
|
||||
query: ...
|
||||
itemQuery: ...
|
||||
itemsQuery: ...
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -127,8 +127,8 @@ def parse_query(data, user):
|
|||
if key in data:
|
||||
query[key] = data[key]
|
||||
query['qs'] = models.Event.objects.find(query, user)
|
||||
if 'itemQuery' in data:
|
||||
item_query = models.Item.objects.find({'query': data['itemQuery']}, user)
|
||||
if 'itemsQuery' in data:
|
||||
item_query = models.Item.objects.find({'query': data['itemsQuery']}, user)
|
||||
query['qs'] = query['qs'].filter(items__in=item_query)
|
||||
return query
|
||||
|
||||
|
@ -154,7 +154,7 @@ def findEvents(request):
|
|||
|
||||
query: query object, more on query syntax at
|
||||
https://wiki.0x2620.org/wiki/pandora/QuerySyntax
|
||||
itemQuery: {
|
||||
itemsQuery: {
|
||||
//see find request
|
||||
},
|
||||
sort: array of key, operator dics
|
||||
|
@ -170,7 +170,7 @@ def findEvents(request):
|
|||
]
|
||||
range: result range, array [from, to]
|
||||
|
||||
itemQuery can be used to limit the resuts to matches in those items.
|
||||
itemsQuery can be used to limit the resuts to matches in those items.
|
||||
|
||||
with keys, items is list of dicts with requested properties:
|
||||
return {'status': {'code': int, 'text': string},
|
||||
|
|
|
@ -91,10 +91,10 @@ def parse_query(data, user):
|
|||
query[key] = data[key]
|
||||
query['qs'] = models.Item.objects.find(data, user)
|
||||
|
||||
if 'clipQuery' in data:
|
||||
query['clip_qs'] = Clip.objects.find({'query': data['clipQuery']}, user).order_by('start')
|
||||
query['clip_items'] = data['clipQuery'].get('items', 5)
|
||||
query['clip_keys'] = data['clipQuery'].get('keys', ['id', 'in', 'out', 'annotations'])
|
||||
if 'clipsQuery' in data:
|
||||
query['clip_qs'] = Clip.objects.find({'query': data['clipsQuery']}, user).order_by('start')
|
||||
query['clip_items'] = data['clipsQuery'].get('items', 5)
|
||||
query['clip_keys'] = data['clipsQuery'].get('keys', ['id', 'in', 'out', 'annotations'])
|
||||
|
||||
#group by only allows sorting by name or number of itmes
|
||||
return query
|
||||
|
@ -105,7 +105,7 @@ def find(request):
|
|||
'query': query,
|
||||
'sort': array,
|
||||
'range': array
|
||||
clipQuery: ...
|
||||
clipsQuery: ...
|
||||
}
|
||||
|
||||
query: query object, more on query syntax at
|
||||
|
|
|
@ -27,8 +27,8 @@ def parse_query(data, user):
|
|||
if key in data:
|
||||
query[key] = data[key]
|
||||
query['qs'] = models.News.objects.find(query, user)
|
||||
if 'itemQuery' in data:
|
||||
item_query = Item.objects.find({'query': data['itemQuery']}, user)
|
||||
if 'itemsQuery' in data:
|
||||
item_query = Item.objects.find({'query': data['itemsQuery']}, user)
|
||||
query['qs'] = query['qs'].filter(item__in=item_query)
|
||||
return query
|
||||
|
||||
|
@ -68,7 +68,7 @@ def findNews(request):
|
|||
'''
|
||||
param data {
|
||||
query: ...
|
||||
itemQuery: ...
|
||||
itemsQuery: ...
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -43,8 +43,8 @@ def parse_query(data, user):
|
|||
if key in data:
|
||||
query[key] = data[key]
|
||||
query['qs'] = models.Person.objects.find(query, user)
|
||||
#if 'itemQuery' in data:
|
||||
# item_query = models.Item.objects.find({'query': data['itemQuery']}, user)
|
||||
#if 'itemsQuery' in data:
|
||||
# item_query = models.Item.objects.find({'query': data['itemsQuery']}, user)
|
||||
# query['qs'] = query['qs'].filter(items__in=item_query)
|
||||
return query
|
||||
|
||||
|
@ -76,7 +76,7 @@ def findNames(request):
|
|||
]
|
||||
operator: ","
|
||||
},
|
||||
itemQuery: {
|
||||
itemsQuery: {
|
||||
//see find request
|
||||
},
|
||||
sort: [{key: 'name', operator: '+'}],
|
||||
|
|
|
@ -148,8 +148,8 @@ def parse_query(data, user):
|
|||
if key in data:
|
||||
query[key] = data[key]
|
||||
query['qs'] = models.Place.objects.find(query, user)
|
||||
if 'itemQuery' in data:
|
||||
item_query = models.Item.objects.find({'query': data['itemQuery']}, user)
|
||||
if 'itemsQuery' in data:
|
||||
item_query = models.Item.objects.find({'query': data['itemsQuery']}, user)
|
||||
query['qs'] = query['qs'].filter(items__in=item_query)
|
||||
return query
|
||||
|
||||
|
@ -182,7 +182,7 @@ def findPlaces(request):
|
|||
]
|
||||
operator: ","
|
||||
},
|
||||
itemQuery: {
|
||||
itemsQuery: {
|
||||
//see find request
|
||||
},
|
||||
sort: [{key: 'name', operator: '+'}],
|
||||
|
@ -193,7 +193,7 @@ def findPlaces(request):
|
|||
possible query keys:
|
||||
name, geoname, user
|
||||
|
||||
itemQuery can be used to limit the resuts to matches in those items.
|
||||
itemsQuery can be used to limit the resuts to matches in those items.
|
||||
Uses the same query syntax as used in the find request.
|
||||
|
||||
possible keys:
|
||||
|
|
|
@ -45,8 +45,8 @@ def parse_query(data, user):
|
|||
if key in data:
|
||||
query[key] = data[key]
|
||||
query['qs'] = models.Title.objects.find(query, user)
|
||||
#if 'itemQuery' in data:
|
||||
# item_query = models.Item.objects.find({'query': data['itemQuery']}, user)
|
||||
#if 'itemsQuery' in data:
|
||||
# item_query = models.Item.objects.find({'query': data['itemsQuery']}, user)
|
||||
# query['qs'] = query['qs'].filter(items__in=item_query)
|
||||
return query
|
||||
|
||||
|
@ -78,7 +78,7 @@ def findTitles(request):
|
|||
]
|
||||
operator: ","
|
||||
},
|
||||
itemQuery: {
|
||||
itemsQuery: {
|
||||
//see find request
|
||||
},
|
||||
sort: [{key: 'title', operator: '+'}],
|
||||
|
|
|
@ -48,19 +48,19 @@ pandora.ui.clipList = function(videoRatio) {
|
|||
callback({data: {items: []}});
|
||||
return;
|
||||
}
|
||||
var itemQuery, query;
|
||||
var itemsQuery, query;
|
||||
if (!ui.item) {
|
||||
itemQuery = ui.find;
|
||||
itemsQuery = ui.find;
|
||||
query = {conditions: [], operator: '&'};
|
||||
// if the item query contains a layer condition,
|
||||
// then this condition is added to the clip query
|
||||
itemQuery.conditions.forEach(function(condition) {
|
||||
itemsQuery.conditions.forEach(function(condition) {
|
||||
if (Ox.getPositionById(pandora.site.layers, condition.key) > -1) {
|
||||
query.conditions.push(condition);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
itemQuery = {
|
||||
itemsQuery = {
|
||||
conditions:[{key: 'id', value: ui.item, operator: '=='}],
|
||||
operator: '&'
|
||||
};
|
||||
|
@ -69,7 +69,7 @@ pandora.ui.clipList = function(videoRatio) {
|
|||
query = {conditions: [], operator: '&'};
|
||||
}
|
||||
pandora.api.findClips(Ox.extend({
|
||||
itemQuery: itemQuery,
|
||||
itemsQuery: itemsQuery,
|
||||
query: query
|
||||
}, data), callback);
|
||||
},
|
||||
|
|
|
@ -11,17 +11,17 @@ pandora.ui.clipPlayer = function() {
|
|||
video: function(range, callback) {
|
||||
var callback = arguments[arguments.length - 1],
|
||||
range = arguments.length == 2 ? arguments[0] : null,
|
||||
itemQuery = pandora.user.ui.find,
|
||||
itemsQuery = pandora.user.ui.find,
|
||||
query = {conditions:[]};
|
||||
//fixme: can this be in pandora.Query? dont just check for subtitles
|
||||
itemQuery.conditions.forEach(function(q) {
|
||||
itemsQuery.conditions.forEach(function(q) {
|
||||
if (q.key == 'subtitles') {
|
||||
query.conditions.push({key: 'subtitles', value: q.value, operator: q.operator});
|
||||
}
|
||||
});
|
||||
pandora.api.findClips(Ox.extend({
|
||||
query: query,
|
||||
itemQuery: itemQuery
|
||||
itemsQuery: itemsQuery
|
||||
}, range ? {
|
||||
keys: ['id', 'in', 'out', 'subtitles'],
|
||||
range: range,
|
||||
|
|
|
@ -146,17 +146,17 @@ pandora.ui.navigationView = function(type, videoRatio) {
|
|||
// 20 menu + 24 toolbar + 1 resizebar + 16 statusbar
|
||||
height: window.innerHeight - ui.showGroups * ui.groupsSize - 61,
|
||||
places: function(data, callback) {
|
||||
var itemQuery;
|
||||
var itemsQuery;
|
||||
if (!ui.item) {
|
||||
itemQuery = ui.find;
|
||||
itemsQuery = ui.find;
|
||||
} else {
|
||||
itemQuery = {
|
||||
itemsQuery = {
|
||||
conditions: [{key: 'id', value: ui.item, operator: '=='}],
|
||||
operator: '&'
|
||||
};
|
||||
}
|
||||
return pandora.api.findPlaces(Ox.extend({
|
||||
itemQuery: itemQuery
|
||||
itemsQuery: itemsQuery
|
||||
}, data), callback);
|
||||
},
|
||||
selected: ui.mapSelection,
|
||||
|
@ -186,7 +186,7 @@ pandora.ui.navigationView = function(type, videoRatio) {
|
|||
} else {
|
||||
|
||||
pandora.api.findEvents({
|
||||
itemQuery: !ui.item ? ui.find : {
|
||||
itemsQuery: !ui.item ? ui.find : {
|
||||
conditions: [{key: 'id', value: ui.item, operator: '=='}],
|
||||
operator: '&'
|
||||
},
|
||||
|
@ -233,17 +233,17 @@ pandora.ui.navigationView = function(type, videoRatio) {
|
|||
$status.html('loading...');
|
||||
$list.options({
|
||||
items: function(data, callback) {
|
||||
var itemQuery;
|
||||
var itemsQuery;
|
||||
if (!ui.item) {
|
||||
itemQuery = ui.find;
|
||||
itemsQuery = ui.find;
|
||||
} else {
|
||||
itemQuery = {
|
||||
itemsQuery = {
|
||||
conditions: [{key: 'id', value: ui.item, operator: '=='}],
|
||||
operator: '&'
|
||||
};
|
||||
}
|
||||
return pandora.api.findClips(Ox.extend({
|
||||
itemQuery: itemQuery,
|
||||
itemsQuery: itemsQuery,
|
||||
query: {
|
||||
conditions: [{key: itemName, value: id, operator:'=='}],
|
||||
operator: '&'
|
||||
|
|
Loading…
Reference in a new issue