This commit is contained in:
j 2011-08-23 19:39:44 +02:00
commit c961ab25b9
4 changed files with 76 additions and 7 deletions

View file

@ -1,4 +1,13 @@
{ {
"clipKeys": [
{"id": "value", "title": "Text"},
{"id": "in", "title": "Position"},
{"id": "duration", "title": "Duration"},
{"id": "hue", "title": "Hue"},
{"id": "saturation", "title": "Saturation"},
{"id": "lightness", "title": "Lightness"},
{"id": "volume", "title": "Volume"}
],
"groups": [ "groups": [
{"id": "director", "title": "Director"}, {"id": "director", "title": "Director"},
{"id": "country", "title": "Country"}, {"id": "country", "title": "Country"},
@ -451,6 +460,7 @@
{"id": "maps", "title": "with Maps"}, {"id": "maps", "title": "with Maps"},
{"id": "calendars", "title": "with Calendars"}, {"id": "calendars", "title": "with Calendars"},
{"id": "clip", "title": "as Clips"}, {"id": "clip", "title": "as Clips"},
{"id": "player", "title": "as Player"},
{"id": "map", "title": "on Map"}, {"id": "map", "title": "on Map"},
{"id": "calendar", "title": "on Calendar"} {"id": "calendar", "title": "on Calendar"}
], ],

View file

@ -439,8 +439,9 @@ pandora.ui.infoView = function(data) {
}, pandora.user.ui.icons == 'posters' ? { }, pandora.user.ui.icons == 'posters' ? {
source: selectedImage.source source: selectedImage.source
} : { } : {
position: selectedImage.index // fixme: api slightly inconsistent position: selectedImage.index // fixme: api slightly inconsistent, this shouldn't be "position"
}), function() { }), function() {
// fixme: update the info (video preview) frame as well
var src; var src;
if (pandora.user.ui.icons == 'frames') { if (pandora.user.ui.icons == 'frames') {
src = '/' + data.id + '/icon512.jpg?' + Ox.uid() src = '/' + data.id + '/icon512.jpg?' + Ox.uid()

View file

@ -191,10 +191,10 @@ pandora.ui.list = function() { // fixme: remove view argument
query.conditions.push({key: 'value', value: q.value, operator: q.operator}); query.conditions.push({key: 'value', value: q.value, operator: q.operator});
} }
}); });
pandora.api.findAnnotations($.extend(data, { pandora.api.findAnnotations(Ox.extend({
query: query, query: query,
itemQuery: itemQuery itemQuery: itemQuery
}), callback); }, data), callback);
}, },
keys: ['id', 'value', 'in', 'out', 'videoRatio'], keys: ['id', 'value', 'in', 'out', 'videoRatio'],
max: 1, max: 1,
@ -245,7 +245,7 @@ pandora.ui.list = function() { // fixme: remove view argument
poster: '/' + item + '/' + height + 'p' + points[0] + '.jpg', poster: '/' + item + '/' + height + 'p' + points[0] + '.jpg',
width: width, width: width,
video: partsAndPoints.parts.map(function(i) { video: partsAndPoints.parts.map(function(i) {
return '/' + item + '/96p' + (i + 1) + '.' + pandora.user.videoFormat return '/' + item + '/96p' + (i + 1) + '.' + pandora.user.videoFormat;
}) })
}) })
.addClass('OxTarget') .addClass('OxTarget')
@ -273,6 +273,62 @@ pandora.ui.list = function() { // fixme: remove view argument
} }
} }
}); });
} else if (view == 'player') {
that = Ox.VideoPlayer({
controlsBottom: ['play', 'previous', 'next', 'volume'],
controlsTop: ['fullscreen', 'scale'],
enableMouse: true,
height: 384,
paused: true,
position: 0,
video: function(range, callback) {
var callback = arguments[arguments.length - 1],
range = arguments.length == 2 ? arguments[0] : null,
itemQuery = pandora.Query.toObject(),
query = {conditions:[]};
//fixme: can this be in pandora.Query? dont just check for subtitles
itemQuery.conditions.forEach(function(q) {
if (q.key == 'subtitles') {
query.conditions.push({key: 'value', value: q.value, operator: q.operator});
}
});
pandora.api.findAnnotations(Ox.extend({
query: query,
itemQuery: itemQuery
}, range ? {
keys: ['id', 'in', 'out'],
range: range,
sort: pandora.user.ui.lists[pandora.user.ui.list].sort
} : {}), function(result) {
//Ox.print('API findAnnotations range', range, 'result', result.data);
if (!range) {
callback(result.data.items);
} else {
var counter = 0,
length = range[1] - range[0],
data = [];
result.data.items.forEach(function(item, i) {
var id = item.id.split('/')[0]
pandora.api.get({id: id, keys: ['durations']}, function(result) {
//Ox.print('API get item', id, 'result', result.data);
var points = [item['in'], item.out],
partsAndPoints = pandora.getVideoPartsAndPoints(result.data.durations, points);
data[i] = {
parts: partsAndPoints.parts.map(function(i) {
return '/' + id + '/96p' + (i + 1) + '.' + pandora.user.videoFormat;
}),
points: partsAndPoints.points
}
if (++counter == length) {
callback(data);
}
});
});
}
});
},
width: 512
});
} else if (view == 'map') { } else if (view == 'map') {
var fixedRatio = 16/9; var fixedRatio = 16/9;
that = Ox.SplitPanel({ that = Ox.SplitPanel({
@ -468,12 +524,12 @@ pandora.ui.list = function() { // fixme: remove view argument
width = Math.round(ratio > windowRatio ? windowWidth : windowHeight * ratio), width = Math.round(ratio > windowRatio ? windowWidth : windowHeight * ratio),
height = Math.round(ratio < windowRatio ? windowHeight : windowWidth / ratio); height = Math.round(ratio < windowRatio ? windowHeight : windowWidth / ratio);
pandora.$ui.previewImage = $('<img>') pandora.$ui.previewImage = $('<img>')
.attr({src: item.poster.url.replace('.jpg', '128.jpg')}) .attr({src: '/' + item.id + '/poster128.jpg'})
.css({width: width + 'px', height: height + 'px'}) .css({width: width + 'px', height: height + 'px'})
$('<img>').load(function() { $('<img>').load(function() {
pandora.$ui.previewImage.attr({src: $(this).attr('src')}); pandora.$ui.previewImage.attr({src: $(this).attr('src')});
}) })
.attr({src: item.poster.url.replace('.jpg', '1024.jpg')}); .attr({src: '/' + item.id + '/poster1024.jpg'});
if (!preview) { if (!preview) {
if (!pandora.$ui.previewDialog) { if (!pandora.$ui.previewDialog) {
pandora.$ui.previewDialog = Ox.Dialog({ pandora.$ui.previewDialog = Ox.Dialog({

View file

@ -76,7 +76,9 @@ pandora.ui.mainMenu = function() {
{ id: 'icons', title: 'Icons', items: [ { id: 'icons', title: 'Icons', items: [
{ group: 'viewicons', min: 1, max: 1, items: ['posters', 'frames'].map(function(icons) { { group: 'viewicons', min: 1, max: 1, items: ['posters', 'frames'].map(function(icons) {
return {id: icons, title: Ox.toTitleCase(icons), checked: pandora.user.ui.icons == icons}; return {id: icons, title: Ox.toTitleCase(icons), checked: pandora.user.ui.icons == icons};
}) } }) },
{},
{ id: 'usesiteposter', title: 'Always Use ' + pandora.site.site.name + ' Poster' }
] }, ] },
{}, {},
{ id: 'openmovie', title: ['Open ' + pandora.site.itemName.singular, 'Open ' + pandora.site.itemName.plural], items: [ { id: 'openmovie', title: ['Open ' + pandora.site.itemName.singular, 'Open ' + pandora.site.itemName.plural], items: [