Beispiel #1
0
 def populateThumbnail(self):
     '''
     Populates the thumbnail for audio.
     '''
     self.thumbnailManager.putThumbnail(
         self.defaultThumbnailFormatId(),
         abspath(join(pythonPath(), 'resources', 'audio.jpg')))
Beispiel #2
0
def deploy():
    if exiv2_dir_path():
        sys, rel, _ver, deployed = deployTool(join(pythonPath(), 'resources', 'exiv2'), exiv2_dir_path())
        if not deployed:
            log.error('Unable to deploy Exiv2 on %s %s!\n    You must install it manually '
                      'and set the proper path in the plugins.properties\n    file for the property '
                      'metadata_extractor_path (e.g. /usr/bin/exiv2).' % (sys, rel))
Beispiel #3
0
    def __init__(self):
        assert isinstance(self.command_transform, str), 'Invalid command transform %s' % self.command_transform
        assert isinstance(self.command_resize, str), 'Invalid command resize %s' % self.command_resize
        assert isinstance(self.avconv_dir_path, str), 'Invalid avconv directory %s' % self.avconv_dir_path
        assert isinstance(self.avconv_path, str), 'Invalid avconv path %s' % self.avconv_path

        if self.avconv_dir_path: synchronizeURIToDir(join(pythonPath(), 'resources', 'avconv'), self.avconv_dir_path)
Beispiel #4
0
def deploy():
    if gm_dir_path():
        sys, rel, _ver, deployed = deployTool(join(pythonPath(), 'resources', 'gm'), gm_dir_path())
        if not deployed:
            log.error('Unable to deploy GraphicsMagic on %s %s!\n    You must install it manually '
                      'and set the proper path in the plugins.properties\n    file for the property '
                      'gm_path (e.g. /usr/bin/gm).' % (sys, rel))
    def __init__(self):
        assert isinstance(self.command_transform, str), 'Invalid command transform %s' % self.command_transform
        assert isinstance(self.command_resize, str), 'Invalid command resize %s' % self.command_resize
        assert isinstance(self.avconv_dir_path, str), 'Invalid avconv directory %s' % self.avconv_dir_path
        assert isinstance(self.avconv_path, str), 'Invalid avconv path %s' % self.avconv_path

        if self.avconv_dir_path: synchronizeURIToDir(join(pythonPath(), 'resources', 'avconv'), self.avconv_dir_path)
Beispiel #6
0
def deploy():
    if ffmpeg_dir_path():
        sys, rel, _ver, deployed = deployTool(join(pythonPath(), 'resources', 'ffmpeg'), ffmpeg_dir_path())
        if not deployed:
            log.error('Unable to deploy FFMpeg on %s %s!\n    You must install it manually '
                      'and set the proper path in the plugins.properties\n    file for the property '
                      'ffmpeg_path (e.g. /usr/bin/ffmpeg).' % (sys, rel))
Beispiel #7
0
def deploy():
    if ffmpeg_dir_path():
        sys, rel, _ver, deployed = deployTool(
            join(pythonPath(), 'resources', 'ffmpeg'), ffmpeg_dir_path())
        if not deployed:
            log.error(
                'Unable to deploy FFMpeg on %s %s!\n    You must install it manually '
                'and set the proper path in the plugins.properties\n    file for the property '
                'ffmpeg_path (e.g. /usr/bin/ffmpeg).' % (sys, rel))
Beispiel #8
0
def deploy():
    if exiv2_dir_path():
        sys, rel, _ver, deployed = deployTool(
            join(pythonPath(), 'resources', 'exiv2'), exiv2_dir_path())
        if not deployed:
            log.error(
                'Unable to deploy Exiv2 on %s %s!\n    You must install it manually '
                'and set the proper path in the plugins.properties\n    file for the property '
                'metadata_extractor_path (e.g. /usr/bin/exiv2).' % (sys, rel))
Beispiel #9
0
 def deploy(self):
     '''
     Deploy the meta data and all handlers.
     '''
     self._metaType = metaTypeFor(self.session(), META_TYPE_KEY)
     self._thumbnail = thumbnailFor(self.session(), '%(size)s/other.jpg')
     referenceLast = self.thumbnailReferencer.timestampThumbnail(self._thumbnail.id)
     imagePath = join(pythonPath(), 'resources', 'other.jpg')
     if referenceLast is None or referenceLast < timestampURI(imagePath):
         self.thumbnailReferencer.processThumbnail(openURI(imagePath), self._thumbnail.id)
Beispiel #10
0
def configureMongrel2():
    if not options.isFlag(FLAG_CONFIG_MONGREL2): return
    folders = [path.join('mongrel2', name) for name in ('logs', 'run', 'tmp')]
    folders.append(path.join('shared', 'upload'))

    folder = options.mongrel2Folder or 'workspace'

    for name in folders:
        folder = path.join(folder, name)
        if not path.isdir(folder): makedirs(folder)

    updateConfig = False
    if server_type() != 'mongrel2':
        updateConfig = True
        support.persist(server_type, 'mongrel2')

    sendIdent = send_ident()
    if sendIdent is None:
        updateConfig = True
        sendIdent = str(uuid4())
        support.persist(send_ident, sendIdent)

    replace = {}
    replace['${send_spec}'] = send_spec()
    replace['${send_ident}'] = sendIdent
    replace['${recv_spec}'] = recv_spec()
    replace['${recv_ident}'] = recv_ident()
    replace['${server_port}'] = str(server_port())

    if updateConfig: saveConfigurations(context.configurationsExtract())

    conf = openURI(path.join(pythonPath(), 'resources', 'ally.conf'))
    conf = codecs.getreader('utf8')(conf)
    conf = ReplaceInStream(conf, replace)
    with open(path.join(folder, 'ally.conf'), 'w') as f:
        pipe(conf, f)
    with open(path.join(folder, 'README-Mongrel2.txt'), 'wb') as f:
        pipe(
            openURI(path.join(pythonPath(), 'resources',
                              'README-Mongrel2.txt')), f)

    log.info('Configured \'%s\' mongrel2 workspace' % folder)
Beispiel #11
0
    def deploy(self):
        '''
        Deploy the meta data and all handlers.
        '''
        self._thumbnailFormat = thumbnailFormatFor(self.session(), self.format_thumbnail)
        self.thumbnailManager.putThumbnail(self._thumbnailFormat.id, abspath(join(pythonPath(), 'resources', 'other.jpg')))
        self._metaType = metaTypeFor(self.session(), META_TYPE_KEY)

        for handler in self.metaDataHandlers:
            assert isinstance(handler, IMetaDataHandler), 'Invalid meta data handler %s' % handler
            handler.deploy()
Beispiel #12
0
def configureMongrel2():
    if not options.isFlag(FLAG_CONFIG_MONGREL2): return
    folders = [path.join('mongrel2', name) for name in ('logs', 'run', 'tmp')]
    folders.append(path.join('shared', 'upload'))

    folder = options.mongrel2Folder or 'workspace'
    
    for name in folders:
        folder = path.join(folder, name)
        if not path.isdir(folder): makedirs(folder)
    
    updateConfig = False
    if server_type() != 'mongrel2':
        updateConfig = True
        support.persist(server_type, 'mongrel2')
    
    sendIdent = send_ident()
    if sendIdent is None:
        updateConfig = True
        sendIdent = str(uuid4())
        support.persist(send_ident, sendIdent)
    
    replace = {}
    replace['${send_spec}'] = send_spec()
    replace['${send_ident}'] = sendIdent
    replace['${recv_spec}'] = recv_spec()
    replace['${recv_ident}'] = recv_ident()
    replace['${server_port}'] = str(server_port())

    if updateConfig: saveConfigurations(context.configurationsExtract())
        
    conf = openURI(path.join(pythonPath(), 'resources', 'ally.conf'))
    conf = codecs.getreader('utf8')(conf)
    conf = ReplaceInStream(conf, replace)
    with open(path.join(folder, 'ally.conf'), 'w') as f: pipe(conf, f)
    with open(path.join(folder, 'README-Mongrel2.txt'), 'wb') as f:
        pipe(openURI(path.join(pythonPath(), 'resources', 'README-Mongrel2.txt')), f)
    
    log.info('Configured \'%s\' mongrel2 workspace' % folder)
Beispiel #13
0
    def deploy(self):
        '''
        @see: IMetaDataHandler.deploy
        '''

        self._defaultThumbnailFormat = thumbnailFormatFor(
            self.session(), self.default_format_thumbnail)
        self.thumbnailManager.putThumbnail(
            self._defaultThumbnailFormat.id,
            abspath(join(pythonPath(), 'resources', 'video.jpg')))

        self._thumbnailFormat = thumbnailFormatFor(self.session(),
                                                   self.format_thumbnail)
        self._metaTypeId = metaTypeFor(self.session(), META_TYPE_KEY).Id
Beispiel #14
0
    def deploy(self):
        '''
        Deploy the meta data and all handlers.
        '''
        self._thumbnailFormat = thumbnailFormatFor(self.session(),
                                                   self.format_thumbnail)
        self.thumbnailManager.putThumbnail(
            self._thumbnailFormat.id,
            abspath(join(pythonPath(), 'resources', 'other.jpg')))
        self._metaType = metaTypeFor(self.session(), META_TYPE_KEY)

        for handler in self.metaDataHandlers:
            assert isinstance(
                handler,
                IMetaDataHandler), 'Invalid meta data handler %s' % handler
            handler.deploy()
Beispiel #15
0
def deploy():
    if exiv2_dir_path(): deployTool(join(pythonPath(), 'resources', 'exiv2'), exiv2_dir_path())
Beispiel #16
0
def config():
    assert isinstance(application.options, OptionsMongrel2), 'Invalid application options %s' % application.options
    if not application.options.configMongrel2: return
    workspace = application.options.configMongrel2
    folders = [path.join('mongrel2', name) for name in ('logs', 'run', 'tmp')]
    folders.append(path.join('shared', 'upload'))

    for name in folders:
        folder = path.join(workspace, name)
        if not path.isdir(folder): makedirs(folder)
    
    configFile = application.options.configurationPath
    if path.isfile(configFile):
        with open(configFile, 'r') as f: config = load(f)
    else:
        print('The configuration file "%s" doesn\'t exist, create one by running the the application '
              'with "-dump" option, also change the application properties "server_type" configuration to "mongrel2" '
              'and also adjust the "recv_spec", "send_spec" and "server_port" accordingly' % configFile, file=sys.stderr)
        sys.exit(1)
        
    try:
        context.open(aop.modulesIn('__setup__.**'), config=config)
    
        updateConfig = False
        if server_type() != 'mongrel2':
            updateConfig = True
            support.persist(server_type, 'mongrel2')
        
        sendIdent = send_ident()
        if sendIdent is None:
            updateConfig = True
            sendIdent = str(uuid4())
            support.persist(send_ident, sendIdent)
        
        replace = {}
        try:
            replace['${send_spec}'] = send_spec()
            replace['${send_ident}'] = sendIdent
            replace['${recv_spec}'] = recv_spec()
            replace['${recv_ident}'] = recv_ident()
            replace['${server_port}'] = str(server_port())
        
            if updateConfig:
                if path.isfile(configFile): renames(configFile, configFile + '.bak')
                with open(configFile, 'w') as f: save(context.configurations(force=True), f)
                print('Updated the "%s" configuration file' % configFile)
        finally: context.deactivate()
    except SystemExit: raise
    except:
        print('-' * 150, file=sys.stderr)
        print('A problem occurred while configuring Mongrel2', file=sys.stderr)
        traceback.print_exc(file=sys.stderr)
        print('-' * 150, file=sys.stderr)
    else:
        conf = openURI(path.join(pythonPath(), 'resources', 'ally.conf'))
        conf = codecs.getreader('utf8')(conf)
        conf = ReplaceInFile(conf, replace)
        with open(path.join(workspace, 'ally.conf'), 'w') as f: pipe(conf, f)
        with open(path.join(workspace, 'README-Mongrel2.txt'), 'wb') as f:
            pipe(openURI(path.join(pythonPath(), 'resources', 'README-Mongrel2.txt')), f)
        
        print('Configured "%s" mongrel2 workspace' % workspace)
Beispiel #17
0
def deploy():
    if ffmpeg_dir_path():
        deployTool(join(pythonPath(), 'resources', 'ffmpeg'),
                   ffmpeg_dir_path())
 def deploy(self):
     '''
     @see: IMetaDataHandler.deploy
     '''
     
     self._defaultThumbnailFormat = thumbnailFormatFor(self.session(), self.default_format_thumbnail)
     self.thumbnailManager.putThumbnail(self._defaultThumbnailFormat.id, abspath(join(pythonPath(), 'resources', 'video.jpg')))
     
     self._thumbnailFormat = thumbnailFormatFor(self.session(), self.format_thumbnail)
     self._metaTypeId = metaTypeFor(self.session(), META_TYPE_KEY).Id
Beispiel #19
0
def deploy():
    if exiv2_dir_path():
        deployTool(join(pythonPath(), 'resources', 'exiv2'), exiv2_dir_path())
Beispiel #20
0
def deploy():
    if gm_dir_path(): deployTool(join(pythonPath(), 'resources', 'gm'), gm_dir_path())
Beispiel #21
0
 def populateThumbnail(self):
     '''
     Populates the thumbnail for videos.
     '''
     self.thumbnailManager.putThumbnail(self.defaultThumbnailFormatId(),
                                        abspath(join(pythonPath(), 'resources', 'video.jpg')))
Beispiel #22
0
def config():
    assert isinstance(application.options, OptionsMongrel2), 'Invalid application options %s' % application.options
    if not application.options.configMongrel2: return
    workspace = application.options.configMongrel2
    folders = [path.join('mongrel2', name) for name in ('logs', 'run', 'tmp')]
    folders.append(path.join('shared', 'upload'))

    for name in folders:
        folder = path.join(workspace, name)
        if not path.isdir(folder): makedirs(folder)
    
    configFile = application.options.configurationPath
    if path.isfile(configFile):
        with open(configFile, 'r') as f: config = load(f)
    else:
        print('The configuration file "%s" doesn\'t exist, create one by running the the application '
              'with "-dump" option, also change the application properties "server_type" configuration to "mongrel2" '
              'and also adjust the "recv_spec", "send_spec" and "server_port" accordingly' % configFile, file=sys.stderr)
        sys.exit(1)
        
    try:
        context.open(aop.modulesIn('__setup__.**'), config=config)
    
        updateConfig = False
        if server_type() != 'mongrel2':
            updateConfig = True
            support.persist(server_type, 'mongrel2')
        
        sendIdent = send_ident()
        if sendIdent is None:
            updateConfig = True
            sendIdent = str(uuid4())
            support.persist(send_ident, sendIdent)
        
        replace = {}
        try:
            replace['${send_spec}'] = send_spec()
            replace['${send_ident}'] = sendIdent
            replace['${recv_spec}'] = recv_spec()
            replace['${recv_ident}'] = recv_ident()
            replace['${server_port}'] = str(server_port())
        
            if updateConfig:
                if path.isfile(configFile): renames(configFile, configFile + '.bak')
                with open(configFile, 'w') as f: save(context.configurations(force=True), f)
                print('Updated the "%s" configuration file' % configFile)
        finally: context.deactivate()
    except SystemExit: raise
    except:
        print('-' * 150, file=sys.stderr)
        print('A problem occurred while configuring Mongrel2', file=sys.stderr)
        traceback.print_exc(file=sys.stderr)
        print('-' * 150, file=sys.stderr)
    else:
        conf = openURI(path.join(pythonPath(), 'resources', 'ally.conf'))
        conf = codecs.getreader('utf8')(conf)
        conf = ReplaceInFile(conf, replace)
        with open(path.join(workspace, 'ally.conf'), 'w') as f: pipe(conf, f)
        with open(path.join(workspace, 'README-Mongrel2.txt'), 'wb') as f:
            pipe(openURI(path.join(pythonPath(), 'resources', 'README-Mongrel2.txt')), f)
        
        print('Configured "%s" mongrel2 workspace' % workspace)
Beispiel #23
0
def deploy():
    if ffmpeg_dir_path(): deployTool(join(pythonPath(), 'resources', 'ffmpeg'), ffmpeg_dir_path())
Beispiel #24
0
 def doPopulate(self):
     '''
     @see: IPopulator.doPopulate
     '''
     self.thumbnailManager.putThumbnail(self.thumbnailFormatId(),
                                        abspath(join(pythonPath(), 'resources', 'other.jpg')))