Beispiel #1
0
def create_recording():
    """Initializes a recording and returns its id."""
    if validate.validate_create_recording_request_form(request.form):
        new_filename = request.form['filename']
        new_media = Multimedia(recording.record_config, recording.record_plugin_manager)
        success, filename = new_media.load_backend(None, new_filename)

        if success:
            filepath = new_media.plugman.get_plugin_by_name(new_media.config.record_to_file_plugin, "Output").plugin_object.location
            new_recording_id = recording.next_id
            recording.next_id = recording.next_id + 1

            if new_recording_id not in recording.media_dict:
                recording.media_dict[new_recording_id] = {
                    'media': new_media,
                    'filename': filename,
                    'filepath': filepath
                }

                return {'id': new_recording_id}
            else:
                raise HTTPError('Provided id already in use', 500)
        else:
            raise HTTPError('Could not load multimedia backend', 500)
    else:
        raise HTTPError('Form data was invalid', 400)
Beispiel #2
0
def create_recording():
    response = ''

    if validate.validate_create_recording_request_form(request.form):
        new_filename = request.form['filename']
        new_media = Multimedia(current_app.record_config, current_app.record_plugin_manager)
        success, filename = new_media.load_backend(None, new_filename)

        if success:
            filepath = new_media.plugman.get_plugin_by_name(new_media.config.record_to_file_plugin, "Output").plugin_object.location

            new_recording_id = current_app.next_id
            current_app.next_id = current_app.next_id + 1

            if new_recording_id not in current_app.media_dict:
                current_app.media_dict[new_recording_id] = {
                    'media': new_media,
                    'filename': filename,
                    'filepath': filepath
                }

                response = jsonify({'id': new_recording_id})
                response.status_code = 201
            else:
                raise HTTPError('Provided id already in use', 500)
        else:
            raise HTTPError('Could not load multimedia backend', 500)
    else:
        raise HTTPError('Form data was invalid', 400)

    return response
Beispiel #3
0
def create_recording():
    """Initializes a recording and returns its id."""

    validate.validate_form(request.form,
                           recording.form_schema['create_recording'])

    new_filename = request.form['filename']
    new_media = Multimedia(recording.config, recording.plugin_manager)
    success, filename = new_media.load_backend(None, new_filename)

    if not success:
        raise HTTPError(500, 'Could not load multimedia backend')

    filepath = new_media.plugman.get_plugin_by_name(
        new_media.config.record_to_file_plugin,
        "Output").plugin_object.location
    new_recording_id = recording.next_id
    key = str(new_recording_id)

    recording.media_dict[new_recording_id] = new_media
    recording.media_info[key] = {
        'filename': filename,
        'filepath': filepath,
        'null_multimeda': True,
    }
    recording.next_id = recording.next_id + 1
    recording.media_info.sync()

    return {'id': new_recording_id}
Beispiel #4
0
def create_recording():
    """Initializes a recording and returns its id."""
    if validate.validate_create_recording_request_form(request.form):
        new_filename = request.form['filename']
        new_media = Multimedia(recording.record_config,
                               recording.record_plugin_manager)
        success, filename = new_media.load_backend(None, new_filename)

        if success:
            filepath = new_media.plugman.get_plugin_by_name(
                new_media.config.record_to_file_plugin,
                "Output").plugin_object.location
            new_recording_id = recording.next_id
            recording.next_id = recording.next_id + 1

            if new_recording_id not in recording.media_dict:
                recording.media_dict[new_recording_id] = {
                    'media': new_media,
                    'filename': filename,
                    'filepath': filepath
                }

                return {'id': new_recording_id}
            else:
                raise HTTPError('Provided id already in use', 500)
        else:
            raise HTTPError('Could not load multimedia backend', 500)
    else:
        raise HTTPError('Form data was invalid', 400)
Beispiel #5
0
def create_recording():
    """Initializes a recording and returns its id."""

    if not validate.validate_create_recording_request_form(request.form):
        raise HTTPError('Form data was invalid', 400)

    new_filename = request.form['filename']
    new_media = Multimedia(recording.config, recording.plugin_manager)
    success, filename = new_media.load_backend(None, new_filename)

    if not success:
        raise HTTPError('Could not load multimedia backend', 500)

    filepath = new_media.plugman.get_plugin_by_name(new_media.config.record_to_file_plugin, "Output").plugin_object.location
    new_recording_id = recording.next_id
    key = str(new_recording_id)

    recording.media_dict[new_recording_id] = new_media
    recording.media_info[key] = {
        'filename': filename,
        'filepath': filepath,
        'null_multimeda': True,
    }
    recording.next_id = recording.next_id + 1
    recording.media_info.sync()

    return {'id': new_recording_id}
Beispiel #6
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.
    """
    # setup the application so it exits gracefully
    signal.signal(signal.SIGINT, teardown_recording)
    recording.record_profile = settings.profile_manager.get()
    recording.record_config = recording.record_profile.get_config(
        'freeseer.conf',
        settings.FreeseerConfig,
        storage_args=['Global'],
        read_only=True)
    recording.record_plugin_manager = PluginManager(recording.record_profile)
    recording.storage_file = os.path.join(settings.configdir,
                                          app.storage_file_path)
    recording.next_id = 1

    # restore talks from storage
    if os.path.isfile(recording.storage_file):
        with open(recording.storage_file) as fd:
            persistent = json.loads(fd.read())

        recording.media_dict = {}
        for key in persistent:
            new_media = Multimedia(recording.record_config,
                                   recording.record_plugin_manager)
            new_media.current_state = persistent[key]['status']
            media_id = int(key)

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

                if success:
                    filepath = new_media.plugman.get_plugin_by_name(
                        new_media.config.record_to_file_plugin,
                        "Output").plugin_object.location
                    recording.media_dict[media_id] = {
                        'media': new_media,
                        'filename': filename,
                        'filepath': filepath
                    }
                else:
                    raise ServerError('Could not load multimedia backend')
            else:
                recording.media_dict[media_id] = {
                    'media': new_media,
                    'filename': persistent[key]['filename'],
                    'filepath': persistent[key]['filepath']
                }

        # sets next_id to last index of persistent + 1
        recording.next_id = len(persistent)
    else:
        # if no talks to restore, make empty media_dict, set next_id to 1
        recording.media_dict = {}
        recording.next_id = 1
Beispiel #7
0
 def setUp(self):
     self.profile_manager = ProfileManager(tempfile.mkdtemp())
     profile = self.profile_manager.get('testing')
     config = profile.get_config('freeseer.conf',
                                 settings.FreeseerConfig, ['Global'],
                                 read_only=True)
     plugin_manager = PluginManager(profile)
     self.multimedia = Multimedia(config, plugin_manager)
Beispiel #8
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.
    """
    # setup the application so it exits gracefully
    signal.signal(signal.SIGINT, teardown_recording)
    recording.record_profile = settings.profile_manager.get()
    recording.record_config = recording.record_profile.get_config('freeseer.conf', settings.FreeseerConfig,
                                                                  storage_args=['Global'], read_only=True)
    recording.record_plugin_manager = PluginManager(recording.record_profile)
    recording.storage_file = os.path.join(settings.configdir, app.storage_file_path)
    recording.next_id = 1

    # restore talks from storage
    if os.path.isfile(recording.storage_file):
        with open(recording.storage_file) as fd:
            persistent = json.loads(fd.read())

        recording.media_dict = {}
        for key in persistent:
            new_media = Multimedia(recording.record_config, recording.record_plugin_manager)
            new_media.current_state = persistent[key]['status']
            media_id = int(key)

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

                if success:
                    filepath = new_media.plugman.get_plugin_by_name(new_media.config.record_to_file_plugin, "Output").plugin_object.location
                    recording.media_dict[media_id] = {
                        'media': new_media,
                        'filename': filename,
                        'filepath': filepath
                    }
                else:
                    raise ServerError('Could not load multimedia backend')
            else:
                recording.media_dict[media_id] = {
                    'media': new_media,
                    'filename': persistent[key]['filename'],
                    'filepath': persistent[key]['filepath']
                }

        # sets next_id to last index of persistent + 1
        recording.next_id = len(persistent)
    else:
        # if no talks to restore, make empty media_dict, set next_id to 1
        recording.media_dict = {}
        recording.next_id = 1
Beispiel #9
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()
Beispiel #10
0
 def setUp(self):
     self.profile_manager = ProfileManager(tempfile.mkdtemp())
     self.temp_video_dir = tempfile.mkdtemp()
     profile = self.profile_manager.get('testing')
     config = profile.get_config('freeseer.conf', settings.FreeseerConfig, ['Global'], read_only=True)
     config.videodir = self.temp_video_dir
     plugin_manager = PluginManager(profile)
     self.multimedia = Multimedia(config, plugin_manager)
Beispiel #11
0
class TestMultimedia(unittest.TestCase):
    def setUp(self):
        settings.configdir = tempfile.mkdtemp()
        self.config = Config(settings.configdir)
        self.manager = PluginManager(settings.configdir)
        self.multimedia = Multimedia(self.config, self.manager)

    def tearDown(self):
        shutil.rmtree(settings.configdir)

    def test_load_backend(self):
        self.multimedia.load_backend(filename=u"test.ogg")

    def test_record_functions(self):
        self.multimedia.load_backend(filename=u"test.ogg")
        self.multimedia.record()
        self.multimedia.pause()
        self.multimedia.stop()
Beispiel #12
0
class TestMultimedia(unittest.TestCase):

    def setUp(self):
        settings.configdir = tempfile.mkdtemp()
        self.config = Config(settings.configdir)
        self.manager = PluginManager(settings.configdir)
        self.multimedia = Multimedia(self.config, self.manager)

    def tearDown(self):
        shutil.rmtree(settings.configdir)

    def test_load_backend(self):
        self.multimedia.load_backend(filename=u"test.ogg")

    def test_record_functions(self):
        self.multimedia.load_backend(filename=u"test.ogg")
        self.multimedia.record()
        self.multimedia.pause()
        self.multimedia.stop()
Beispiel #13
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()
Beispiel #14
0
def configure(storage_file):
    app.record_profile = settings.profile_manager.get()
    app.record_config = app.record_profile.get_config('freeseer.conf', settings.FreeseerConfig, ['Global'], read_only=True)
    app.record_plugin_manager = PluginManager(app.record_profile)
    app.storage_file = os.path.join(settings.configdir, storage_file)
    app.next_id = 1

    # restore talks from storage
    if os.path.isfile(app.storage_file):
        with open(app.storage_file) as fd:
            persistant = json.loads(fd.read())

        app.media_dict = {}
        for key in persistant:
            new_media = Multimedia(app.record_config, app.record_plugin_manager)
            new_media.current_state = persistant[key]['status']
            int_key = int(key)

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

                if success:
                    filepath = new_media.plugman.get_plugin_by_name(new_media.config.record_to_file_plugin, "Output").plugin_object.location
                    app.media_dict[int_key] = {
                        'media': new_media,
                        'filename': filename,
                        'filepath': filepath
                    }
                else:
                    raise ServerError('Could not load multimedia backend')
            else:
                app.media_dict[int_key] = {
                    'media': new_media,
                    'filename': persistant[key]['filename'],
                    'filepath': persistant[key]['filepath']
                }

            if int_key >= app.next_id:
                app.next_id = int_key + 1
    else:
        app.media_dict = {}
Beispiel #15
0
class TestMultimedia(unittest.TestCase):

    def setUp(self):
        self.profile_manager = ProfileManager(tempfile.mkdtemp())
        profile = self.profile_manager.get('testing')
        config = profile.get_config('freeseer.conf', settings.FreeseerConfig, ['Global'], read_only=True)
        plugin_manager = PluginManager(profile)
        self.multimedia = Multimedia(config, plugin_manager)

    def tearDown(self):
        shutil.rmtree(self.profile_manager._base_folder)

    def test_load_backend(self):
        self.multimedia.load_backend(filename=u"test.ogg")

    def test_record_functions(self):
        self.multimedia.load_backend(filename=u"test.ogg")
        self.multimedia.record()
        self.multimedia.pause()
        self.multimedia.stop()
Beispiel #16
0
class TestMultimedia(unittest.TestCase):
    def setUp(self):
        self.profile_manager = ProfileManager(tempfile.mkdtemp())
        profile = self.profile_manager.get('testing')
        config = profile.get_config('freeseer.conf',
                                    settings.FreeseerConfig, ['Global'],
                                    read_only=True)
        plugin_manager = PluginManager(profile)
        self.multimedia = Multimedia(config, plugin_manager)

    def tearDown(self):
        shutil.rmtree(self.profile_manager._base_folder)

    def test_load_backend(self):
        self.multimedia.load_backend(filename=u"test.ogg")

    def test_record_functions(self):
        self.multimedia.load_backend(filename=u"test.ogg")
        self.multimedia.record()
        self.multimedia.pause()
        self.multimedia.stop()
 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)
class RecordingController:
    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)

    def set_window_id(self, window_id):
        """Sets the Window ID which GStreamer should paint on"""
        self.media.set_window_id(window_id)

    def set_audio_feedback_handler(self, audio_feedback_handler):
        """Sets the handler for Audio Feedback levels"""
        self.media.set_audio_feedback_handler(audio_feedback_handler)

    def record(self):
        """Start Recording"""
        self.media.record()

    def stop(self):
        """Stop Recording"""
        self.media.stop()

    def pause(self):
        """Pause Recording"""
        self.media.pause()

    def load_backend(self, presentation=None):
        """Prepares the backend for recording"""
        initialized, filename_for_frontend = self.media.load_backend(presentation)
        if initialized:
            return True, filename_for_frontend
        else:
            return False  # Error something failed while loading the backend

    def print_talks(self):
        query = self.db.get_talks()

        # Print the header
        print("\n")
        print("ID: Speaker - Title")
        print("-------------------")

        while(query.next()):
            talkid = unicode(query.value(0).toString())
            title = unicode(query.value(1).toString())
            speaker = unicode(query.value(2).toString())

            print("{talkid}: {speaker} - {title}".format(talkid=talkid, speaker=speaker, title=title))

    ###
    ### Convenience commands
    ###
    def record_talk_id(self, talk_id):
        """Records using a known Talk ID

        Returns True if recording is successfully started
        Returns False if any issues arise
        """
        presentation = self.db.get_presentation(talk_id)
        if self.media.load_backend(presentation):
            # Only record if the backend successfully loaded
            # No need to print error on failure since load_backend already
            # prints an error message
            self.record()
            return True

        else:
            return False

    def record_filename(self, filename):
        """Records to a specific filename

        Returns True if recording is successfully started
        Returns False if any issues arise
        """
        if self.media.load_backend(filename=filename):
            self.record()
            return True

        else:
            return False
Beispiel #19
0
class TestMultimedia(unittest.TestCase):

    def setUp(self):
        self.profile_manager = ProfileManager(tempfile.mkdtemp())
        self.temp_video_dir = tempfile.mkdtemp()
        profile = self.profile_manager.get('testing')
        config = profile.get_config('freeseer.conf', settings.FreeseerConfig, ['Global'], read_only=True)
        config.videodir = self.temp_video_dir
        plugin_manager = PluginManager(profile)
        self.multimedia = Multimedia(config, plugin_manager)

    def tearDown(self):
        shutil.rmtree(self.temp_video_dir)
        shutil.rmtree(self.profile_manager._base_folder)

    def test_load_backend(self):
        self.multimedia.load_backend(filename=u"test.ogg")

    def test_record_functions(self):
        self.multimedia.load_backend(filename=u"test.ogg")
        self.multimedia.record()
        self.multimedia.pause()
        self.multimedia.stop()

    def test_current_state_is_record(self):
        self.multimedia.record()
        self.assertEqual(self.multimedia.current_state, self.multimedia.RECORD)
        self.assertEqual(self.multimedia.player.get_state()[1], gst.STATE_PLAYING)

    def test_current_state_is_pause(self):
        self.multimedia.pause()
        self.assertEqual(self.multimedia.current_state, self.multimedia.PAUSE)
        self.assertEqual(self.multimedia.player.get_state()[1], gst.STATE_PAUSED)

    def test_current_state_is_not_stop(self):
        self.multimedia.player.set_state(self.multimedia.NULL)  # set to NULL
        self.multimedia.stop()
        self.assertNotEqual(self.multimedia.current_state, self.multimedia.STOP)
        self.assertEqual(self.multimedia.player.get_state()[1], gst.STATE_NULL)
Beispiel #20
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)
 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)
class RecordingController:
    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)

    def set_window_id(self, window_id):
        """Sets the Window ID which GStreamer should paint on"""
        self.media.set_window_id(window_id)

    def set_audio_feedback_handler(self, audio_feedback_handler):
        """Sets the handler for Audio Feedback levels"""
        self.media.set_audio_feedback_handler(audio_feedback_handler)

    def record(self):
        """Start Recording"""
        self.media.record()

    def stop(self):
        """Stop Recording"""
        self.media.stop()

    def pause(self):
        """Pause Recording"""
        self.media.pause()

    def load_backend(self, presentation=None):
        """Prepares the backend for recording"""
        initialized, filename_for_frontend = self.media.load_backend(
            presentation)
        if initialized:
            return True, filename_for_frontend
        else:
            return False  # Error something failed while loading the backend

    def print_talks(self):
        query = self.db.get_talks()

        # Print the header
        print("\n")
        print("ID: Speaker - Title")
        print("-------------------")

        while (query.next()):
            talkid = unicode(query.value(0).toString())
            title = unicode(query.value(1).toString())
            speaker = unicode(query.value(2).toString())

            print("{talkid}: {speaker} - {title}".format(talkid=talkid,
                                                         speaker=speaker,
                                                         title=title))

    ###
    ### Convenience commands
    ###
    def record_talk_id(self, talk_id):
        """Records using a known Talk ID

        Returns True if recording is successfully started
        Returns False if any issues arise
        """
        presentation = self.db.get_presentation(talk_id)
        if self.media.load_backend(presentation):
            # Only record if the backend successfully loaded
            # No need to print error on failure since load_backend already
            # prints an error message
            self.record()
            return True

        else:
            return False

    def record_filename(self, filename):
        """Records to a specific filename

        Returns True if recording is successfully started
        Returns False if any issues arise
        """
        if self.media.load_backend(filename=filename):
            self.record()
            return True

        else:
            return False
Beispiel #23
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)
Beispiel #24
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)
Beispiel #25
0
class TestMultimedia(unittest.TestCase):
    def setUp(self):
        self.profile_manager = ProfileManager(tempfile.mkdtemp())
        self.temp_video_dir = tempfile.mkdtemp()
        profile = self.profile_manager.get('testing')
        config = profile.get_config('freeseer.conf',
                                    settings.FreeseerConfig, ['Global'],
                                    read_only=True)
        config.videodir = self.temp_video_dir
        plugin_manager = PluginManager(profile)
        self.multimedia = Multimedia(config, plugin_manager)

    def tearDown(self):
        shutil.rmtree(self.temp_video_dir)
        shutil.rmtree(self.profile_manager._base_folder)

    def test_load_backend(self):
        self.multimedia.load_backend(filename=u"test.ogg")

    def test_record_functions(self):
        self.multimedia.load_backend(filename=u"test.ogg")
        self.multimedia.record()
        self.multimedia.pause()
        self.multimedia.stop()

    def test_current_state_is_record(self):
        self.multimedia.record()
        self.assertEqual(self.multimedia.current_state, self.multimedia.RECORD)
        self.assertEqual(self.multimedia.player.get_state()[1],
                         gst.STATE_PLAYING)

    def test_current_state_is_pause(self):
        self.multimedia.pause()
        self.assertEqual(self.multimedia.current_state, self.multimedia.PAUSE)
        self.assertEqual(self.multimedia.player.get_state()[1],
                         gst.STATE_PAUSED)

    def test_current_state_is_not_stop(self):
        self.multimedia.player.set_state(gst.STATE_NULL)
        self.multimedia.stop()
        self.assertNotEqual(self.multimedia.current_state,
                            self.multimedia.STOP)
        self.assertEqual(self.multimedia.player.get_state()[1], gst.STATE_NULL)
 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)