avoid storing invalid poster frames, only show videos with video

This commit is contained in:
j 2016-04-01 16:40:20 +02:00
parent b8beb51480
commit 1bff4aa0e9
2 changed files with 7 additions and 2 deletions

View file

@ -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()

View file

@ -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);