add 'DRM'

This commit is contained in:
rolux 2011-10-22 21:03:28 +00:00
parent cca3b8b5b7
commit 96a0744309
5 changed files with 71 additions and 23 deletions

View file

@ -15,13 +15,12 @@
"capabilities": { "capabilities": {
"canDeleteItems": {"admin": true}, "canDeleteItems": {"admin": true},
"canEditItemIcons": {"staff": true, "admin": true}, "canEditItemIcons": {"staff": true, "admin": true},
"canPlayClips": {"guest": 1, "member": 2, "friend": 3, "staff": 4, "admin": 4}, "canPlayClips": {"guest": 2, "member": 2, "friend": 3, "staff": 4, "admin": 4},
"canPlayVideo": {"guest": 0, "member": 1, "friend": 3, "staff": 4, "admin": 4}, "canPlayVideo": {"guest": 1, "member": 1, "friend": 3, "staff": 4, "admin": 4},
"canReloadMetadata": {"staff": true, "admin": true}, "canReloadMetadata": {"staff": true, "admin": true},
"canSeeDebugMenu": {"admin": true}, "canSeeDebugMenu": {"admin": true},
"canSeeFiles": {"staff": true, "admin": true}, "canSeeFiles": {"staff": true, "admin": true},
"canSeeItem": {"guest": 2, "member": 2, "friend": 3, "staff": 4, "admin": 4}, "canSeeItem": {"guest": 3, "member": 3, "friend": 3, "staff": 4, "admin": 4},
"canSeeNotes": {"staff": true, "admin": true},
"canSeeExtraItemViews": {"friend": true, "staff": true, "admin": true} "canSeeExtraItemViews": {"friend": true, "staff": true, "admin": true}
}, },
/* /*
@ -528,11 +527,11 @@
], ],
"rightsLevel": {"member": 5, "staff": 4, "admin": 3}, "rightsLevel": {"member": 5, "staff": 4, "admin": 3},
"rightsLevels": [ "rightsLevels": [
{"name": "Public", "color": [0, 255, 0], "description": "Everyone can see and play."}, {"name": "Public", "color": [128, 255, 128], "description": "Everyone can see and play."},
{"name": "Relaxed", "color": [128, 255, 0], "description": "Guests can't play video."}, {"name": "Relaxed", "color": [192, 255, 128], "description": "Guests can't play video."},
{"name": "Regular", "color": [255, 255, 0], "description": "Guests can't play clips, members can't play video."}, {"name": "Regular", "color": [255, 255, 128], "description": "Guests can't play clips, members can't play video."},
{"name": "Restricted", "color": [255, 128, 0], "description": "Only staff and admin can see and play."}, {"name": "Restricted", "color": [255, 192, 128], "description": "Only friend, staff and admin can see and play."},
{"name": "Private", "color": [255, 0, 0], "description": "Only admins can see and play."} {"name": "Private", "color": [255, 128, 128], "description": "Only staff and admin can see and play."}
], ],
"sendReferrer": false, "sendReferrer": false,
"site": { "site": {

View file

@ -132,12 +132,15 @@ pandora.ui.clipList = function(videoRatio) {
width = fixedRatio > 1 ? size : Math.round(size * fixedRatio); width = fixedRatio > 1 ? size : Math.round(size * fixedRatio);
height = fixedRatio > 1 ? Math.round(size / fixedRatio) : size; height = fixedRatio > 1 ? Math.round(size / fixedRatio) : size;
} }
pandora.api.get({id: item, keys: ['durations']}, function(result) { pandora.api.get({id: item, keys: ['durations', 'rightsLevel']}, function(result) {
var points = [that.value(id, 'in'), that.value(id, 'out')], var points = [that.value(id, 'in'), that.value(id, 'out')],
partsAndPoints = pandora.getVideoPartsAndPoints( partsAndPoints = pandora.getVideoPartsAndPoints(
result.data.durations, points result.data.durations, points
), ),
$player = Ox.VideoPlayer({ $player = Ox.VideoPlayer({
censored: pandora.site.capabilities.canPlayClips[pandora.user.level] < result.data.rightsLevel
? [{'in': partsAndPoints.points[0], out: partsAndPoints.points[1]}]
: [],
height: height, height: height,
'in': partsAndPoints.points[0], 'in': partsAndPoints.points[0],
out: partsAndPoints.points[1], out: partsAndPoints.points[1],

View file

@ -359,6 +359,23 @@ pandora.ui.infoView = function(data) {
.appendTo($statistics); .appendTo($statistics);
}); });
var rightsLevel = pandora.site.rightsLevels[data['rightsLevel']];
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey('Rights Level', true))
.append(
$('<div>')
.css({
paddingLeft: '3px',
borderRadius: '4px',
backgroundColor: 'rgb(' + rightsLevel.color.map(function(value) {
return value - 128;
}).join(', ') + ')',
color: 'rgb(' + rightsLevel.color.join(', ') + ')'
})
.html(rightsLevel.name)
)
.appendTo($statistics);
if (canEditIcons) { if (canEditIcons) {
$icon.bindEvent({ $icon.bindEvent({

View file

@ -7,7 +7,7 @@ pandora.ui.item = function() {
pandora.api.get({ pandora.api.get({
id: pandora.user.ui.item, id: pandora.user.ui.item,
keys: ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 ? keys: ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 ?
[ 'cuts', 'duration', 'layers', 'parts', 'rendered', 'size', 'title', 'videoRatio'] : [] [ 'cuts', 'duration', 'layers', 'parts', 'rendered', 'rightsLevel', 'size', 'title', 'videoRatio'] : []
}, pandora.user.level == 'admin' && pandora.user.ui.itemView == 'info' ? 0 : -1, function(result) { }, pandora.user.level == 'admin' && pandora.user.ui.itemView == 'info' ? 0 : -1, function(result) {
if (result.status.code == 200) { if (result.status.code == 200) {
@ -27,6 +27,36 @@ pandora.ui.item = function() {
); );
}*/ }*/
if (['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1) {
var subtitles = result.data.layers.subtitles
? result.data.layers.subtitles.map(function(subtitle) {
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
})
: [],
canPlayClips = pandora.site.capabilities.canPlayClips[pandora.user.level] >= result.data.rightsLevel,
canPlayVideo = pandora.site.capabilities.canPlayVideo[pandora.user.level] >= result.data.rightsLevel,
censored = canPlayVideo ? []
: canPlayClips ? (
subtitles.length
? Ox.merge(
subtitles.map(function(subtitle, i) {
return {
'in': i == 0 ? 0 : subtitles[i - 1].out,
out: subtitle['in']
};
}),
[{'in': Ox.last(subtitles).out, out: result.data.duration}]
)
: Ox.range(0, result.data.duration - 5, 60).map(function(position) {
return {
'in': position + 5,
out: Math.max(position + 60, result.data.duration)
};
})
)
: [{'in': 0, out: result.data.duration}];
}
if (!result.data.rendered && [ if (!result.data.rendered && [
'clips', 'map', 'video', 'timeline' 'clips', 'map', 'video', 'timeline'
].indexOf(pandora.user.ui.itemView) > -1) { ].indexOf(pandora.user.ui.itemView) > -1) {
@ -120,6 +150,7 @@ pandora.ui.item = function() {
// //
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanelPlayer({ pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanelPlayer({
annotationsSize: pandora.user.ui.annotationsSize, annotationsSize: pandora.user.ui.annotationsSize,
censored: censored,
cuts: result.data.cuts || [], cuts: result.data.cuts || [],
duration: result.data.duration, duration: result.data.duration,
find: isClipsQuery ? clipsQuery.conditions[0].value : '', find: isClipsQuery ? clipsQuery.conditions[0].value : '',
@ -134,10 +165,7 @@ pandora.ui.item = function() {
scaleToFill: pandora.user.ui.videoScale == 'fill', scaleToFill: pandora.user.ui.videoScale == 'fill',
showAnnotations: pandora.user.ui.showAnnotations, showAnnotations: pandora.user.ui.showAnnotations,
showControls: pandora.user.ui.showControls, showControls: pandora.user.ui.showControls,
subtitles: result.data.layers.subtitles ? subtitles: subtitles,
result.data.layers.subtitles.map(function(subtitle) {
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
}) : [],
tooltips: true, tooltips: true,
timeline: '/' + pandora.user.ui.item + '/timeline16p.png', timeline: '/' + pandora.user.ui.item + '/timeline16p.png',
video: video, video: video,
@ -186,6 +214,7 @@ pandora.ui.item = function() {
}); });
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = Ox.VideoEditor({ pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = Ox.VideoEditor({
annotationsSize: pandora.user.ui.annotationsSize, annotationsSize: pandora.user.ui.annotationsSize,
censored: censored,
cuts: result.data.cuts || [], cuts: result.data.cuts || [],
duration: result.data.duration, duration: result.data.duration,
find: isClipsQuery ? clipsQuery.conditions[0].value : '', find: isClipsQuery ? clipsQuery.conditions[0].value : '',
@ -209,10 +238,7 @@ pandora.ui.item = function() {
showAnnotations: pandora.user.ui.showAnnotations, showAnnotations: pandora.user.ui.showAnnotations,
showLargeTimeline: true, showLargeTimeline: true,
// fixme: layers have value, subtitles has text? // fixme: layers have value, subtitles has text?
subtitles: result.data.layers.subtitles ? subtitles: subtitles,
result.data.layers.subtitles.map(function(subtitle) {
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
}) : [],
tooltips: true, tooltips: true,
video: video, video: video,
videoRatio: result.data.videoRatio, videoRatio: result.data.videoRatio,

View file

@ -75,11 +75,14 @@ pandora.ui.itemClips = function(options) {
$img = $item.find('.OxIcon > img'); $img = $item.find('.OxIcon > img');
points = [$item.data('in'), $item.data('out')]; points = [$item.data('in'), $item.data('out')];
if ($img.length) { if ($img.length) {
pandora.api.get({id: self.options.id, keys: ['durations']}, function(result) { pandora.api.get({id: self.options.id, keys: ['durations', 'rightsLevel']}, function(result) {
var partsAndPoints = pandora.getVideoPartsAndPoints( var partsAndPoints = pandora.getVideoPartsAndPoints(
result.data.durations, points result.data.durations, points
), ),
$player = Ox.VideoPlayer({ $player = Ox.VideoPlayer({
censored: pandora.site.capabilities.canPlayClips[pandora.user.level] < result.data.rightsLevel
? [{'in': partsAndPoints.points[0], out: partsAndPoints.points[1]}]
: [],
enableMouse: true, enableMouse: true,
height: self.height, height: self.height,
'in': partsAndPoints.points[0], 'in': partsAndPoints.points[0],