poster precedence

This commit is contained in:
j 2011-08-01 17:51:34 +02:00
parent 3a98849664
commit 4a02ce7775
2 changed files with 6 additions and 4 deletions

View file

@ -313,7 +313,8 @@ class Item(models.Model):
for service in services: for service in services:
if service not in precedence: if service not in precedence:
precedence.append(service) precedence.append(service)
precedence.append(settings.URL) if settings.URL not in precedence:
precedence.append(settings.URL)
posters = [ posters = [
{ {
@ -337,6 +338,7 @@ class Item(models.Model):
'selected': p.url == url, 'selected': p.url == url,
'precedence': precedence.index(p.service) 'precedence': precedence.index(p.service)
}) })
posters.sort(key=lambda a: a['precedence'])
return posters return posters
def get_stream(self): def get_stream(self):

View file

@ -59,13 +59,13 @@ pandora.ui.postersDialog = function(id) {
} }
}, },
items: posters, items: posters,
keys: ['source', 'width', 'height', 'url'], keys: ['precedence', 'source', 'width', 'height', 'url'],
max: 1, max: 1,
min: 1, min: 1,
orientation: 'vertical', orientation: 'vertical',
selected: selected, selected: selected,
size: 128, size: 128,
sort: [{key: 'source', operator: '+'}], sort: [{key: 'precedence', operator: '+'}],
unique: 'source' unique: 'source'
}) })
.css({background: 'rgb(16, 16, 16)'}) .css({background: 'rgb(16, 16, 16)'})