From 8e40f95f0da44f75461678fbd321dea9e7c176b4 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 20 Dec 2011 18:38:30 +0530 Subject: [PATCH] change video resolution, close tv --- pandora/0xdb.jsonc | 1 + pandora/app/config.py | 2 +- pandora/padma.jsonc | 12 ++++++++---- static/js/pandora.js | 1 - static/js/pandora/item.js | 18 +++++++++++++----- static/js/pandora/tv.js | 26 ++++++++++++++++++-------- static/js/pandora/utils.js | 4 ++++ 7 files changed, 45 insertions(+), 19 deletions(-) diff --git a/pandora/0xdb.jsonc b/pandora/0xdb.jsonc index 3fb3d6c7..1c706181 100644 --- a/pandora/0xdb.jsonc +++ b/pandora/0xdb.jsonc @@ -644,6 +644,7 @@ "sidebarSize": 256, "theme": "modern", "videoPoints": {}, + "videoResolution": 96, "videoScale": "fit", "videoMuted": false, "videoSize": "small", diff --git a/pandora/app/config.py b/pandora/app/config.py index 7349c6b1..422da3bc 100644 --- a/pandora/app/config.py +++ b/pandora/app/config.py @@ -75,7 +75,7 @@ def update_static(): for f in files: if f.endswith('.js') and len(f.split('.')) == 2: 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): f = fsite js.append(f[len(settings.STATIC_ROOT)+1:]) diff --git a/pandora/padma.jsonc b/pandora/padma.jsonc index 71228830..afccd3a3 100644 --- a/pandora/padma.jsonc +++ b/pandora/padma.jsonc @@ -42,12 +42,12 @@ ], // fixme: either this, or filter: true in itemKeys, but not both "filters": [ + {"id": "collection", "title": "Collection", "type": "string"}, + {"id": "source", "title": "Source", "type": "string"}, {"id": "director", "title": "Director", "type": "string"}, {"id": "location", "title": "Location", "type": "string"}, {"id": "year", "title": "Year", "type": "integer"}, {"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": "writer", "title": "Writer", "type": "string"}, {"id": "producer", "title": "Producer", "type": "string"}, @@ -488,6 +488,9 @@ {"id": "size", "admin": true}, {"id": "pixels"} ], + "tv": { + "showLogo": false + }, "user": { "level": "guest", "ui": { @@ -500,10 +503,10 @@ } }, "filters": [ - {"id": "director", "sort": [{"key": "items", "operator": "-"}]}, - {"id": "source", "sort": [{"key": "items", "operator": "-"}]}, {"id": "collection", "sort": [{"key": "name", "operator": "-"}]}, + {"id": "source", "sort": [{"key": "items", "operator": "-"}]}, {"id": "category", "sort": [{"key": "items", "operator": "-"}]}, + {"id": "keyword", "sort": [{"key": "items", "operator": "-"}]}, {"id": "location", "sort": [{"key": "items", "operator": "-"}]} ], "filtersSize": 176, @@ -548,6 +551,7 @@ "sidebarSize": 256, "theme": "classic", "videoPoints": {}, + "videoResolution": 96, "videoScale": "fit", "videoMuted": false, "videoSize": "small", diff --git a/static/js/pandora.js b/static/js/pandora.js index e7262acd..5d8291cd 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -203,7 +203,6 @@ appPanel site: data.site, user: data.user }); - // make sure all valid ui settings are present pandora.user.ui = Ox.extend( Ox.clone(pandora.site.user.ui), pandora.user.ui diff --git a/static/js/pandora/item.js b/static/js/pandora/item.js index fcf4df09..6f793477 100644 --- a/static/js/pandora/item.js +++ b/static/js/pandora/item.js @@ -133,6 +133,7 @@ pandora.ui.item = function() { muted: pandora.user.ui.videoMuted, out: pandora.user.ui.videoPoints[pandora.user.ui.item].out, position: pandora.user.ui.videoPoints[pandora.user.ui.item].position, + resolution: pandora.user.ui.videoResolution, scaleToFill: pandora.user.ui.videoScale == 'fill', showAnnotations: pandora.user.ui.showAnnotations, showTimeline: pandora.user.ui.showTimeline, @@ -161,6 +162,9 @@ pandora.ui.item = function() { resizeannotations: function(data) { pandora.UI.set('annotationsSize', data.annotationsSize); }, + resolution: function(data) { + pandora.UI.set('videoResolution', data.resolution); + }, scale: function(data) { pandora.UI.set('videoScale', data.scale); }, @@ -185,7 +189,7 @@ pandora.ui.item = function() { pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = Ox.VideoEditor({ annotationsSize: pandora.user.ui.annotationsSize, - censored: censored, + censored: videoOptions.censored, cuts: result.data.cuts || [], duration: result.data.duration, find: pandora.user.ui.itemFind.conditions[0] @@ -202,16 +206,17 @@ pandora.ui.item = function() { height: pandora.$ui.contentPanel.size(1), id: 'editor', 'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'], - layers: layers, + layers: videoOptions.layers, muted: pandora.user.ui.videoMuted, out: pandora.user.ui.videoPoints[pandora.user.ui.item].out, 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, showLargeTimeline: true, - subtitles: subtitles, + subtitles: videoOptions.subtitles, tooltips: true, - video: video, + video: videoOptions.video, videoRatio: result.data.videoRatio, videoSize: pandora.user.ui.videoSize, volume: pandora.user.ui.videoVolume, @@ -247,6 +252,9 @@ pandora.ui.item = function() { resizeend: function(data) { pandora.UI.set({annotationsSize: data.size}); }, + resolution: function(data) { + pandora.UI.set('videoResolution', data.resolution); + }, togglesize: function(data) { pandora.UI.set({videoSize: data.size}); }, diff --git a/static/js/pandora/tv.js b/static/js/pandora/tv.js index f90ae794..52a24009 100644 --- a/static/js/pandora/tv.js +++ b/static/js/pandora/tv.js @@ -20,7 +20,7 @@ pandora.ui.tv = function() { list: pandora.user.ui._list }, function(result) { var videoOptions = pandora.getVideoOptions(result.data); - $player && player.remove(); + $player && $player.remove(); $player = Ox.VideoPlayer({ censored: videoOptions.censored, controlsBottom: ['volume', 'scale', 'timeline', 'position', 'resolution'], @@ -29,6 +29,7 @@ pandora.ui.tv = function() { fullscreen: true, logo: pandora.site.tv.showLogo ? '/static/png/logo256.png' : '', position: result.data.position, + resolution: pandora.user.ui.videoResolution, scaleToFill: pandora.user.ui.videoScale == 'fill', subtitles: videoOptions.subtitles, tooltips: true, @@ -45,10 +46,11 @@ pandora.ui.tv = function() { volume: pandora.user.ui.videoVolume }) .bindEvent({ - close: function() { - - }, - ended: play + close: that.fadeOutScreen, + ended: play, + resolution: function(data) { + pandora.UI.set('videoResolution', data.resolution); + } }) .appendTo(that); }); @@ -57,21 +59,29 @@ pandora.ui.tv = function() { that.fadeInScreen = function() { that.appendTo(Ox.UI.$body).animate({opacity: 1}, 500); play(); + return that; }; that.fadeOutScreen = function() { - + that.animate({opacity: 0}, 500, function() { + that.remove(); + }); + pandora.UI.set('page', ''); + return that; }; that.hideScreen = function() { - + that.remove(); + pandora.UI.set('page', ''); + return that; }; that.showScreen = function() { that.css({opacity: 1}).appendTo(Ox.UI.$body); play(); + return that; }; return that; -} \ No newline at end of file +} diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index e5df9793..cb6ab645 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -760,6 +760,10 @@ pandora.getVideoOptions = function(data) { + 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; };