From 6f51a6ab412524e8120bb22223d043b4dd3b9250 Mon Sep 17 00:00:00 2001
From: rlx <0x0073@0x2620.org>
Date: Sat, 20 Aug 2011 09:47:56 +0000
Subject: [PATCH 1/5] player results view (experimental)
---
pandora/0xdb.json | 1 +
static/js/pandora/ui/list.js | 62 ++++++++++++++++++++++++++++++++++--
2 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/pandora/0xdb.json b/pandora/0xdb.json
index 662787d..73adebf 100644
--- a/pandora/0xdb.json
+++ b/pandora/0xdb.json
@@ -444,6 +444,7 @@
{"id": "maps", "title": "with Maps"},
{"id": "calendars", "title": "with Calendars"},
{"id": "clip", "title": "as Clips"},
+ {"id": "player", "title": "as Player"},
{"id": "map", "title": "on Map"},
{"id": "calendar", "title": "on Calendar"}
],
diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js
index f7a58f4..e4c0889 100644
--- a/static/js/pandora/ui/list.js
+++ b/static/js/pandora/ui/list.js
@@ -191,10 +191,10 @@ pandora.ui.list = function() { // fixme: remove view argument
query.conditions.push({key: 'value', value: q.value, operator: q.operator});
}
});
- pandora.api.findAnnotations($.extend(data, {
+ pandora.api.findAnnotations(Ox.extend({
query: query,
itemQuery: itemQuery
- }), callback);
+ }, data), callback);
},
keys: ['id', 'value', 'in', 'out', 'videoRatio'],
max: 1,
@@ -245,7 +245,7 @@ pandora.ui.list = function() { // fixme: remove view argument
poster: '/' + item + '/' + height + 'p' + points[0] + '.jpg',
width: width,
video: partsAndPoints.parts.map(function(i) {
- return '/' + item + '/96p' + (i + 1) + '.' + pandora.user.videoFormat
+ return '/' + item + '/96p' + (i + 1) + '.' + pandora.user.videoFormat;
})
})
.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') {
var fixedRatio = 16/9;
that = Ox.SplitPanel({
From 402111f99c10ec73b131405fb6e12903c7ab199c Mon Sep 17 00:00:00 2001
From: rlx <0x0073@0x2620.org>
Date: Sun, 21 Aug 2011 03:12:46 +0000
Subject: [PATCH 2/5] fix icon list preview
---
static/js/pandora/ui/list.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js
index e4c0889..1545a34 100644
--- a/static/js/pandora/ui/list.js
+++ b/static/js/pandora/ui/list.js
@@ -517,19 +517,19 @@ pandora.ui.list = function() { // fixme: remove view argument
}, function(result) {
var item = result.data.items[0],
title = item.title + ' (' + item.director + ')'
- ratio = item.poster.width / item.poster.height,
+ ratio = item.posterRatio,
windowWidth = window.innerWidth * 0.8,
windowHeight = window.innerHeight * 0.8,
windowRatio = windowWidth / windowHeight,
width = Math.round(ratio > windowRatio ? windowWidth : windowHeight * ratio),
height = Math.round(ratio < windowRatio ? windowHeight : windowWidth / ratio);
pandora.$ui.previewImage = $('')
- .attr({src: item.poster.url.replace('.jpg', '128.jpg')})
+ .attr({src: '/' + item.id + '/poster128.jpg'})
.css({width: width + 'px', height: height + 'px'})
$('').load(function() {
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 (!pandora.$ui.previewDialog) {
pandora.$ui.previewDialog = Ox.Dialog({
From 34ec9d8fc5fbb7a8e6ce4381fb79b4d62a9b7da3 Mon Sep 17 00:00:00 2001
From: rlx <0x0073@0x2620.org>
Date: Sun, 21 Aug 2011 08:17:10 +0000
Subject: [PATCH 3/5] merging changes
---
pandora/0xdb.json | 9 +++++++++
static/js/pandora/ui/infoView.js | 3 ++-
static/js/pandora/ui/menu.js | 4 +++-
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/pandora/0xdb.json b/pandora/0xdb.json
index 73adebf..e0aa3a2 100644
--- a/pandora/0xdb.json
+++ b/pandora/0xdb.json
@@ -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": [
{"id": "director", "title": "Director"},
{"id": "country", "title": "Country"},
diff --git a/static/js/pandora/ui/infoView.js b/static/js/pandora/ui/infoView.js
index 27a1fad..a89b40c 100644
--- a/static/js/pandora/ui/infoView.js
+++ b/static/js/pandora/ui/infoView.js
@@ -439,8 +439,9 @@ pandora.ui.infoView = function(data) {
}, pandora.user.ui.icons == 'posters' ? {
source: selectedImage.source
} : {
- position: selectedImage.index // fixme: api slightly inconsistent
+ position: selectedImage.index // fixme: api slightly inconsistent, this shouldn't be "position"
}), function() {
+ // fixme: update the info (video preview) frame as well
var src;
if (pandora.user.ui.icons == 'frames') {
src = '/' + data.id + '/icon512.jpg?' + Ox.uid()
diff --git a/static/js/pandora/ui/menu.js b/static/js/pandora/ui/menu.js
index c010151..c22f2bb 100644
--- a/static/js/pandora/ui/menu.js
+++ b/static/js/pandora/ui/menu.js
@@ -76,7 +76,9 @@ pandora.ui.mainMenu = function() {
{ id: 'icons', title: 'Icons', items: [
{ 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};
- }) }
+ }) },
+ {},
+ { id: 'usesiteposter', title: 'Always Use ' + pandora.site.site.name + ' Poster' }
] },
{},
{ id: 'openmovie', title: ['Open ' + pandora.site.itemName.singular, 'Open ' + pandora.site.itemName.plural], items: [
From 47a6cdb08514847aabc9d3797a7d3f9d9b7deefd Mon Sep 17 00:00:00 2001
From: rlx <0x0073@0x2620.org>
Date: Tue, 23 Aug 2011 08:09:53 +0000
Subject: [PATCH 4/5] typo in json
---
pandora/0xdb.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pandora/0xdb.json b/pandora/0xdb.json
index 36b3e36..33433e4 100644
--- a/pandora/0xdb.json
+++ b/pandora/0xdb.json
@@ -2,10 +2,10 @@
"clipKeys": [
{"id": "value", "title": "Text"},
{"id": "in", "title": "Position"},
- {"id": "duration": "title": "Duration"},
+ {"id": "duration", "title": "Duration"},
{"id": "hue", "title": "Hue"},
{"id": "saturation", "title": "Saturation"},
- {"id": "lightness": "title": "Lightness"},
+ {"id": "lightness", "title": "Lightness"},
{"id": "volume": "title": "Volume"}
],
"groups": [
From a76941932eeef9a89ff82ce2f62a203d8bed9230 Mon Sep 17 00:00:00 2001
From: rlx <0x0073@0x2620.org>
Date: Tue, 23 Aug 2011 08:10:32 +0000
Subject: [PATCH 5/5] ... and one more
---
pandora/0xdb.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pandora/0xdb.json b/pandora/0xdb.json
index 33433e4..e0e4b4f 100644
--- a/pandora/0xdb.json
+++ b/pandora/0xdb.json
@@ -6,7 +6,7 @@
{"id": "hue", "title": "Hue"},
{"id": "saturation", "title": "Saturation"},
{"id": "lightness", "title": "Lightness"},
- {"id": "volume": "title": "Volume"}
+ {"id": "volume", "title": "Volume"}
],
"groups": [
{"id": "director", "title": "Director"},