use direct download for private items. Torrents only work if item is public

This commit is contained in:
j 2013-11-18 09:52:44 +00:00
parent f82f2d8b07
commit d74a264a6a
3 changed files with 12 additions and 6 deletions

View file

@ -127,8 +127,8 @@ pandora.ui.editor = function(data) {
pandora.$ui[dialog] && pandora.$ui[dialog].remove(); pandora.$ui[dialog] && pandora.$ui[dialog].remove();
pandora.$ui[dialog] = pandora.ui[dialog](data).open(); pandora.$ui[dialog] = pandora.ui[dialog](data).open();
}, },
downloadvideo: function(data) { downloadvideo: function() {
document.location.href = pandora.getDownloadLink(ui.item); document.location.href = pandora.getDownloadLink(ui.item, data.rightslevel);
}, },
downloadselection: function(data) { downloadselection: function(data) {
document.location.href = '/' + ui.item document.location.href = '/' + ui.item

View file

@ -83,8 +83,8 @@ pandora.ui.player = function(data) {
return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out; return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out;
}), 'clip'); }), 'clip');
}, },
downloadvideo: function(data) { downloadvideo: function() {
document.location.href = pandora.getDownloadLink(ui.item); document.location.href = pandora.getDownloadLink(ui.item, data.rightslevel);
}, },
find: function(data) { find: function(data) {
pandora.UI.set({itemFind: data.find}); pandora.UI.set({itemFind: data.find});

View file

@ -928,8 +928,14 @@ pandora.getClipVideos = function(clip, resolution) {
}; };
}()); }());
pandora.getDownloadLink = function(item) { pandora.getDownloadLink = function(item, rightslevel) {
return '/' + item + (pandora.site.video.torrent ? '/torrent/' : '/download/'); console.log('pandora.getDownloadLink', item, rightslevel);
var torrent = pandora.site.video.torrent;
if (arguments.length == 2 && torrent &&
pandora.site.capabilities.canSeeItem.guest < rightslevel) {
torrent = false;
}
return '/' + item + (torrent ? '/torrent/' : '/download/');
} }
pandora.getEditTooltip = function(title) { pandora.getEditTooltip = function(title) {