示例#1
0
from webdav.Lockable import ResourceLockedError
from zope.event import notify
import Products
import os
import sys
import zLOG

#module constants
DEFAULT_SCHEMA = {
    # add NyMediaFile-specific properties here
}
DEFAULT_SCHEMA.update(NY_CONTENT_BASE_SCHEMA)

# If converters installed file must be video, otherwise must be flash video (flv)

ffmpeg_available = can_convert() and NyFSContainer.is_blobfile
if not ffmpeg_available:
    zLOG.LOG("NyMediaFile", zLOG.WARNING,
             "Video conversion will not be supported.")

FLV_HEADERS = ["application/x-flash-video", "video/x-flv", "video/flv"]
MP3_HEADERS = ["audio/mpeg"]

# this dictionary is updated at the end of the module
config = {
    'product':
    'NaayaContent',
    'module':
    'mediafile_item',
    'package_path':
    os.path.abspath(os.path.dirname(__file__)),
示例#2
0
    'keywords':     (0, '', ''),
    'sortorder':    (0, MUST_BE_POSITIV_INT, 'The Sort order field must contain a positive integer.'),
    'releasedate':  (0, MUST_BE_DATETIME, 'The Release date field must contain a valid date.'),
    'discussion':   (0, '', ''),
    'file':         (1, '', ''),
    'lang':         (0, '', ''),
    'subtitle':     (0, '', ''),
}
DEFAULT_SCHEMA = {
    # add NyMediaFile-specific properties here
}
DEFAULT_SCHEMA.update(NY_CONTENT_BASE_SCHEMA)

# If converters installed file must be video, otherwise must be flash video (flv)

ffmpeg_available = can_convert() and NyFSContainer.is_ext
if ffmpeg_available:
    PROPERTIES_OBJECT["file"] = (1, MUST_BE_VIDEOFILE, "The file must be a valid video file (e.g. .avi, .mpg, .mp4, etc.)")
else:
    zLOG.LOG("NyMediaFile", zLOG.WARNING,
             "Video conversion will not be supported.")
    PROPERTIES_OBJECT["file"] = (1, MUST_BE_FLVFILE, "The file must be a valid flash video file (.flv)")

FLV_HEADERS = ["application/x-flash-video", "video/x-flv"]

# this dictionary is updated at the end of the module
config = {
        'product': 'NaayaContent',
        'module': 'mediafile_item',
        'package_path': os.path.abspath(os.path.dirname(__file__)),
        'meta_type': 'Naaya Media File',
示例#3
0
PROPERTIES_OBJECT = {
    'id':           (0, '', ''),
    'title':        (1, MUST_BE_NONEMPTY, 'The Title field must have a value.'),
    'description':  (0, '', ''),
    'coverage':     (0, '', ''),
    'keywords':     (0, '', ''),
    'sortorder':    (0, MUST_BE_POSITIV_INT, 'The Sort order field must contain a positive integer.'),
    'releasedate':  (0, MUST_BE_DATETIME, 'The Release date field must contain a valid date.'),
    'discussion':   (0, '', ''),
    'file':         (1, '', ''),
    'lang':         (0, '', ''),
    'subtitle':     (0, '', ''),
}

# If converters installed file must be video, otherwise must be flash video (flv)
if can_convert() and NyFSContainer.is_ext:
    PROPERTIES_OBJECT["file"] = (1, MUST_BE_VIDEOFILE, "The file must be a valid video file (e.g. .avi, .mpg, .mp4, etc.)")
else:
    zLOG.LOG("NyMediaFile", zLOG.WARNING,
             "Video conversion will not be supported.")
    PROPERTIES_OBJECT["file"] = (1, MUST_BE_FLVFILE, "The file must be a valid flash video file (.flv)")

manage_addNyMediaFile_html = PageTemplateFile('zpt/mediafile_manage_add', globals())
manage_addNyMediaFile_html.kind = METATYPE_OBJECT
manage_addNyMediaFile_html.action = 'addNyMediaFile'

def mediafile_add_html(self, REQUEST=None, RESPONSE=None):
    """ """
    return self.getFormsTool().getContent({'here': self, 'kind': METATYPE_OBJECT, 'action': 'addNyMediaFile'}, 'mediafile_add')

def addNyMediaFile(self, id='', title='', description='', coverage='', keywords='',