From 17badcd4e12339f7f99f25f6d716e035f7ae636f Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 29 Oct 2011 00:43:44 +0200 Subject: [PATCH 1/5] return rightslevel --- pandora/item/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora/item/models.py b/pandora/item/models.py index ec54b5f4..c145aa8c 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -168,6 +168,8 @@ class Item(models.Model): objects = managers.ItemManager() def get(self, key, default=None): + if key == 'rightslevel': + return self.level if self.data and key in self.data: return self.data[key] if self.external_data and key in self.external_data: From 5923f8473840b424206ebe8b001318333f3bea1b Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 29 Oct 2011 01:10:00 +0200 Subject: [PATCH 2/5] off by one rightsLevel, fixes #102 --- pandora/0xdb.jsonc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora/0xdb.jsonc b/pandora/0xdb.jsonc index 4f481edf..9bc49608 100644 --- a/pandora/0xdb.jsonc +++ b/pandora/0xdb.jsonc @@ -538,7 +538,7 @@ {"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": "&"}} ], - "rightsLevel": {"member": 5, "staff": 4, "admin": 3}, + "rightsLevel": {"member": 4, "staff": 3, "admin": 2}, "rightsLevels": [ {"name": "Public", "color": [128, 255, 128]}, {"name": "Relaxed", "color": [192, 255, 128]}, From b7e03c0f14db6bfacfec6c0c0921deb1d8deea86 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 29 Oct 2011 01:17:16 +0200 Subject: [PATCH 3/5] add resolution --- pandora/item/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora/item/models.py b/pandora/item/models.py index c145aa8c..e21c3bb1 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -462,6 +462,7 @@ class Item(models.Model): i['parts'] = len(i['durations']) if i['parts']: i['videoRatio'] = streams[0].aspect_ratio + i['resolution'] = (streams[0].file.width, streams[0].file.height) #only needed by admins if keys and 'posters' in keys: From 2a7fa3e4e8e6b36a179e6260d7101b8da0480e35 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 29 Oct 2011 01:27:44 +0200 Subject: [PATCH 4/5] aspectratio --- pandora/archive/models.py | 2 +- pandora/item/models.py | 2 +- static/js/pandora/infoView.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora/archive/models.py b/pandora/archive/models.py index 8391f3a5..fd6aeb20 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -500,7 +500,7 @@ class Stream(models.Model): def json(self): return { 'duration': self.duration, - 'aspectRatio': self.aspect_ratio, + 'aspectratio': self.aspect_ratio, } def delete_stream(sender, **kwargs): diff --git a/pandora/item/models.py b/pandora/item/models.py index e21c3bb1..57a16f34 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -657,7 +657,7 @@ class Item(models.Model): s.published = self.published s.rightslevel = self.level - s.aspectratio = self.get('aspectRatio') + s.aspectratio = self.get('aspectratio') s.words = sum([len(a.value.split()) for a in self.annotations.exclude(value='')]) s.clips = self.clips.count() diff --git a/static/js/pandora/infoView.js b/static/js/pandora/infoView.js index 0ef654a8..6abcebd1 100644 --- a/static/js/pandora/infoView.js +++ b/static/js/pandora/infoView.js @@ -646,8 +646,8 @@ pandora.ui.infoView = function(data) { return image.selected; })[0]; $list = Ox.IconList({ - defaultRatio: ui.icons == 'posters' ? 5/8 : data.stream.aspectRatio, - fixedRatio: ui.icons == 'posters' ? false : data.stream.aspectRatio, + defaultRatio: ui.icons == 'posters' ? 5/8 : data.stream.aspectratio, + fixedRatio: ui.icons == 'posters' ? false : data.stream.aspectratio, item: function(data, sort, size) { var ratio = data.width / data.height; size = size || 128; From 55fc0ccbfadd0214f656de5a9767bdeedd9f1d00 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 29 Oct 2011 01:35:01 +0200 Subject: [PATCH 5/5] return sort values for clips too --- pandora/clip/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandora/clip/models.py b/pandora/clip/models.py index f5444356..696b6d98 100644 --- a/pandora/clip/models.py +++ b/pandora/clip/models.py @@ -88,7 +88,10 @@ class Clip(models.Model): for a in self.annotations.filter(layer__name=layer)] for key in keys: if key not in clip_keys and key not in j: - j[key] = self.item.get(key) + value = self.item.get(key) + if not value and hasattr(self.item.sort, key): + value = getattr(self.item.sort, key) + j[key] = value return j @classmethod