use posterRatio

This commit is contained in:
j 2011-08-19 14:33:02 +02:00
parent 2140a55cbf
commit c25099920c
5 changed files with 15 additions and 15 deletions

View file

@ -43,7 +43,7 @@ pandora.ui.browser = function() {
id: 'list', id: 'list',
item: function(data, sort, size) { item: function(data, sort, size) {
var icons = pandora.user.ui.icons, var icons = pandora.user.ui.icons,
ratio = icons == 'posters' ? data.poster.width / data.poster.height : 1; ratio = icons == 'posters' ? data.posterRatio : 1;
size = size || 64; size = size || 64;
return { return {
height: ratio <= 1 ? size : size / ratio, height: ratio <= 1 ? size : size / ratio,
@ -61,7 +61,7 @@ pandora.ui.browser = function() {
query: pandora.Query.toObject() query: pandora.Query.toObject()
}), callback); }), callback);
}, },
keys: ['director', 'id', 'poster', 'title', 'year'], keys: ['director', 'id', 'posterRatio', 'title', 'year'],
max: 1, max: 1,
min: 1, min: 1,
orientation: 'horizontal', orientation: 'horizontal',

View file

@ -12,8 +12,8 @@ pandora.ui.info = function(id) {
if (id) { if (id) {
if (!pandora.user.ui.item && pandora.user.ui.lists[pandora.user.ui.list].listView == 'clip') { if (!pandora.user.ui.item && pandora.user.ui.lists[pandora.user.ui.list].listView == 'clip') {
// Poster // Poster
pandora.api.get({id: id, keys: ['poster']}, function(result) { pandora.api.get({id: id, keys: ['posterRatio']}, function(result) {
var ratio = result.data.poster.width / result.data.poster.height, var ratio = result.data.posterRatio,
height = pandora.user.ui.sidebarSize; height = pandora.user.ui.sidebarSize;
that.empty().append( that.empty().append(
$('<img>').attr({ $('<img>').attr({

View file

@ -10,7 +10,7 @@ pandora.ui.infoView = function(data) {
margin = 16, margin = 16,
iconSize = pandora.user.ui.infoIconSize, iconSize = pandora.user.ui.infoIconSize,
iconRatio = pandora.user.ui.icons == 'posters' iconRatio = pandora.user.ui.icons == 'posters'
? data.poster.width / data.poster.height : 1, ? data.posterRatio : 1,
iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio), iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio),
iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio), iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio),
iconLeft = iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0, iconLeft = iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0,
@ -501,7 +501,7 @@ pandora.ui.infoView = function(data) {
$reflectionIcon.attr({src: src}); $reflectionIcon.attr({src: src});
iconSize = iconSize == 256 ? 512 : 256; iconSize = iconSize == 256 ? 512 : 256;
iconRatio = pandora.user.ui.icons == 'posters' iconRatio = pandora.user.ui.icons == 'posters'
? data.poster.width / data.poster.height : 1; ? data.posterRatio : 1;
toggleIconSize(); toggleIconSize();
pandora.user.level == 'admin' && $list.replaceWith($list = renderList()); pandora.user.level == 'admin' && $list.replaceWith($list = renderList());
}; };

View file

@ -119,7 +119,7 @@ pandora.ui.item = function() {
/* /*
$.get('/static/html/itemInfo.html', {}, function(template) { $.get('/static/html/itemInfo.html', {}, function(template) {
//Ox.print(template); //Ox.print(template);
var posterRatio = result.data.poster.width / result.data.poster.height; var posterRatio = result.data.posterRatio;
result.data.posterWidth = posterRatio > 1 ? 256 : Math.round(256 * posterRatio); result.data.posterWidth = posterRatio > 1 ? 256 : Math.round(256 * posterRatio);
result.data.posterHeight = posterRatio < 1 ? 256 : Math.round(256 / posterRatio); result.data.posterHeight = posterRatio < 1 ? 256 : Math.round(256 / posterRatio);
result.data.posterLeft = Math.floor((256 - result.data.posterWidth) / 2); result.data.posterLeft = Math.floor((256 - result.data.posterWidth) / 2);

View file

@ -86,7 +86,7 @@ pandora.ui.list = function() { // fixme: remove view argument
id: 'list', id: 'list',
item: function(data, sort, size) { item: function(data, sort, size) {
var icons = pandora.user.ui.icons, var icons = pandora.user.ui.icons,
ratio = icons == 'posters' ? data.poster.width / data.poster.height : 1; ratio = icons == 'posters' ? data.posterRatio : 1;
size = size || 128; size = size || 128;
return { return {
height: ratio <= 1 ? size : size / ratio, height: ratio <= 1 ? size : size / ratio,
@ -105,7 +105,7 @@ pandora.ui.list = function() { // fixme: remove view argument
query: pandora.Query.toObject() query: pandora.Query.toObject()
}), callback); }), callback);
}, },
keys: ['director', 'id', 'poster', 'title', 'year'], keys: ['director', 'id', 'posterRatio', 'title', 'year'],
selected: pandora.user.ui.lists[pandora.user.ui.list].selected, selected: pandora.user.ui.lists[pandora.user.ui.list].selected,
size: 128, size: 128,
sort: pandora.user.ui.lists[pandora.user.ui.list].sort, sort: pandora.user.ui.lists[pandora.user.ui.list].sort,
@ -122,7 +122,7 @@ pandora.ui.list = function() { // fixme: remove view argument
id: 'list', id: 'list',
item: function(data, sort, size) { item: function(data, sort, size) {
var icons = pandora.user.ui.icons, var icons = pandora.user.ui.icons,
ratio = icons == 'posters' ? data.poster.width / data.poster.height : 1; ratio = icons == 'posters' ? data.posterRatio : 1;
size = 128; size = 128;
return { return {
icon: { icon: {
@ -153,7 +153,7 @@ pandora.ui.list = function() { // fixme: remove view argument
query: pandora.Query.toObject() query: pandora.Query.toObject()
}), callback); }), callback);
}, },
keys: ['director', 'duration', 'id', 'poster', 'title', 'year'], keys: ['director', 'duration', 'id', 'posterRatio', 'title', 'year'],
selected: pandora.user.ui.lists[pandora.user.ui.list].selected, selected: pandora.user.ui.lists[pandora.user.ui.list].selected,
size: 192, size: 192,
sort: pandora.user.ui.lists[pandora.user.ui.list].sort, sort: pandora.user.ui.lists[pandora.user.ui.list].sort,
@ -441,7 +441,7 @@ pandora.ui.list = function() { // fixme: remove view argument
openpreview: function(data) { openpreview: function(data) {
pandora.requests.preview && pandora.api.cancel(pandora.requests.preview); pandora.requests.preview && pandora.api.cancel(pandora.requests.preview);
pandora.requests.preview = pandora.api.find({ pandora.requests.preview = pandora.api.find({
keys: ['director', 'id', 'poster', 'title'], keys: ['director', 'id', 'posterRatio', 'title'],
query: { query: {
conditions: $.map(data.ids, function(id, i) { conditions: $.map(data.ids, function(id, i) {
return { return {
@ -454,8 +454,8 @@ pandora.ui.list = function() { // fixme: remove view argument
} }
}, function(result) { }, function(result) {
var item = result.data.items[0], var item = result.data.items[0],
title = item.title + ' (' + item.director + ')' title = item.title + ' (' + item.director + ')',
ratio = item.poster.width / item.poster.height, ratio = item.posterRatio,
windowWidth = window.innerWidth * 0.8, windowWidth = window.innerWidth * 0.8,
windowHeight = window.innerHeight * 0.8, windowHeight = window.innerHeight * 0.8,
windowRatio = windowWidth / windowHeight, windowRatio = windowWidth / windowHeight,