change video resolution, close tv

This commit is contained in:
j 2011-12-20 18:38:30 +05:30
parent 948423fee4
commit 8e40f95f0d
7 changed files with 45 additions and 19 deletions

View file

@ -644,6 +644,7 @@
"sidebarSize": 256, "sidebarSize": 256,
"theme": "modern", "theme": "modern",
"videoPoints": {}, "videoPoints": {},
"videoResolution": 96,
"videoScale": "fit", "videoScale": "fit",
"videoMuted": false, "videoMuted": false,
"videoSize": "small", "videoSize": "small",

View file

@ -75,7 +75,7 @@ def update_static():
for f in files: for f in files:
if f.endswith('.js') and len(f.split('.')) == 2: if f.endswith('.js') and len(f.split('.')) == 2:
f = os.path.join(root, f) f = os.path.join(root, f)
fsite = f.replace('.js', '.%s.js' % settings.SITENAME) fsite = f.replace('.js', '.%s.js' % settings.CONFIG['site']['id'])
if os.path.exists(fsite): if os.path.exists(fsite):
f = fsite f = fsite
js.append(f[len(settings.STATIC_ROOT)+1:]) js.append(f[len(settings.STATIC_ROOT)+1:])

View file

@ -42,12 +42,12 @@
], ],
// fixme: either this, or filter: true in itemKeys, but not both // fixme: either this, or filter: true in itemKeys, but not both
"filters": [ "filters": [
{"id": "collection", "title": "Collection", "type": "string"},
{"id": "source", "title": "Source", "type": "string"},
{"id": "director", "title": "Director", "type": "string"}, {"id": "director", "title": "Director", "type": "string"},
{"id": "location", "title": "Location", "type": "string"}, {"id": "location", "title": "Location", "type": "string"},
{"id": "year", "title": "Year", "type": "integer"}, {"id": "year", "title": "Year", "type": "integer"},
{"id": "language", "title": "Language", "type": "string"}, {"id": "language", "title": "Language", "type": "string"},
{"id": "source", "title": "Source", "type": "string"},
{"id": "collection", "title": "Collection", "type": "string"},
{"id": "category", "title": "Category", "type": "string"}, {"id": "category", "title": "Category", "type": "string"},
{"id": "writer", "title": "Writer", "type": "string"}, {"id": "writer", "title": "Writer", "type": "string"},
{"id": "producer", "title": "Producer", "type": "string"}, {"id": "producer", "title": "Producer", "type": "string"},
@ -488,6 +488,9 @@
{"id": "size", "admin": true}, {"id": "size", "admin": true},
{"id": "pixels"} {"id": "pixels"}
], ],
"tv": {
"showLogo": false
},
"user": { "user": {
"level": "guest", "level": "guest",
"ui": { "ui": {
@ -500,10 +503,10 @@
} }
}, },
"filters": [ "filters": [
{"id": "director", "sort": [{"key": "items", "operator": "-"}]},
{"id": "source", "sort": [{"key": "items", "operator": "-"}]},
{"id": "collection", "sort": [{"key": "name", "operator": "-"}]}, {"id": "collection", "sort": [{"key": "name", "operator": "-"}]},
{"id": "source", "sort": [{"key": "items", "operator": "-"}]},
{"id": "category", "sort": [{"key": "items", "operator": "-"}]}, {"id": "category", "sort": [{"key": "items", "operator": "-"}]},
{"id": "keyword", "sort": [{"key": "items", "operator": "-"}]},
{"id": "location", "sort": [{"key": "items", "operator": "-"}]} {"id": "location", "sort": [{"key": "items", "operator": "-"}]}
], ],
"filtersSize": 176, "filtersSize": 176,
@ -548,6 +551,7 @@
"sidebarSize": 256, "sidebarSize": 256,
"theme": "classic", "theme": "classic",
"videoPoints": {}, "videoPoints": {},
"videoResolution": 96,
"videoScale": "fit", "videoScale": "fit",
"videoMuted": false, "videoMuted": false,
"videoSize": "small", "videoSize": "small",

View file

@ -203,7 +203,6 @@ appPanel
site: data.site, site: data.site,
user: data.user user: data.user
}); });
// make sure all valid ui settings are present // make sure all valid ui settings are present
pandora.user.ui = Ox.extend( pandora.user.ui = Ox.extend(
Ox.clone(pandora.site.user.ui), pandora.user.ui Ox.clone(pandora.site.user.ui), pandora.user.ui

View file

@ -133,6 +133,7 @@ pandora.ui.item = function() {
muted: pandora.user.ui.videoMuted, muted: pandora.user.ui.videoMuted,
out: pandora.user.ui.videoPoints[pandora.user.ui.item].out, out: pandora.user.ui.videoPoints[pandora.user.ui.item].out,
position: pandora.user.ui.videoPoints[pandora.user.ui.item].position, position: pandora.user.ui.videoPoints[pandora.user.ui.item].position,
resolution: pandora.user.ui.videoResolution,
scaleToFill: pandora.user.ui.videoScale == 'fill', scaleToFill: pandora.user.ui.videoScale == 'fill',
showAnnotations: pandora.user.ui.showAnnotations, showAnnotations: pandora.user.ui.showAnnotations,
showTimeline: pandora.user.ui.showTimeline, showTimeline: pandora.user.ui.showTimeline,
@ -161,6 +162,9 @@ pandora.ui.item = function() {
resizeannotations: function(data) { resizeannotations: function(data) {
pandora.UI.set('annotationsSize', data.annotationsSize); pandora.UI.set('annotationsSize', data.annotationsSize);
}, },
resolution: function(data) {
pandora.UI.set('videoResolution', data.resolution);
},
scale: function(data) { scale: function(data) {
pandora.UI.set('videoScale', data.scale); pandora.UI.set('videoScale', data.scale);
}, },
@ -185,7 +189,7 @@ pandora.ui.item = function() {
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.contentPanel.replaceElement(1,
pandora.$ui.editor = Ox.VideoEditor({ pandora.$ui.editor = Ox.VideoEditor({
annotationsSize: pandora.user.ui.annotationsSize, annotationsSize: pandora.user.ui.annotationsSize,
censored: censored, censored: videoOptions.censored,
cuts: result.data.cuts || [], cuts: result.data.cuts || [],
duration: result.data.duration, duration: result.data.duration,
find: pandora.user.ui.itemFind.conditions[0] find: pandora.user.ui.itemFind.conditions[0]
@ -202,16 +206,17 @@ pandora.ui.item = function() {
height: pandora.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
id: 'editor', id: 'editor',
'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'], 'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'],
layers: layers, layers: videoOptions.layers,
muted: pandora.user.ui.videoMuted, muted: pandora.user.ui.videoMuted,
out: pandora.user.ui.videoPoints[pandora.user.ui.item].out, out: pandora.user.ui.videoPoints[pandora.user.ui.item].out,
position: pandora.user.ui.videoPoints[pandora.user.ui.item].position, position: pandora.user.ui.videoPoints[pandora.user.ui.item].position,
posterFrame: parseInt(video.duration / 2), posterFrame: parseInt(videoOptions.video.duration / 2),
resolution: pandora.user.ui.videoResolution,
showAnnotations: pandora.user.ui.showAnnotations, showAnnotations: pandora.user.ui.showAnnotations,
showLargeTimeline: true, showLargeTimeline: true,
subtitles: subtitles, subtitles: videoOptions.subtitles,
tooltips: true, tooltips: true,
video: video, video: videoOptions.video,
videoRatio: result.data.videoRatio, videoRatio: result.data.videoRatio,
videoSize: pandora.user.ui.videoSize, videoSize: pandora.user.ui.videoSize,
volume: pandora.user.ui.videoVolume, volume: pandora.user.ui.videoVolume,
@ -247,6 +252,9 @@ pandora.ui.item = function() {
resizeend: function(data) { resizeend: function(data) {
pandora.UI.set({annotationsSize: data.size}); pandora.UI.set({annotationsSize: data.size});
}, },
resolution: function(data) {
pandora.UI.set('videoResolution', data.resolution);
},
togglesize: function(data) { togglesize: function(data) {
pandora.UI.set({videoSize: data.size}); pandora.UI.set({videoSize: data.size});
}, },

View file

@ -20,7 +20,7 @@ pandora.ui.tv = function() {
list: pandora.user.ui._list list: pandora.user.ui._list
}, function(result) { }, function(result) {
var videoOptions = pandora.getVideoOptions(result.data); var videoOptions = pandora.getVideoOptions(result.data);
$player && player.remove(); $player && $player.remove();
$player = Ox.VideoPlayer({ $player = Ox.VideoPlayer({
censored: videoOptions.censored, censored: videoOptions.censored,
controlsBottom: ['volume', 'scale', 'timeline', 'position', 'resolution'], controlsBottom: ['volume', 'scale', 'timeline', 'position', 'resolution'],
@ -29,6 +29,7 @@ pandora.ui.tv = function() {
fullscreen: true, fullscreen: true,
logo: pandora.site.tv.showLogo ? '/static/png/logo256.png' : '', logo: pandora.site.tv.showLogo ? '/static/png/logo256.png' : '',
position: result.data.position, position: result.data.position,
resolution: pandora.user.ui.videoResolution,
scaleToFill: pandora.user.ui.videoScale == 'fill', scaleToFill: pandora.user.ui.videoScale == 'fill',
subtitles: videoOptions.subtitles, subtitles: videoOptions.subtitles,
tooltips: true, tooltips: true,
@ -45,10 +46,11 @@ pandora.ui.tv = function() {
volume: pandora.user.ui.videoVolume volume: pandora.user.ui.videoVolume
}) })
.bindEvent({ .bindEvent({
close: function() { close: that.fadeOutScreen,
ended: play,
}, resolution: function(data) {
ended: play pandora.UI.set('videoResolution', data.resolution);
}
}) })
.appendTo(that); .appendTo(that);
}); });
@ -57,21 +59,29 @@ pandora.ui.tv = function() {
that.fadeInScreen = function() { that.fadeInScreen = function() {
that.appendTo(Ox.UI.$body).animate({opacity: 1}, 500); that.appendTo(Ox.UI.$body).animate({opacity: 1}, 500);
play(); play();
return that;
}; };
that.fadeOutScreen = function() { that.fadeOutScreen = function() {
that.animate({opacity: 0}, 500, function() {
that.remove();
});
pandora.UI.set('page', '');
return that;
}; };
that.hideScreen = function() { that.hideScreen = function() {
that.remove();
pandora.UI.set('page', '');
return that;
}; };
that.showScreen = function() { that.showScreen = function() {
that.css({opacity: 1}).appendTo(Ox.UI.$body); that.css({opacity: 1}).appendTo(Ox.UI.$body);
play(); play();
return that;
}; };
return that; return that;
} }

View file

@ -760,6 +760,10 @@ pandora.getVideoOptions = function(data) {
+ resolution + 'p' + part + '.' + pandora.user.videoFormat; + resolution + 'p' + part + '.' + pandora.user.videoFormat;
}); });
}); });
options.layers = [];
pandora.site.layers.forEach(function(layer, i) {
options.layers[i] = Ox.extend({}, layer, {items: data.layers[layer.id]});
});
return options; return options;
}; };