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},
"canEditSitePages": {"staff": true, "admin": true},
"canEditUsers": {"admin": true},
"canImportAnnotations": {"staff": true, "admin": true},
"canPlayClips": {"guest": 2, "member": 2, "friend": 4, "staff": 4, "admin": 4},
"canPlayVideo": {"guest": 1, "member": 1, "friend": 4, "staff": 4, "admin": 4},
"canSeeDebugMenu": {"staff": true, "admin": true},

View file

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

View file

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

View file

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

View file

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

View file

@ -794,7 +794,7 @@ pandora.getVideoOptions = function(data) {
pandora.site.video.resolutions.forEach(function(resolution) {
options.video[resolution] = Ox.range(data.parts).map(function(i) {
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) + '/'
+ resolution + 'p' + part + '.' + pandora.user.videoFormat;
});