This commit is contained in:
rolux 2012-02-17 09:14:58 +00:00
commit 9770eefcd4
6 changed files with 14 additions and 7 deletions

View file

@ -31,6 +31,7 @@
"canEditPlaces": {"staff": true, "admin": true}, "canEditPlaces": {"staff": true, "admin": true},
"canEditSitePages": {"staff": true, "admin": true}, "canEditSitePages": {"staff": true, "admin": true},
"canEditUsers": {"admin": true}, "canEditUsers": {"admin": true},
"canImportAnnotations": {"staff": true, "admin": true},
"canPlayClips": {"guest": 2, "member": 2, "friend": 4, "staff": 4, "admin": 4}, "canPlayClips": {"guest": 2, "member": 2, "friend": 4, "staff": 4, "admin": 4},
"canPlayVideo": {"guest": 1, "member": 1, "friend": 4, "staff": 4, "admin": 4}, "canPlayVideo": {"guest": 1, "member": 1, "friend": 4, "staff": 4, "admin": 4},
"canSeeDebugMenu": {"staff": true, "admin": true}, "canSeeDebugMenu": {"staff": true, "admin": true},

View file

@ -241,7 +241,7 @@ def frame(videoFile, frame, position, height=128, redo=False):
videoFile input videoFile input
frame output frame output
position as float in seconds position as float in seconds
width of frame height of frame
redo boolean to extract file even if it exists redo boolean to extract file even if it exists
''' '''
if exists(videoFile): if exists(videoFile):

View file

@ -850,7 +850,7 @@ class Item(models.Model):
''' '''
Video related functions Video related functions
''' '''
def frame(self, position, height=128): def frame(self, position, height=None):
offset = 0 offset = 0
streams = self.streams() streams = self.streams()
for stream in streams: for stream in streams:
@ -858,6 +858,9 @@ class Item(models.Model):
offset += stream.duration offset += stream.duration
else: else:
position = position - offset position = position - offset
if not height:
height = stream.resolution
else:
height = min(height, stream.resolution) height = min(height, stream.resolution)
path = os.path.join(settings.MEDIA_ROOT, stream.path(), path = os.path.join(settings.MEDIA_ROOT, stream.path(),
'frames', "%dp"%height, "%s.jpg"%position) 'frames', "%dp"%height, "%s.jpg"%position)

View file

@ -29,6 +29,7 @@
"canEditPlaces": {"staff": true, "admin": true}, "canEditPlaces": {"staff": true, "admin": true},
"canEditSitePages": {"staff": true, "admin": true}, "canEditSitePages": {"staff": true, "admin": true},
"canEditUsers": {"admin": true}, "canEditUsers": {"admin": true},
"canImportAnnotations": {"staff": true, "admin": true},
"canPlayClips": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, "canPlayClips": {"guest": 1, "member": 1, "staff": 4, "admin": 4},
"canPlayVideo": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, "canPlayVideo": {"guest": 1, "member": 1, "staff": 4, "admin": 4},
"canSeeDebugMenu": {"staff": true, "admin": true}, "canSeeDebugMenu": {"staff": true, "admin": true},
@ -564,7 +565,7 @@
"itemFind": {"conditions": [], "operator": "&"}, "itemFind": {"conditions": [], "operator": "&"},
"itemSort": [{"key": "position", "operator": "+"}], "itemSort": [{"key": "position", "operator": "+"}],
"itemView": "info", "itemView": "info",
"listColumns": ["title", "source", "project", "topics", "language", "duration"], "listColumns": ["title", "source", "project", "topic", "language", "duration"],
"listColumnWidth": {}, "listColumnWidth": {},
"listSelection": [], "listSelection": [],
"listSort": [{"key": "title", "operator": "+"}], "listSort": [{"key": "title", "operator": "+"}],

View file

@ -3,7 +3,8 @@
pandora.ui.item = function() { pandora.ui.item = function() {
var that = Ox.Element(); var that = Ox.Element(),
videoOptions;
pandora.api.get({ pandora.api.get({
id: pandora.user.ui.item, id: pandora.user.ui.item,
@ -42,7 +43,7 @@ pandora.ui.item = function() {
if (['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1) { if (['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1) {
// fixme: layers have value, subtitles has text? // fixme: layers have value, subtitles has text?
var videoOptions = pandora.getVideoOptions(result.data); videoOptions = pandora.getVideoOptions(result.data);
} }
if (!result.data.rendered && [ if (!result.data.rendered && [
@ -240,6 +241,7 @@ pandora.ui.item = function() {
cuts: result.data.cuts || [], cuts: result.data.cuts || [],
duration: result.data.duration, duration: result.data.duration,
enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= result.data.rightslevel, enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= result.data.rightslevel,
enableImport: pandora.site.capabilities.canImportAnnotations[pandora.user.level],
enableSubtitles: pandora.user.ui.videoSubtitles, enableSubtitles: pandora.user.ui.videoSubtitles,
find: pandora.user.ui.itemFind, find: pandora.user.ui.itemFind,
getFrameURL: function(position) { getFrameURL: function(position) {

View file

@ -794,7 +794,7 @@ pandora.getVideoOptions = function(data) {
pandora.site.video.resolutions.forEach(function(resolution) { pandora.site.video.resolutions.forEach(function(resolution) {
options.video[resolution] = Ox.range(data.parts).map(function(i) { options.video[resolution] = Ox.range(data.parts).map(function(i) {
var part = (i + 1), var part = (i + 1),
prefix = pandora.site.site.videoprefix.replace('PART', part); // fixme: '{part}' would be more consistent prefix = pandora.site.site.videoprefix.replace('{part}', part);
return prefix + '/' + (data.item || pandora.user.ui.item) + '/' return prefix + '/' + (data.item || pandora.user.ui.item) + '/'
+ resolution + 'p' + part + '.' + pandora.user.videoFormat; + resolution + 'p' + part + '.' + pandora.user.videoFormat;
}); });