only load layers for video/timeline view

This commit is contained in:
j 2011-10-20 11:05:48 +02:00
parent 02bf2707a3
commit fcd12af35c
2 changed files with 156 additions and 150 deletions

View file

@ -391,7 +391,7 @@ def get(request):
info = item.get_json(data['keys'])
if not data['keys'] or 'stream' in data['keys']:
info['stream'] = item.get_stream()
if not data['keys'] or 'layers' in data['keys']:
if data['keys'] and 'layers' in data['keys']:
info['layers'] = item.get_layers(request.user)
if data['keys'] and 'files' in data['keys']:
info['files'] = item.get_files(request.user)

View file

@ -105,8 +105,9 @@ pandora.ui.item = function() {
// fixme: duplicated
var layers = [],
video = {};
pandora.api.get({id: pandora.user.ui.item, keys: ['layers']}, function(r) {
pandora.site.layers.forEach(function(layer, i) {
layers[i] = Ox.extend({}, layer, {items: result.data.layers[layer.id]});
layers[i] = Ox.extend({}, layer, {items: r.data.layers[layer.id]});
});
pandora.site.video.resolutions.forEach(function(resolution) {
video[resolution] = Ox.range(result.data.parts).map(function(i) {
@ -130,7 +131,8 @@ pandora.ui.item = function() {
scaleToFill: pandora.user.ui.videoScale == 'fill',
showAnnotations: pandora.user.ui.showAnnotations,
showControls: pandora.user.ui.showControls,
subtitles: result.data.layers.subtitles ? result.data.layers.subtitles.map(function(subtitle) {
subtitles: r.data.layers.subtitles ?
r.data.layers.subtitles.map(function(subtitle) {
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
}) : [],
tooltips: true,
@ -164,12 +166,14 @@ pandora.ui.item = function() {
pandora.$ui.player.options({showAnnotations: data.value});
}
}));
});
} else if (pandora.user.ui.itemView == 'timeline') {
var layers = [],
video = {};
pandora.api.get({id: pandora.user.ui.item, keys: ['layers']}, function(r) {
pandora.site.layers.forEach(function(layer) {
layers.push(Ox.extend({items: result.data.layers[layer.id]}, layer));
layers.push(Ox.extend({items: r.data.layers[layer.id]}, layer));
});
pandora.site.video.resolutions.forEach(function(resolution) {
video[resolution] = Ox.range(result.data.parts).map(function(i) {
@ -202,7 +206,8 @@ pandora.ui.item = function() {
showAnnotations: pandora.user.ui.showAnnotations,
showLargeTimeline: true,
// fixme: layers have value, subtitles has text?
subtitles: result.data.layers.subtitles ? result.data.layers.subtitles.map(function(subtitle) {
subtitles: r.data.layers.subtitles ?
r.data.layers.subtitles.map(function(subtitle) {
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
}) : [],
tooltips: true,
@ -267,6 +272,7 @@ pandora.ui.item = function() {
height: data.size
});
});
});
/*
pandora.$ui.rightPanel.bindEvent('resize', function(data) {
Ox.print('... rightPanel resize', data, pandora.$ui.timelinePanel.size(1))