rename series, canplayvideo, canplayclips

This commit is contained in:
rolux 2011-11-10 14:59:12 +00:00
parent 4f61bf466e
commit fdc29212b7
3 changed files with 19 additions and 16 deletions

View file

@ -137,6 +137,11 @@
"columnWidth": 60, "columnWidth": 60,
"format": {"type": "duration", "args": [0, "short"]} "format": {"type": "duration", "args": [0, "short"]}
}, },
{
"id": "series",
"title": "TV Series",
"type": "boolean"
},
{ {
"id": "writer", "id": "writer",
"title": "Writer", "title": "Writer",
@ -458,21 +463,16 @@
"sortOperator": "+" "sortOperator": "+"
}, },
{ {
"id": "canPlayVideo", "id": "canplayvideo",
"title": "Can Play Video", "title": "Can Play Video",
"type": "boolean", "type": "boolean",
"value": "capability" "value": "capability"
}, },
{ {
"id": "canPlayClips", "id": "canplayclips",
"title": "Can Play Clips", "title": "Can Play Clips",
"type": "boolean", "type": "boolean",
"value": "capability" "value": "capability"
},
{
"id": "isSeries",
"title": "TV Series",
"type": "boolean"
} }
], ],
/* /*
@ -540,10 +540,10 @@
{"id": "favorites", "title": "Favorites"}, {"id": "favorites", "title": "Favorites"},
{"id": "most_popular", "title": "Most Popular", "query": {}}, {"id": "most_popular", "title": "Most Popular", "query": {}},
{"id": "recently_viewed", "title": "Recently Viewed", "query": {}}, {"id": "recently_viewed", "title": "Recently Viewed", "query": {}},
{"id": "1960s", "title": "1960s", "query": {"conditions": [{"key": "year", "value": "196", "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_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": "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": "no_tv_series", "title": "No TV Series", "query": {"conditions": [{"key": "series", "value": false, "operator": "="}], "operator": "&"}}
], ],
"rightsLevel": {"member": 4, "staff": 3, "admin": 2}, "rightsLevel": {"member": 4, "staff": 3, "admin": 2},
"rightsLevels": [ "rightsLevels": [

View file

@ -63,9 +63,12 @@ def parseCondition(condition, user):
if exclude: if exclude:
q = ~q q = ~q
return 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() 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: if v:
q = Q(level__lte=allowed_level) q = Q(level__lte=allowed_level)
else: else:
@ -74,7 +77,7 @@ def parseCondition(condition, user):
q = ~q q = ~q
return q return q
elif key_type == 'boolean': 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: if exclude:
q = ~q q = ~q
return q return q

View file

@ -514,7 +514,7 @@ class Item(models.Model):
if value not in ('', None): if value not in ('', None):
f, created = ItemFind.objects.get_or_create(item=self, key=key) f, created = ItemFind.objects.get_or_create(item=self, key=key)
if isinstance(value, bool): if isinstance(value, bool):
value = value and '1' or '0' value = value and 'true' or 'false'
if isinstance(value, basestring): if isinstance(value, basestring):
value = value.strip() value = value.strip()
f.value = value f.value = value
@ -567,7 +567,7 @@ class Item(models.Model):
self.get('episodeTitle', self.get('episodeTitle',
self.get('episode', self.get('episode',
self.get('seriesTitle')))) != None self.get('seriesTitle')))) != None
save('isSeries', isSeries) save('series', isSeries)
def update_sort(self): def update_sort(self):
try: try: