示例#1
0
def configure_recording():
    """Configures freeseer to record via REST server.

    Gets recording profiles and configuration and instantiates recording plugins. Then it restores any stored talks.
    Runs upon first call to REST server.
    """
    recording.profile = settings.profile_manager.get()
    recording.config = recording.profile.get_config('freeseer.conf',
                                                    settings.FreeseerConfig,
                                                    storage_args=['Global'],
                                                    read_only=True)
    recording.plugin_manager = PluginManager(recording.profile)
    recording.storage_file = os.path.join(settings.configdir,
                                          app.storage_file_path)

    media_info = shelve.open(recording.storage_file, writeback=True)

    recording.next_id = 1
    recording.media_dict = {}
    for key, value in media_info.iteritems():
        new_media = Multimedia(recording.config, recording.plugin_manager)
        if value['null_multimeda']:
            new_media.current_state = Multimedia.NULL
        else:
            # if null_multimeda is False, a video exists, set current_state to Multimedia.STOP
            new_media.current_state = Multimedia.STOP

        media_id = int(key)
        if media_id >= recording.next_id:
            recording.next_id = media_id + 1

        if new_media.current_state == Multimedia.NULL:
            filename = value['filename'].split('.ogg')[0]
            success, filename = new_media.load_backend(None, filename)

            if not success:
                raise ServerError('Could not load multimedia backend')

            value['filename'] = filename

            value['filepath'] = new_media.plugman.get_plugin_by_name(
                new_media.config.record_to_file_plugin,
                "Output").plugin_object.location

        recording.media_dict[media_id] = new_media

    recording.media_info = media_info
    recording.media_info.sync()
示例#2
0
 def __init__(self, profile, db, config, cli=False):
     self.config = config
     self.db = db
     self.plugman = PluginManager(profile)
     self.media = Multimedia(self.config, self.plugman, cli=cli)
示例#3
0
 def setUp(self):
     settings.configdir = tempfile.mkdtemp()
     self.config = Config(settings.configdir)
     self.manager = PluginManager(settings.configdir)
     self.multimedia = Multimedia(self.config, self.manager)
示例#4
0
 def __init__(self, cli=False, profile=None):
     self.config = Config(settings.configdir, profile=profile)
     self.db = QtDBConnector(settings.configdir)
     self.plugman = PluginManager(settings.configdir, profile=profile)
     self.media = Multimedia(self.config, self.plugman, cli=cli)