Ejemplo n.º 1
0
 def post_creation(self, obj, pdb_if_exception=False):
     super(VideoType, self).post_creation(obj, pdb_if_exception)
     try:
         from castle.cms.media.video import process
         process(obj)
     except Exception:
         pass
Ejemplo n.º 2
0
def _file_edited(obj):
    try:
        if not obj.file:
            return _clean_aws(obj)
    except AttributeError:
        return
    if obj.portal_type == 'Video':
        video.process(obj)
        transaction.commit()

    if obj.portal_type not in ('Video', 'Audio', 'File'):
        return _clean_aws(obj)

    if 'pdf' in obj.file.contentType:
        # we also aren't moving pdfs out of here
        return _clean_aws(obj)

    registry = getUtility(IRegistry)
    if registry.get('castle.aws_s3_key', None) is None:
        return

    max_size_mb = registry.get('castle.max_file_size', 50)
    max_size = max_size_mb * 1024 * 1024
    if obj.file.getSize() > max_size:
        aws.move_file(obj)
    else:
        return _clean_aws(obj)
Ejemplo n.º 3
0
def _process_video(obj):
    video.process(obj)