wrap image urls in pandora.getMediaURL to add option to load image from another domain

This commit is contained in:
j 2014-02-02 11:30:25 +00:00 committed by rolux
parent 7de2644eea
commit 522af49a73
22 changed files with 118 additions and 77 deletions

View file

@ -57,6 +57,7 @@ def load_config():
settings.DEFAULT_FROM_EMAIL = config['site']['email']['system'] settings.DEFAULT_FROM_EMAIL = config['site']['email']['system']
settings.SERVER_EMAIL = config['site']['email']['system'] settings.SERVER_EMAIL = config['site']['email']['system']
config['site']['videoprefix'] = settings.VIDEO_PREFIX config['site']['videoprefix'] = settings.VIDEO_PREFIX
config['site']['mediaprefix'] = settings.MEDIA_PREFIX
config['site']['version'] = get_version() config['site']['version'] = get_version()
config['site']['dontValidateUser'] = not settings.AUTH_CHECK_USERNAME config['site']['dontValidateUser'] = not settings.AUTH_CHECK_USERNAME
if not 'folderdepth' in config['site']: if not 'folderdepth' in config['site']:

View file

@ -195,6 +195,8 @@ USE_IMDB = False
#if you set VIDEO_PREFIX make sure cookies work accros subsomains #if you set VIDEO_PREFIX make sure cookies work accros subsomains
VIDEO_PREFIX='' VIDEO_PREFIX=''
#VIDEO_PREFIX = '//video{uid}.example.com' #VIDEO_PREFIX = '//video{uid}.example.com'
MEDIA_PREFIX=''
#VIDEO_PREFIX = '//media.example.com'
#SESSION_COOKIE_DOMAIN = '.example.com' #SESSION_COOKIE_DOMAIN = '.example.com'
SESSION_COOKIE_AGE=60*24*60*60 SESSION_COOKIE_AGE=60*24*60*60

View file

@ -78,10 +78,10 @@ pandora.ui.browser = function() {
var ui = pandora.user.ui, var ui = pandora.user.ui,
ratio = ui.icons == 'posters' ratio = ui.icons == 'posters'
? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1, ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1,
url = '/' + data.id + '/' + ( url = pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
) + '128.jpg?' + data.modified, ) + '128.jpg?' + data.modified),
format, info, sortKey = sort[0].key; format, info, sortKey = sort[0].key;
if (['title', 'director', 'random'].indexOf(sortKey) > -1) { if (['title', 'director', 'random'].indexOf(sortKey) > -1) {
info = data['year']; info = data['year'];

View file

@ -35,7 +35,9 @@ pandora.ui.clipList = function(videoRatio) {
}).map(function(annotation) { }).map(function(annotation) {
return Ox.stripTags(annotation.value.replace(/\n/g, ' ')); return Ox.stripTags(annotation.value.replace(/\n/g, ' '));
}).join('; ') : ''; }).join('; ') : '';
url = '/' + data.id.split('/')[0] + '/' + height + 'p' + data['in'] + '.jpg'; url = pandora.getMediaURL(
'/' + data.id.split('/')[0] + '/' + height + 'p' + data['in'] + '.jpg'
);
sortKey = sort[0].key; sortKey = sort[0].key;
if (['text', 'position', 'duration', 'random'].indexOf(sortKey) > -1) { if (['text', 'position', 'duration', 'random'].indexOf(sortKey) > -1) {
info = Ox.formatDuration(data['in']) + ' - ' info = Ox.formatDuration(data['in']) + ' - '
@ -204,7 +206,9 @@ pandora.ui.clipList = function(videoRatio) {
censoredTooltip: pandora.site.cantPlay.text, censoredTooltip: pandora.site.cantPlay.text,
height: height, height: height,
paused: true, paused: true,
poster: '/' + item + '/' + height + 'p' + points[0] + '.jpg', poster: pandora.getMediaURL(
'/' + item + '/' + height + 'p' + points[0] + '.jpg'
),
rewind: true, rewind: true,
video: pandora.getClipVideos({ video: pandora.getClipVideos({
item: item, item: item,

View file

@ -162,7 +162,7 @@ pandora.ui.documentDialog = function(options) {
center: settings.center, center: settings.center,
height: dialogHeight, height: dialogHeight,
imageHeight: item.dimensions[1], imageHeight: item.dimensions[1],
imagePreviewURL: '/documents/' + item.id + '/256p.jpg', imagePreviewURL: pandora.getMediaURL('/documents/' + item.id + '/256p.jpg'),
imageURL: '/documents/' + item.id + '/' imageURL: '/documents/' + item.id + '/'
+ item.name + '.' + item.extension, + item.name + '.' + item.extension,
imageWidth: item.dimensions[0], imageWidth: item.dimensions[0],

View file

@ -98,7 +98,7 @@ pandora.ui.editPanel = function() {
fullscreen: false, fullscreen: false,
getClipImageURL: function(id, width, height) { getClipImageURL: function(id, width, height) {
var clip = Ox.getObjectById(edit.clips, id); var clip = Ox.getObjectById(edit.clips, id);
return '/' + clip.item + '/' + height + 'p' + clip['in'] + '.jpg'; return pandora.getMediaURL('/' + clip.item + '/' + height + 'p' + clip['in'] + '.jpg');
}, },
getLargeTimelineURL: function(type, i, callback) { getLargeTimelineURL: function(type, i, callback) {
pandora.getLargeEditTimelineURL(edit, type, i, callback); pandora.getLargeEditTimelineURL(edit, type, i, callback);
@ -348,7 +348,7 @@ pandora.ui.editPanel = function() {
item: function(data, sort, size) { item: function(data, sort, size) {
size = size || 128; size = size || 128;
var ui = pandora.user.ui, var ui = pandora.user.ui,
url = '/edit/' + data.id + '/icon' + size + '.jpg?' + data.modified, url = pandora.getMediaURL('/edit/' + data.id + '/icon' + size + '.jpg?' + data.modified),
info = Ox.formatDuration(data.duration); info = Ox.formatDuration(data.duration);
return { return {
height: size, height: size,

View file

@ -29,13 +29,13 @@ pandora.ui.editor = function(data) {
enableSubtitles: ui.videoSubtitles, enableSubtitles: ui.videoSubtitles,
find: ui.itemFind, find: ui.itemFind,
getFrameURL: function(position) { getFrameURL: function(position) {
return '/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg?' + data.modified; return pandora.getMediaURL('/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg?' + data.modified);
}, },
getLargeTimelineURL: function(type, i) { getLargeTimelineURL: function(type, i) {
return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg?' + data.modified; return pandora.getMediaURL('/' + ui.item + '/timeline' + type + '64p' + i + '.jpg?' + data.modified);
}, },
getSmallTimelineURL: function(type, i) { getSmallTimelineURL: function(type, i) {
return '/' + ui.item + '/timeline' + type + '16p' + i + '.jpg?' + data.modified; return pandora.getMediaURL('/' + ui.item + '/timeline' + type + '16p' + i + '.jpg?' + data.modified);
}, },
height: pandora.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
id: 'editor', id: 'editor',
@ -298,9 +298,9 @@ pandora.ui.editor = function(data) {
function updateBrowser() { function updateBrowser() {
pandora.$ui.browser.find('img[src*="/' + ui.item + '/"]').each(function() { pandora.$ui.browser.find('img[src*="/' + ui.item + '/"]').each(function() {
$(this).attr({ $(this).attr({
src: '/' + ui.item + '/' + ( src: pandora.getMediaURL('/' + ui.item + '/' + (
ui.icons == 'posters' ? 'poster' : 'icon' ui.icons == 'posters' ? 'poster' : 'icon'
) + '128.jpg?' + Ox.uid() ) + '128.jpg?' + Ox.uid())
}); });
}); });
} }

View file

@ -17,7 +17,7 @@ pandora.ui.embedInfo = function() {
data = result.data; data = result.data;
$icon = Ox.$('<img>') $icon = Ox.$('<img>')
.attr({src: '/' + item + '/poster512.jpg'}) .attr({src: pandora.getMediaURL('/' + item + '/poster512.jpg')})
.css({ .css({
position: 'absolute', position: 'absolute',
top: margin + 'px', top: margin + 'px',
@ -39,7 +39,7 @@ pandora.ui.embedInfo = function() {
.appendTo(that); .appendTo(that);
$reflectionIcon = Ox.$('<img>') $reflectionIcon = Ox.$('<img>')
.attr({src: '/' + item + '/poster512.jpg'}) .attr({src: pandora.getMediaURL('/' + item + '/poster512.jpg')})
.css({ .css({
position: 'absolute' position: 'absolute'
}) })

View file

@ -95,19 +95,19 @@ pandora.ui.embedPlayer = function() {
paused: options.paused, paused: options.paused,
playInToOut: options.playInToOut, playInToOut: options.playInToOut,
position: options.position, position: options.position,
poster: '/' + options.item + '/' + '96p' + ( poster: pandora.getMediaURL('/' + options.item + '/' + '96p' + (
options.position !== void 0 ? options.position options.position !== void 0 ? options.position
: options['in'] !== void 0 ? options['in'] : options['in'] !== void 0 ? options['in']
: video.posterFrame : video.posterFrame
) +'.jpg', ) +'.jpg'),
resolution: ui.videoResolution, resolution: ui.videoResolution,
scaleToFill: ui.videoScale == 'fill', scaleToFill: ui.videoScale == 'fill',
subtitles: video.subtitles, subtitles: video.subtitles,
timeline: options.playInToOut ? function(size, i) { timeline: options.playInToOut ? function(size, i) {
return '/' + options.item return pandora.getMediaURL('/' + options.item
+ '/timelineantialias' + '/timelineantialias'
+ size + 'p' + i + '.jpg' + size + 'p' + i + '.jpg');
} : '/' + options.item + '/' + 'timeline16p.png', } : pandora.getMediaURL('/' + options.item + '/' + 'timeline16p.png'),
/* /*
timeline: options.playInToOut ? getSmallTimelineURL() timeline: options.playInToOut ? getSmallTimelineURL()
: '/' + options.item + '/' + 'timeline16p.png', : '/' + options.item + '/' + 'timeline16p.png',
@ -173,7 +173,7 @@ pandora.ui.embedPlayer = function() {
disabled: isFrame, disabled: isFrame,
duration: video.duration, duration: video.duration,
getImageURL: function(type, i) { getImageURL: function(type, i) {
return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'; return pandora.getMediaURL('/' + ui.item + '/timeline' + type + '64p' + i + '.jpg');
}, },
position: options.position, position: options.position,
showInToOut: options.playInToOut && options['in'] < options.out, showInToOut: options.playInToOut && options['in'] < options.out,

View file

@ -51,17 +51,21 @@ pandora.ui.embedTimeline = function() {
duration: video.duration, duration: video.duration,
followPlayer: ui.followPlayer, followPlayer: ui.followPlayer,
getFrameURL: function(position) { getFrameURL: function(position) {
return '/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg'; return pandora.getMediaURL(
'/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg'
);
}, },
getLargeTimelineURL: function(type, i) { getLargeTimelineURL: function(type, i) {
return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'; return pandora.getMediaURL(
'/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'
);
}, },
height: sizes.innerHeight, height: sizes.innerHeight,
muted: ui.videoMuted, muted: ui.videoMuted,
paused: options.paused, paused: options.paused,
position: options.position, position: options.position,
resolution: Ox.min(pandora.site.video.resolutions), resolution: Ox.min(pandora.site.video.resolutions),
smallTimelineURL: '/' + ui.item + '/timeline16p.jpg', smallTimelineURL: pandora.getMediaURL('/' + ui.item + '/timeline16p.jpg'),
subtitles: video.subtitles, subtitles: video.subtitles,
timeline: ui.videoTimeline, timeline: ui.videoTimeline,
timelines: pandora.site.timelines, timelines: pandora.site.timelines,

View file

@ -135,10 +135,10 @@ pandora.ui.infoView = function(data) {
) : '' ) : ''
}) })
.attr({ .attr({
src: '/' + data.id + '/' + ( src: pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
) + '512.jpg?' + data.modified ) + '512.jpg?' + data.modified)
}) })
.css({ .css({
position: 'absolute', position: 'absolute',
@ -168,10 +168,10 @@ pandora.ui.infoView = function(data) {
$reflectionIcon = $('<img>') $reflectionIcon = $('<img>')
.attr({ .attr({
src: '/' + data.id + '/' + ( src: pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
) + '512.jpg?' + data.modified ) + '512.jpg?' + data.modified)
}) })
.css({ .css({
position: 'absolute', position: 'absolute',
@ -1004,7 +1004,7 @@ pandora.ui.infoView = function(data) {
var src; var src;
Ox.Request.clearCache(); Ox.Request.clearCache();
if (ui.icons == 'frames') { if (ui.icons == 'frames') {
src = '/' + data.id + '/icon512.jpg?' + Ox.uid(); src = pandora.getMediaURL('/' + data.id + '/icon512.jpg?' + Ox.uid());
$icon.attr({src: src}); $icon.attr({src: src});
$reflectionIcon.attr({src: src}); $reflectionIcon.attr({src: src});
if (pandora.$ui.videoPreview) { if (pandora.$ui.videoPreview) {
@ -1015,9 +1015,9 @@ pandora.ui.infoView = function(data) {
} }
if (!ui.showSitePosters) { if (!ui.showSitePosters) {
$browserImages.each(function() { $browserImages.each(function() {
$(this).attr({src: '/' + data.id + '/' + ( $(this).attr({src: pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ? 'poster' : 'icon' ui.icons == 'posters' ? 'poster' : 'icon'
) + '128.jpg?' + Ox.uid()}); ) + '128.jpg?' + Ox.uid())});
}); });
} }
if (ui.listSort[0].key == 'modified') { if (ui.listSort[0].key == 'modified') {
@ -1135,10 +1135,10 @@ pandora.ui.infoView = function(data) {
} }
that.reload = function() { that.reload = function() {
var src = src = '/' + data.id + '/' + ( var src = pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
) + '512.jpg?' + Ox.uid() ) + '512.jpg?' + Ox.uid())
$icon.attr({src: src}); $icon.attr({src: src});
$reflectionIcon.attr({src: src}); $reflectionIcon.attr({src: src});
iconSize = iconSize == 256 ? 512 : 256; iconSize = iconSize == 256 ? 512 : 256;

View file

@ -131,9 +131,9 @@ pandora.ui.infoView = function(data) {
element: '<img>' element: '<img>'
}) })
.attr({ .attr({
src: '/' + data.id + '/' + ( src: pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ? 'poster' : 'icon' ui.icons == 'posters' ? 'poster' : 'icon'
) + '512.jpg?' + data.modified ) + '512.jpg?' + data.modified)
}) })
.css({ .css({
position: 'absolute', position: 'absolute',
@ -163,10 +163,10 @@ pandora.ui.infoView = function(data) {
$reflectionIcon = $('<img>') $reflectionIcon = $('<img>')
.attr({ .attr({
src: '/' + data.id + '/' + ( src: pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
) + '512.jpg?' + data.modified ) + '512.jpg?' + data.modified)
}) })
.css({ .css({
position: 'absolute', position: 'absolute',
@ -492,7 +492,7 @@ pandora.ui.infoView = function(data) {
Ox.contains(['title', 'director', 'year'], key) Ox.contains(['title', 'director', 'year'], key)
&& ui.icons == 'posters' && ui.icons == 'posters'
) { ) {
src = '/' + data.id + '/poster512.jpg?' + Ox.uid(); src = pandora.getMediaURL('/' + data.id + '/poster512.jpg?' + Ox.uid());
$icon.attr({src: src}); $icon.attr({src: src});
$reflectionIcon.attr({src: src}); $reflectionIcon.attr({src: src});
} }
@ -1042,9 +1042,9 @@ pandora.ui.infoView = function(data) {
} }
that.reload = function() { that.reload = function() {
var src = src = '/' + data.id + '/' + ( var src = pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ? 'poster' : 'icon' ui.icons == 'posters' ? 'poster' : 'icon'
) + '512.jpg?' + Ox.uid(); ) + '512.jpg?' + Ox.uid());
$icon.attr({src: src}); $icon.attr({src: src});
$reflectionIcon.attr({src: src}); $reflectionIcon.attr({src: src});
iconSize = iconSize == 256 ? 512 : 256; iconSize = iconSize == 256 ? 512 : 256;

View file

@ -107,9 +107,9 @@ pandora.ui.infoView = function(data) {
).title + ' View' ).title + ' View'
}) })
.attr({ .attr({
src: '/' + data.id + '/' + ( src: pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ? 'poster' : 'icon' ui.icons == 'posters' ? 'poster' : 'icon'
) + '512.jpg?' + data.modified ) + '512.jpg?' + data.modified)
}) })
.css({ .css({
position: 'absolute', position: 'absolute',
@ -141,9 +141,9 @@ pandora.ui.infoView = function(data) {
$reflectionIcon = $('<img>') $reflectionIcon = $('<img>')
.attr({ .attr({
src: '/' + data.id + '/' + ( src: pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ? 'poster' : 'icon' ui.icons == 'posters' ? 'poster' : 'icon'
) + '512.jpg?' + data.modified ) + '512.jpg?' + data.modified)
}) })
.css({ .css({
position: 'absolute', position: 'absolute',
@ -767,9 +767,9 @@ pandora.ui.infoView = function(data) {
} }
that.reload = function() { that.reload = function() {
var src = src = '/' + data.id + '/' + ( var src = pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ? 'poster' : 'icon' ui.icons == 'posters' ? 'poster' : 'icon'
) + '512.jpg?' + Ox.uid(); ) + '512.jpg?' + Ox.uid());
$icon.attr({src: src}); $icon.attr({src: src});
$reflectionIcon.attr({src: src}); $reflectionIcon.attr({src: src});
iconSize = iconSize == 256 ? 512 : 256; iconSize = iconSize == 256 ? 512 : 256;

View file

@ -34,7 +34,9 @@ pandora.ui.itemClips = function(options) {
: a.value > b.value ? 1 : a.value > b.value ? 1
: 0; : 0;
}), }),
url = '/' + self.options.id + '/' + self.height + 'p' + clip['in'] + '.jpg', url = pandora.getMediaURL(
'/' + self.options.id + '/' + self.height + 'p' + clip['in'] + '.jpg'
),
$item = Ox.IconItem({ $item = Ox.IconItem({
find: pandora.user.ui.itemFind, find: pandora.user.ui.itemFind,
imageHeight: self.height, imageHeight: self.height,
@ -106,7 +108,9 @@ pandora.ui.itemClips = function(options) {
'in': partsAndPoints.points[0], 'in': partsAndPoints.points[0],
out: partsAndPoints.points[1], out: partsAndPoints.points[1],
playInToOut: true, playInToOut: true,
poster: '/' + self.options.id + '/' + self.height + 'p' + points[0] + '.jpg', poster: pandora.getMediaURL(
'/' + self.options.id + '/' + self.height + 'p' + points[0] + '.jpg'
),
rewind: true, rewind: true,
video: partsAndPoints.parts.map(function(i) { video: partsAndPoints.parts.map(function(i) {
return pandora.getVideoURL(self.options.id, Ox.min(pandora.site.video.resolutions), i + 1); return pandora.getVideoURL(self.options.id, Ox.min(pandora.site.video.resolutions), i + 1);

View file

@ -44,7 +44,7 @@ pandora.ui.list = function() {
//background: 'transparent' //background: 'transparent'
}); });
}).attr({ }).attr({
src: '/' + data.id + '/' + icon + '14.jpg?' + data.modified src: pandora.getMediaURL('/' + data.id + '/' + icon + '14.jpg?' + data.modified)
}); });
}, },
id: 'posterRatio', id: 'posterRatio',
@ -128,10 +128,10 @@ pandora.ui.list = function() {
item: function(data, sort, size) { item: function(data, sort, size) {
var ratio = ui.icons == 'posters' var ratio = ui.icons == 'posters'
? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1, ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1,
url = '/' + data.id + '/' + ( url = pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
) + size + '.jpg?' + data.modified, ) + size + '.jpg?' + data.modified),
format, info, sortKey = sort[0].key; format, info, sortKey = sort[0].key;
if (['title', 'director', 'random'].indexOf(sortKey) > -1) { if (['title', 'director', 'random'].indexOf(sortKey) > -1) {
info = data['year']; info = data['year'];
@ -185,10 +185,10 @@ pandora.ui.list = function() {
size = 128; size = 128;
var ratio = ui.icons == 'posters' var ratio = ui.icons == 'posters'
? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1, ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1,
url = '/' + data.id + '/' + ( url = pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
) + size + '.jpg?' + data.modified, ) + size + '.jpg?' + data.modified),
format, info, sortKey = sort[0].key; format, info, sortKey = sort[0].key;
if (['title', 'director'].indexOf(sortKey) > -1) { if (['title', 'director'].indexOf(sortKey) > -1) {
info = data['year']; info = data['year'];
@ -270,10 +270,10 @@ pandora.ui.list = function() {
isClipsQuery = !!clipsQuery.conditions.length, isClipsQuery = !!clipsQuery.conditions.length,
ratio = ui.icons == 'posters' ratio = ui.icons == 'posters'
? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1, ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1,
url = '/' + data.id + '/' + ( url = pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
) + size + '.jpg?' + data.modified, ) + size + '.jpg?' + data.modified),
format, info, sortKey = sort[0].key; format, info, sortKey = sort[0].key;
if (['title', 'director'].indexOf(sortKey) > -1) { if (['title', 'director'].indexOf(sortKey) > -1) {
info = data['year']; info = data['year'];
@ -323,7 +323,9 @@ pandora.ui.list = function() {
duration: data.duration, duration: data.duration,
find: isClipsQuery ? clipsQuery.conditions[0].value : '', find: isClipsQuery ? clipsQuery.conditions[0].value : '',
getImageURL: function(type, i) { getImageURL: function(type, i) {
return '/' + data.id + '/timeline' + type + '16p' + i + '.jpg'; return pandora.getMediaURL(
'/' + data.id + '/timeline' + type + '16p' + i + '.jpg'
);
}, },
position: ui.videoPoints[data.id] position: ui.videoPoints[data.id]
? ui.videoPoints[data.id].position : 0, ? ui.videoPoints[data.id].position : 0,

View file

@ -168,7 +168,7 @@ pandora.ui.listGeneralPanel = function(listData) {
tooltip: Ox._('Doubleclick to edit icon') tooltip: Ox._('Doubleclick to edit icon')
}) })
.attr({ .attr({
src: '/' + folderItem.toLowerCase() + '/' + encodeURIComponent(listData.id) + '/icon256.jpg?' + Ox.uid() src: pandora.getMediaURL('/' + folderItem.toLowerCase() + '/' + encodeURIComponent(listData.id) + '/icon256.jpg?' + Ox.uid())
}) })
.css({ .css({
position: 'absolute', position: 'absolute',
@ -358,7 +358,7 @@ pandora.ui.listIconPanel = function(listData) {
$iconPanel = Ox.Element(), $iconPanel = Ox.Element(),
$icon = $('<img>') $icon = $('<img>')
.attr({src: '/' + folderItem.toLowerCase() + '/' + encodeURIComponent(listData.id) + '/icon256.jpg?' + Ox.uid()}) .attr({src: pandora.getMediaURL('/' + folderItem.toLowerCase() + '/' + encodeURIComponent(listData.id) + '/icon256.jpg?' + Ox.uid())})
.css({position: 'absolute', borderRadius: '64px', margin: '16px'}) .css({position: 'absolute', borderRadius: '64px', margin: '16px'})
.appendTo($iconPanel), .appendTo($iconPanel),
@ -435,7 +435,7 @@ pandora.ui.listIconPanel = function(listData) {
id: data.id, id: data.id,
info: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key], info: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key],
title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''), title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''),
url: '/' + data.id + '/icon' + size + '.jpg?' + data.modified, url: pandora.getMediaURL('/' + data.id + '/icon' + size + '.jpg?' + data.modified),
width: size width: size
}; };
}, },
@ -544,12 +544,20 @@ pandora.ui.listIconPanel = function(listData) {
posterFrames: posterFrames posterFrames: posterFrames
}, function() { }, function() {
$icon.attr({ $icon.attr({
src: '/' + folderItem.toLowerCase() + '/' + encodeURIComponent(listData.id) + '/icon256.jpg?' + Ox.uid() src: pandora.getMediaURL('/' + folderItem.toLowerCase()
+ '/' + encodeURIComponent(listData.id) + '/icon256.jpg?' + Ox.uid()
)
}); });
pandora.$ui.folderList[listData.folder].$element pandora.$ui.folderList[listData.folder].$element
.find('img[src*="/' + encodeURIComponent(listData.id) + '/"]') .find('img[src*="'
+ pandora.getMediaURL('/' + encodeURIComponent(listData.id))
+ '/"]'
)
.attr({ .attr({
src: '/' + folderItem.toLowerCase() + '/' + encodeURIComponent(listData.id) + '/icon.jpg?' + Ox.uid() src: pandora.getMediaURL('/' + folderItem.toLowerCase()
+ '/' + encodeURIComponent(listData.id)
+ '/icon.jpg?' + Ox.uid()
)
}); });
pandora.$ui.info.updateListInfo(); pandora.$ui.info.updateListInfo();
}); });

View file

@ -27,7 +27,9 @@ pandora.ui.player = function(data) {
enableSubtitles: ui.videoSubtitles, enableSubtitles: ui.videoSubtitles,
find: ui.itemFind, find: ui.itemFind,
getLargeTimelineURL: function(type, i) { getLargeTimelineURL: function(type, i) {
return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'; return pandora.getMediaURL(
'/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'
);
}, },
height: pandora.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
'in': ui.videoPoints[ui.item]['in'], 'in': ui.videoPoints[ui.item]['in'],
@ -48,7 +50,7 @@ pandora.ui.player = function(data) {
showLayers: Ox.clone(ui.showLayers), showLayers: Ox.clone(ui.showLayers),
showUsers: pandora.site.annotations.showUsers, showUsers: pandora.site.annotations.showUsers,
showTimeline: ui.showTimeline, showTimeline: ui.showTimeline,
smallTimelineURL: '/' + ui.item + '/timeline16p.jpg', smallTimelineURL: pandora.getMediaURL('/' + ui.item + '/timeline16p.jpg'),
subtitles: data.subtitles, subtitles: data.subtitles,
timeline: ui.videoTimeline, timeline: ui.videoTimeline,
timelineTooltip: 'timeline <span class="OxBright">' + Ox.SYMBOLS.SHIFT + 'T</span>', timelineTooltip: 'timeline <span class="OxBright">' + Ox.SYMBOLS.SHIFT + 'T</span>',

View file

@ -79,17 +79,17 @@ pandora.ui.previewDialog = function() {
item.year ? ' ' + item.year : '' item.year ? ' ' + item.year : ''
); );
$image = $('<img>') $image = $('<img>')
.attr({src: '/' + item.id + '/' + ( .attr({src: pandora.getMediaURL('/' + item.id + '/' + (
pandora.user.ui.showSitePosters ? 'siteposter' : 'poster' pandora.user.ui.showSitePosters ? 'siteposter' : 'poster'
) + '128.jpg?' + item.modified}) ) + '128.jpg?' + item.modified)})
.css({width: size.width + 'px', height: size.height + 'px'}); .css({width: size.width + 'px', height: size.height + 'px'});
$('<img>') $('<img>')
.load(function() { .load(function() {
$image.attr({src: $(this).attr('src')}); $image.attr({src: $(this).attr('src')});
}) })
.attr({src: '/' + item.id + '/' + ( .attr({src: pandora.getMediaURL('/' + item.id + '/' + (
pandora.user.ui.showSitePosters ? 'siteposter' : 'poster' pandora.user.ui.showSitePosters ? 'siteposter' : 'poster'
) + '1024.jpg?' + item.modified}); ) + '1024.jpg?' + item.modified)});
that.options({ that.options({
content: $image, content: $image,
title: title, title: title,

View file

@ -352,7 +352,7 @@ pandora.ui.similarClipsDialog = function() {
id: data.id, id: data.id,
info: Ox.formatDuration(data['in'], 2) + '-' + Ox.formatDuration(data.out, 2), info: Ox.formatDuration(data['in'], 2) + '-' + Ox.formatDuration(data.out, 2),
title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''), title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''),
url: '/' + data.id.split('/')[0] + '/' + height + 'p' + data['in'] + '.jpg', url: pandora.getMediaURL('/' + data.id.split('/')[0] + '/' + height + 'p' + data['in'] + '.jpg'),
width: width width: width
}; };
} }

View file

@ -25,10 +25,14 @@ pandora.ui.timeline = function(data) {
duration: data.duration, duration: data.duration,
followPlayer: ui.followPlayer, followPlayer: ui.followPlayer,
getFrameURL: function(position) { getFrameURL: function(position) {
return '/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg'; return pandora.getMediaURL(
'/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg?' + data.modified
);
}, },
getLargeTimelineURL: function(type, i) { getLargeTimelineURL: function(type, i) {
return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'; return pandora.getMediaURL(
'/' + ui.item + '/timeline' + type + '64p' + i + '.jpg?' + data.modified
);
}, },
height: pandora.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
itemName: pandora.site.itemName, itemName: pandora.site.itemName,
@ -44,7 +48,9 @@ pandora.ui.timeline = function(data) {
showAnnotationsMap: ui.showAnnotationsMap, showAnnotationsMap: ui.showAnnotationsMap,
showLayers: Ox.clone(ui.showLayers), showLayers: Ox.clone(ui.showLayers),
showUsers: pandora.site.annotations.showUsers, showUsers: pandora.site.annotations.showUsers,
smallTimelineURL: '/' + ui.item + '/timeline16p.jpg', smallTimelineURL: pandora.getMediaURL(
'/' + ui.item + '/timeline16p.jpg?' + data.modified
),
timeline: ui.videoTimeline, timeline: ui.videoTimeline,
timelines: pandora.site.timelines, timelines: pandora.site.timelines,
video: data.video, video: data.video,

View file

@ -1241,7 +1241,9 @@ pandora.getLargeClipTimelineURL = function(item, inPoint, outPoint, type, callba
} }
}) })
.attr({ .attr({
src: '/' + item + '/timeline' + type + '64p' + index + '.jpg' src: pandora.getMediaURL(
'/' + item + '/timeline' + type + '64p' + index + '.jpg'
)
})[0]; })[0];
}, function() { }, function() {
callback(canvas.toDataURL()); callback(canvas.toDataURL());
@ -1455,7 +1457,9 @@ pandora.getSmallClipTimelineURL = function(item, inPoint, outPoint, type, callba
} }
}) })
.attr({ .attr({
src: '/' + item + '/timeline' + type + '16p' + index + '.jpg' src: pandora.getMediaURL(
'/' + item + '/timeline' + type + '16p' + index + '.jpg'
)
})[0]; })[0];
}, function() { }, function() {
callback(canvas.toDataURL()); callback(canvas.toDataURL());
@ -1646,6 +1650,10 @@ pandora.getStatusText = function(data) {
return parts.join(', '); return parts.join(', ');
}; };
pandora.getMediaURL = function(url) {
return pandora.site.site.mediaprefix + url;
};
pandora.getVideoURL = function(id, resolution, part) { pandora.getVideoURL = function(id, resolution, part) {
var prefix = pandora.site.site.videoprefix var prefix = pandora.site.site.videoprefix
.replace('{id}', id) .replace('{id}', id)

View file

@ -12,15 +12,15 @@ pandora.ui.videoPreview = function(data) {
resolution = resolutions.length resolution = resolutions.length
? Ox.min(resolutions) ? Ox.min(resolutions)
: Ox.max(pandora.site.video.resolutions); : Ox.max(pandora.site.video.resolutions);
return '/' + data.id + '/' + resolution + 'p' + ( return pandora.getMediaURL('/' + data.id + '/' + resolution + 'p' + (
Ox.isUndefined(position) ? '' : position Ox.isUndefined(position) ? '' : position
) + '.jpg'; ) + '.jpg');
}, },
frameRatio: data.frameRatio, frameRatio: data.frameRatio,
height: data.height, height: data.height,
position: data.position, position: data.position,
scaleToFill: true, scaleToFill: true,
timeline: '/' + data.id + '/timeline16p.jpg', timeline: pandora.getMediaURL('/' + data.id + '/timeline16p.jpg'),
videoTooltip: data.videoTooltip, videoTooltip: data.videoTooltip,
width: data.width width: data.width
}); });