From 0af1b545d1d1295f5ec01e69b4b5f8c583465609 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 13 Sep 2014 22:18:46 +0100 Subject: [PATCH] fix tv, fix censored --- static/js/tv.js | 3 +++ static/js/utils.js | 22 +++++----------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/static/js/tv.js b/static/js/tv.js index 428585484..cefdac69e 100644 --- a/static/js/tv.js +++ b/static/js/tv.js @@ -76,6 +76,9 @@ pandora.ui.tv = function() { resolution: pandora.user.ui.videoResolution, scaleToFill: pandora.user.ui.videoScale == 'fill', subtitles: videoOptions.subtitles, + subtitlesDefaultTrack: Ox.getLanguageNameByCode(pandora.site.language), + subtitlesLayer: videoOptions.subtitlesLayer, + subtitlesTrack: Ox.getLanguageNameByCode(pandora.site.language), tooltips: true, timeline: '/' + result.data.item + '/timeline16p.jpg', title: pandora.site.site.name + ' — ' + ( diff --git a/static/js/utils.js b/static/js/utils.js index e55c5eb16..90e7b4fe2 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -1758,29 +1758,17 @@ pandora.getVideoOptions = function(data) { }).map(function(layer) { return layer.id; })[0]; - options.subtitles = options.subtitlesLayer - ? data.layers[options.subtitlesLayer].map(function(subtitle) { - return Ox.extend({ - id: subtitle.id, - 'in': subtitle['in'], - out: subtitle.out, - text: subtitle.value.replace(/\n/g, ' ').replace(//g, '\n') - }, subtitle.languages ? { - tracks: subtitle.languages - } : {}); - }) - : []; - + options.censored = canPlayVideo ? [] : canPlayClips ? ( - options.subtitles.length - ? options.subtitles.map(function(subtitle, i) { + options.subtitlesLayer + ? data.layers[options.subtitlesLayer].map(function(subtitle, i) { return { - 'in': i == 0 ? 0 : options.subtitles[i - 1].out, + 'in': i == 0 ? 0 : subtitles[i - 1].out, out: subtitle['in'] }; }).concat( - [{'in': Ox.last(options.subtitles).out, out: data.duration}] + [{'in': Ox.last(data.layers[options.subtitlesLayer]).out, out: data.duration}] ).filter(function(censored) { // don't include gaps shorter than one second return censored.out - censored['in'] >= 1;