From 1d40ceca8f408ff7381e4b4bf2d05fee4ef7d6e4 Mon Sep 17 00:00:00 2001 From: j Date: Sun, 7 Oct 2018 14:41:25 +0200 Subject: [PATCH 1/2] remove unused external keys --- pandora/item/models.py | 5 +++++ pandora/settings.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/pandora/item/models.py b/pandora/item/models.py index 3750d3ac..6f7e45b5 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -307,6 +307,11 @@ class Item(models.Model): response = external_data('getData', {'id': self.public_id}) if response['status']['code'] == 200: self.external_data = response['data'] + keys = [ + k['id'] for k in settings.CONFIG['itemKeys'] + ] + settings.ADDITIONAL_IMDB_KEYS + for key in set(self.external_data) - set(keys): + del self.external_data[key] self.save(sync=True) if poster_url != self.prefered_poster_url(): self.remove_poster() diff --git a/pandora/settings.py b/pandora/settings.py index 22229d7d..a8e59fed 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -217,6 +217,11 @@ POSTER_PRECEDENCE = () POSTER_ONLY_PORTRAIT = () USE_IMDB = False +ADDITIONAL_IMDB_KEYS = [ + 'cast', + 'links', 'reviews', 'posters', + 'alternativeTitles', 'originalTitle', +] #If you set VIDEO_PREFIX make sure cookies work accros subsomains #by setting SESSION_COOKIE_DOMAIN to ".domain.tld" From d7fa7efcbcf92de3251b857c5e92dea63962e766 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 9 Oct 2018 16:32:35 +0200 Subject: [PATCH 2/2] add layer option to populate default value for new annotations --- pandora/config.pandora.jsonc | 2 ++ static/js/editor.js | 6 ++++-- static/js/utils.js | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pandora/config.pandora.jsonc b/pandora/config.pandora.jsonc index 1c5cf71b..fcde8ab9 100644 --- a/pandora/config.pandora.jsonc +++ b/pandora/config.pandora.jsonc @@ -864,6 +864,8 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution. "canPlayClips": If true, clips from this layer will play for users with canPlayClips access "entity": ID of the referenced entity (if type is "entity") + "getDefaults": function in pandora namespace that gets called + to populate defaults for new annotations. i.e. getCurrentFrameAnnotation "hasEvents": If true, the calendar will be populated with matches from this layer "hasPlaces": If true, the map will be populated with matches from this diff --git a/static/js/editor.js b/static/js/editor.js index 190aac97..00dddae8 100644 --- a/static/js/editor.js +++ b/static/js/editor.js @@ -114,7 +114,8 @@ pandora.ui.editor = function(data) { // async to not capture keyboard input setTimeout(function() { var created = Ox.formatDate(new Date(), '%Y-%m-%dT%H:%M:%SZ'), - type = Ox.getObjectById(pandora.site.layers, data.layer).type; + layer = Ox.getObjectById(pandora.site.layers, data.layer), + type = layer.type; that.addAnnotation(data.layer, Ox.extend( { created: created, @@ -131,7 +132,8 @@ pandora.ui.editor = function(data) { place: {lat: null, lng: null} } : type == 'event' ? { event: {start: '', end: ''} - } : {} + } : {}, + layer.getDefaults ? pandora[layer.getDefaults](data) : {} )); Ox.Request.clearCache(); }); diff --git a/static/js/utils.js b/static/js/utils.js index 30d360cd..60c3db53 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -1274,6 +1274,15 @@ pandora.getClipVideos = function(clip, resolution) { })); }; +pandora.getCurrentFrameAnnotation = function(data) { + var ui = pandora.user.ui, + position = ui.videoPoints[ui.item].position, + resolution = Ox.max(pandora.site.video.resolutions); + return { + value: '\n\n' + }; +}; + (function() { var itemTitles = {}, documentTitles = {}; pandora.getWindowTitle = function(itemData) {