From c930383b324a7174a155bd7cedaa03db9c1c85c4 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 5 Dec 2011 14:48:59 +0100 Subject: [PATCH] fix padma.jsonc and adjust whats needed to get it running --- pandora/annotation/models.py | 9 ++--- pandora/app/config.py | 5 +++ pandora/app/views.py | 4 +- pandora/clip/models.py | 2 +- pandora/item/urls.py | 20 +++++----- pandora/padma.jsonc | 72 +++++++++++++++++++++++----------- pandora/settings.py | 4 +- pandora/templates/embed.html | 4 ++ pandora/templates/index.html | 4 ++ pandora/urlalias/models.py | 8 ++++ pandora/user/models.py | 2 +- static/js/pandora/filesView.js | 4 +- 12 files changed, 93 insertions(+), 45 deletions(-) diff --git a/pandora/annotation/models.py b/pandora/annotation/models.py index 424ea4d9..2a65a364 100644 --- a/pandora/annotation/models.py +++ b/pandora/annotation/models.py @@ -74,11 +74,10 @@ class Annotation(models.Model): if l['id'] == id: return l return {} - private = get_layer(self.layer).get('private') - if not self.clip and not private or \ - (self.clip and not private and \ - self.start != self.clip.start or self.end != self.clip.end): - self.clip, created = Clip.get_or_create(self.item, self.start, self.end) + private = get_layer(self.layer).get('private', False) + if not private: + if not self.clip or self.start != self.clip.start or self.end != self.clip.end: + self.clip, created = Clip.get_or_create(self.item, self.start, self.end) super(Annotation, self).save(*args, **kwargs) if set_public_id: diff --git a/pandora/app/config.py b/pandora/app/config.py index a3ba295c..1cced56c 100644 --- a/pandora/app/config.py +++ b/pandora/app/config.py @@ -107,6 +107,11 @@ def update_static(): ox.net.saveUrl(url, "%s.gz"%path) os.system('gunzip "%s.gz"' % path) + #poster script + if not os.path.exists(settings.ITEM_POSTER): + os.symlink(settings.ITEM_POSTER.replace('poster', 'oxdb_poster'), + settings.ITEM_POSTER) + def init(): load_config() thread.start_new_thread(reloader_thread, ()) diff --git a/pandora/app/views.py b/pandora/app/views.py index a5c9250f..4db2e1b4 100644 --- a/pandora/app/views.py +++ b/pandora/app/views.py @@ -29,7 +29,9 @@ def index(request): def embed(request, id): - context = RequestContext(request, {'settings': settings}) + context = RequestContext(request, { + 'settings': settings + }) return render_to_response('embed.html', context) diff --git a/pandora/clip/models.py b/pandora/clip/models.py index a85468ac..0c47cc42 100644 --- a/pandora/clip/models.py +++ b/pandora/clip/models.py @@ -111,7 +111,7 @@ attrs = { 'lightness': models.FloatField(default=0, db_index=True), 'volume': models.FloatField(default=0, null=True, db_index=True), - 'director': models.CharField(max_length=1000, db_index=True), + 'director': models.CharField(max_length=1000, null=True, db_index=True), 'title': models.CharField(max_length=1000, db_index=True), } public_layers = [l['id'] diff --git a/pandora/item/urls.py b/pandora/item/urls.py index e5fed481..f9421693 100644 --- a/pandora/item/urls.py +++ b/pandora/item/urls.py @@ -6,26 +6,26 @@ from django.conf.urls.defaults import * urlpatterns = patterns("item.views", #frames - (r'^(?P[A-Z0-9].+)/(?P\d+)p(?P[\d\.]*)\.jpg$', 'frame'), + (r'^(?P[A-Z0-9].*)/(?P\d+)p(?P[\d\.]*)\.jpg$', 'frame'), #timelines - (r'^(?P[A-Z0-9].+)/timeline(?P\d+)p(?P\d+)\.png$', 'timeline'), - (r'^(?P[A-Z0-9].+)/timeline(?P\d+)p\.png$', 'timeline_overview'), + (r'^(?P[A-Z0-9].*)/timeline(?P\d+)p(?P\d+)\.png$', 'timeline'), + (r'^(?P[A-Z0-9].*)/timeline(?P\d+)p\.png$', 'timeline_overview'), #video - (r'^(?P[A-Z0-9].+)/(?P\d+)p(?P\d*)\.(?Pwebm|ogv|mp4)$', 'video'), + (r'^(?P[A-Z0-9].*)/(?P\d+)p(?P\d*)\.(?Pwebm|ogv|mp4)$', 'video'), #torrent - (r'^(?P[A-Z0-9][A-Za-z0-9]+)/torrent/(?P.*?)$', 'torrent'), + (r'^(?P[A-Z0-9].*)/torrent/(?P.*?)$', 'torrent'), #icon - (r'^(?P[A-Z0-9].+)/icon(?P\d*)\.jpg$', 'icon'), + (r'^(?P[A-Z0-9].*)/icon(?P\d*)\.jpg$', 'icon'), #poster - (r'^(?P[A-Z0-9].+)/poster(?P\d+)\.jpg$', 'poster'), - (r'^(?P[A-Z0-9].+)/siteposter(?P\d*)\.jpg$', 'siteposter'), - (r'^(?P[A-Z0-9].+)/poster\.jpg$', 'siteposter'), - (r'^(?P[A-Z0-9].+)/frameposter(?P\d+).jpg$', 'poster_frame'), + (r'^(?P[A-Z0-9].*)/poster(?P\d+)\.jpg$', 'poster'), + (r'^(?P[A-Z0-9].*)/siteposter(?P\d*)\.jpg$', 'siteposter'), + (r'^(?P[A-Z0-9].*)/poster\.jpg$', 'siteposter'), + (r'^(?P[A-Z0-9].*)/frameposter(?P\d+).jpg$', 'poster_frame'), (r'^random$', 'random_annotation'), ) diff --git a/pandora/padma.jsonc b/pandora/padma.jsonc index 33b555ab..98e1a1fd 100644 --- a/pandora/padma.jsonc +++ b/pandora/padma.jsonc @@ -15,16 +15,16 @@ "capabilities": { // "canClickMap": {"friend": true, "staff": true, "admin": true}, "canDeleteItems": {"admin": true}, - "canDownloadVideo": {"guest": 0, "member": 0, "friend": 4, "staff": 4, "admin": 4}, + "canDownloadVideo": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, "canEditFeaturedLists": {"staff": true, "admin": true}, "canEditMetadata": {"staff": true, "admin": true}, "canEditSitePages": {"staff": true, "admin": true}, "canEditUsers": {"admin": true}, - "canPlayClips": {"guest": 2, "member": 2, "friend": 4, "staff": 4, "admin": 4}, - "canPlayVideo": {"guest": 1, "member": 1, "friend": 4, "staff": 4, "admin": 4}, + "canPlayClips": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, + "canPlayVideo": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, "canSeeDebugMenu": {"staff": true, "admin": true}, "canSeeFiles": {"staff": true, "admin": true}, - "canSeeItem": {"guest": 3, "member": 3, "friend": 4, "staff": 4, "admin": 4}, + "canSeeItem": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, "canSeeExtraItemViews": {"friend": true, "staff": true, "admin": true} }, /* @@ -43,10 +43,12 @@ // fixme: either this, or filter: true in itemKeys, but not both "filters": [ {"id": "director", "title": "Director", "type": "string"}, - {"id": "country", "title": "Country", "type": "string"}, + {"id": "location", "title": "Location", "type": "string"}, {"id": "year", "title": "Year", "type": "integer"}, {"id": "language", "title": "Language", "type": "string"}, {"id": "source", "title": "Source", "type": "string"}, + {"id": "collection", "title": "Collection", "type": "string"}, + {"id": "category", "title": "Category", "type": "string"}, {"id": "writer", "title": "Writer", "type": "string"}, {"id": "producer", "title": "Producer", "type": "string"}, {"id": "cinematographer", "title": "Cinematographer", "type": "string"}, @@ -104,6 +106,13 @@ "find": true, "sort": "person" }, + { + "id": "name", + "title": "Name", + "type": ["string"], + "autocomplete": true, + "find": true + }, { "id": "collection", "title": "Collection", @@ -147,6 +156,24 @@ "filter": true, "find": true }, + { + "id": "category", + "title": "Category", + "type": ["string"], + "autocomplete": true, + "columnWidth": 180, + "filter": true, + "find": true + }, + { + "id": "location", + "title": "Location", + "type": "string", + "autocomplete": true, + "columnWidth": 180, + "filter": true, + "find": true + }, { "id": "genre", "title": "Genre", @@ -198,25 +225,25 @@ "columnWidth": 90 }, { - "id": "location", + "id": "locations", "title": "Locations", "type": "layer", "find": true }, { - "id": "keyword", + "id": "keywords", "title": "Keywords", "type": "layer", "find": true }, { - "id": "description", + "id": "descriptions", "title": "Descriptions", "type": "layer", "find": true }, { - "id": "transcript", + "id": "transcripts", "title": "Transcripts", "type": "layer", "find": true @@ -357,10 +384,10 @@ "type": "enum", "columnWidth": 90, "format": {"type": "ColorLevel", "args": [ - ["Public", "Relaxed", "Regular", "Restricted", "Private"] + ["Public", "Restricted", "Private"] ]}, "sortOperator": "+", - "values": ["Public", "Relaxed", "Regular", "Restricted", "Private", "Unknown"] + "values": ["Public", "Restricted", "Private", "Unknown"] } ], "itemName": { @@ -379,26 +406,25 @@ ], "layers": [ { - "id": "location", + "id": "locations", "title": "Locations", "type": "location", - "overlap": true, - "private": true + "overlap": true }, { - "id": "keyword", + "id": "keywords", "title": "Keywords", "overlap": true, "type": "text" }, { - "id": "description", + "id": "descriptions", "title": "Descriptions", "type": "text", "overlay": true }, { - "id": "transcript", + "id": "transcripts", "title": "Transcripts", "type": "text", "overlay": true @@ -467,16 +493,16 @@ "clipsColumns": 2, "columns": { "Colors": { - "columns": ["title", "director", "country", "year", "hue", "saturation", "brightness"], + "columns": ["title", "director", "location", "collection", "hue", "saturation", "brightness"], "columnWidth": {} } }, "filters": [ {"id": "director", "sort": [{"key": "items", "operator": "-"}]}, - {"id": "country", "sort": [{"key": "items", "operator": "-"}]}, - {"id": "year", "sort": [{"key": "name", "operator": "-"}]}, - {"id": "language", "sort": [{"key": "items", "operator": "-"}]}, - {"id": "source", "sort": [{"key": "items", "operator": "-"}]} + {"id": "source", "sort": [{"key": "items", "operator": "-"}]}, + {"id": "collection", "sort": [{"key": "name", "operator": "-"}]}, + {"id": "category", "sort": [{"key": "items", "operator": "-"}]}, + {"id": "location", "sort": [{"key": "items", "operator": "-"}]} ], "filtersSize": 176, "find": {"conditions": [], "operator": "&"}, @@ -486,7 +512,7 @@ "itemFind": {"conditions": [], "operator": "&"}, "itemSort": [{"key": "position", "operator": "+"}], "itemView": "info", - "listColumns": ["title", "director", "country", "year", "language", "duration", "source"], + "listColumns": ["title", "director", "location", "collection", "language", "duration", "source"], "listColumnWidth": {}, "listSelection": [], "listSort": [{"key": "director", "operator": "+"}], diff --git a/pandora/settings.py b/pandora/settings.py index a712e14d..b1108d6b 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -185,8 +185,8 @@ VIDEO_PREFIX='' #SESSION_COOKIE_DOMAIN=*.example.com" SCRIPT_ROOT = normpath(join(PROJECT_ROOT, '..', 'scripts')) -#copy scripts and adjust to customize -ITEM_POSTER = join(SCRIPT_ROOT, 'oxdb_poster') +#change script to customize +ITEM_POSTER = join(SCRIPT_ROOT, 'poster') #ITEM_POSTER = join(SCRIPT_ROOT, 'padma_poster') ITEM_ICON = join(SCRIPT_ROOT, 'item_icon') LIST_ICON = join(SCRIPT_ROOT, 'list_icon') diff --git a/pandora/templates/embed.html b/pandora/templates/embed.html index 6f46ce86..23563597 100644 --- a/pandora/templates/embed.html +++ b/pandora/templates/embed.html @@ -3,6 +3,10 @@ {{settings.SITENAME}} + diff --git a/pandora/templates/index.html b/pandora/templates/index.html index 357beb59..d43b8183 100644 --- a/pandora/templates/index.html +++ b/pandora/templates/index.html @@ -8,6 +8,10 @@ + diff --git a/pandora/urlalias/models.py b/pandora/urlalias/models.py index 5cd491f6..1e3da09f 100644 --- a/pandora/urlalias/models.py +++ b/pandora/urlalias/models.py @@ -15,6 +15,14 @@ class LayerAlias(models.Model): def __unicode__(self): return u"%s=%s" % (self.old, self.new) +class ListAlias(models.Model): + + old = models.CharField(max_length=255, unique=True) + new = models.CharField(max_length=255) + + def __unicode__(self): + return u"%s=%s" % (self.old, self.new) + class Alias(models.Model): url = models.CharField(max_length=255, unique=True) target = models.CharField(max_length=255) diff --git a/pandora/user/models.py b/pandora/user/models.py index 26339c08..d940e57e 100644 --- a/pandora/user/models.py +++ b/pandora/user/models.py @@ -222,7 +222,7 @@ def get_ui(user_ui, user=None): pos = Position.objects.get(list=l, section=section) created = False except Position.DoesNotExist: - pos = Position(list=l, section=section, user=user) + pos = Position(list=l, section=section, user=l.user) pos.save() created = True else: diff --git a/static/js/pandora/filesView.js b/static/js/pandora/filesView.js index cc02ba27..57372d57 100644 --- a/static/js/pandora/filesView.js +++ b/static/js/pandora/filesView.js @@ -18,7 +18,7 @@ pandora.ui.filesView = function(options, self) { self.$toolbar = Ox.Bar({ size: 24 }); - + /* self.$userSelect = Ox.Select({ items: [ {id: 'admin', title: 'Admin', disabled: true}, @@ -36,7 +36,7 @@ pandora.ui.filesView = function(options, self) { margin: '4px' }) .appendTo(self.$toolbar); - + */ self.$ignoreButton = Ox.Button({ disabled: 'true', title: 'Ignore Selected Files...'