From 1bff4aa0e9a17f6711c46c1f46e81fbf449965e7 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 1 Apr 2016 16:40:20 +0200 Subject: [PATCH] avoid storing invalid poster frames, only show videos with video --- pandora/text/models.py | 5 ++++- static/js/listDialog.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pandora/text/models.py b/pandora/text/models.py index 2a915ad5..85e7136c 100644 --- a/pandora/text/models.py +++ b/pandora/text/models.py @@ -162,7 +162,10 @@ class Text(models.Model): if 'type' in data: self.type = data['type'] == 'pdf' and 'pdf' or 'html' if 'posterFrames' in data: - self.poster_frames = tuple(data['posterFrames']) + poster_frames = [p for p in data['posterFrames'] if 'item' in p] + while len(poster_frames) < 4: + poster_frames += [poster_frames[-1]] + self.poster_frames = tuple(poster_frames) if 'embeds' in data: self.embeds = tuple(data['embeds']) self.save() diff --git a/static/js/listDialog.js b/static/js/listDialog.js index 18791f7f..e9522bdf 100644 --- a/static/js/listDialog.js +++ b/static/js/listDialog.js @@ -481,7 +481,9 @@ pandora.ui.listIconPanel = function(listData) { query: { conditions: ui.section == 'items' ? [{key: 'list', value: listData.id, operator: '=='}] - : listData.query ? listData.query.conditions : [], + : listData.query + ? listData.query.conditions + : [{key: 'duration', value: '00:00:00', operator: '>'}], operator: '&' } }), callback);