forked from 0x2620/pandora
rename series, canplayvideo, canplayclips
This commit is contained in:
parent
4f61bf466e
commit
fdc29212b7
3 changed files with 19 additions and 16 deletions
|
@ -137,6 +137,11 @@
|
|||
"columnWidth": 60,
|
||||
"format": {"type": "duration", "args": [0, "short"]}
|
||||
},
|
||||
{
|
||||
"id": "series",
|
||||
"title": "TV Series",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"id": "writer",
|
||||
"title": "Writer",
|
||||
|
@ -458,21 +463,16 @@
|
|||
"sortOperator": "+"
|
||||
},
|
||||
{
|
||||
"id": "canPlayVideo",
|
||||
"id": "canplayvideo",
|
||||
"title": "Can Play Video",
|
||||
"type": "boolean",
|
||||
"value": "capability"
|
||||
},
|
||||
{
|
||||
"id": "canPlayClips",
|
||||
"id": "canplayclips",
|
||||
"title": "Can Play Clips",
|
||||
"type": "boolean",
|
||||
"value": "capability"
|
||||
},
|
||||
{
|
||||
"id": "isSeries",
|
||||
"title": "TV Series",
|
||||
"type": "boolean"
|
||||
}
|
||||
],
|
||||
/*
|
||||
|
@ -540,10 +540,10 @@
|
|||
{"id": "favorites", "title": "Favorites"},
|
||||
{"id": "most_popular", "title": "Most Popular", "query": {}},
|
||||
{"id": "recently_viewed", "title": "Recently Viewed", "query": {}},
|
||||
{"id": "1960s", "title": "1960s", "query": {"conditions": [{"key": "year", "value": "196", "operator": "^"}], "operator": "&"}},
|
||||
{"id": "movies_with_full_video", "title": "Movies with Full Video", "query": {"conditions": [{"key": "canPlayVideo", "value": true, "operator": "="}], "operator": "&"}},
|
||||
{"id": "movies_with_clips", "title": "Movies with Clips", "query": {"conditions": [{"key": "canPlayClips", "value": true, "operator": "="}], "operator": "&"}},
|
||||
{"id": "no_tv_series", "title": "No TV Series", "query": {"conditions": [{"key": "isSeries", "value": false, "operator": "="}], "operator": "&"}}
|
||||
{"id": "1960s", "title": "1960s", "query": {"conditions": [{"key": "year", "value": ["1960", "1970"], "operator": "="}], "operator": "&"}},
|
||||
{"id": "movies_with_full_video", "title": "Movies with Full Video", "query": {"conditions": [{"key": "canplayvideo", "value": true, "operator": "="}], "operator": "&"}},
|
||||
{"id": "movies_with_clips", "title": "Movies with Clips", "query": {"conditions": [{"key": "canplayclips", "value": true, "operator": "="}], "operator": "&"}},
|
||||
{"id": "no_tv_series", "title": "No TV Series", "query": {"conditions": [{"key": "series", "value": false, "operator": "="}], "operator": "&"}}
|
||||
],
|
||||
"rightsLevel": {"member": 4, "staff": 3, "admin": 2},
|
||||
"rightsLevels": [
|
||||
|
|
|
@ -63,9 +63,12 @@ def parseCondition(condition, user):
|
|||
if exclude:
|
||||
q = ~q
|
||||
return q
|
||||
elif k in ('canPlayVideo', 'canPlayClips'):
|
||||
elif k in ('canplayvideo', 'canplayclips'):
|
||||
level = user.is_anonymous() and 'guest' or user.get_profile().get_level()
|
||||
allowed_level = settings.CONFIG['capabilities'][k][level]
|
||||
allowed_level = settings.CONFIG['capabilities'][{
|
||||
'canplayvideo': 'canPlayVideo',
|
||||
'canplayclips': 'canPlayClips'
|
||||
}[k]][level]
|
||||
if v:
|
||||
q = Q(level__lte=allowed_level)
|
||||
else:
|
||||
|
@ -74,7 +77,7 @@ def parseCondition(condition, user):
|
|||
q = ~q
|
||||
return q
|
||||
elif key_type == 'boolean':
|
||||
q = Q(**{'find__key': k, 'find__value': v and '1' or '0'})
|
||||
q = Q(**{'find__key': k, 'find__value': v})
|
||||
if exclude:
|
||||
q = ~q
|
||||
return q
|
||||
|
|
|
@ -514,7 +514,7 @@ class Item(models.Model):
|
|||
if value not in ('', None):
|
||||
f, created = ItemFind.objects.get_or_create(item=self, key=key)
|
||||
if isinstance(value, bool):
|
||||
value = value and '1' or '0'
|
||||
value = value and 'true' or 'false'
|
||||
if isinstance(value, basestring):
|
||||
value = value.strip()
|
||||
f.value = value
|
||||
|
@ -567,7 +567,7 @@ class Item(models.Model):
|
|||
self.get('episodeTitle',
|
||||
self.get('episode',
|
||||
self.get('seriesTitle')))) != None
|
||||
save('isSeries', isSeries)
|
||||
save('series', isSeries)
|
||||
|
||||
def update_sort(self):
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue