def setUp(self):
     module = self.modules["CustomCommands"]
     globals().update(vars(module))
     self.plugin = self.plugins["CustomCommands"].cls
     config.init()
     self.cmd_list = CustomCommands.DEFAULT_COMS
     self.commands = JSONObjectDict.from_list(self.cmd_list)
 def setUp(self):
     config.init()
     self.library = library = SongFileLibrary()
     library.librarian = SongLibrarian()
     library.add(SONGS)
     self.Kind.init(library)
     self.b = self.Kind(library)
示例#3
0
 def setUp(self):
     config.init()
     init_fake_app()
     fd, self.fn = mkstemp()
     os.close(fd)
     pb = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 150, 10)
     pb.savev(self.fn, "png", [], [])
    def test_add_filename(self):
        config.init()
        try:
            filename = self.__get_file()
            ret = self.library.add_filename(filename)
            self.failUnless(ret)
            self.failUnlessEqual(1, len(self.library))
            self.failUnlessEqual(len(self.added), 1)
            ret = self.library.add_filename(filename)
            self.failUnless(ret)
            self.failUnlessEqual(len(self.added), 1)
            os.unlink(filename)

            filename = self.__get_file()
            ret = self.library.add_filename(filename, add=False)
            self.failUnless(ret)
            self.failIf(ret in self.library)
            self.failUnlessEqual(len(self.added), 1)
            self.library.add([ret])
            self.failUnless(ret in self.library)
            self.failUnlessEqual(len(self.added), 2)
            self.failUnlessEqual(2, len(self.library))
            os.unlink(filename)

            with capture_output():
                ret = self.library.add_filename("")
            self.failIf(ret)
            self.failUnlessEqual(len(self.added), 2)
            self.failUnlessEqual(2, len(self.library))

        finally:
            config.quit()
示例#5
0
    def setUp(self):
        self.mod = self.modules["mpd_server"]
        config.init()
        init_fake_app()

        MPDServerPlugin = self.mod.MPDServerPlugin
        MPDConnection = self.mod.main.MPDConnection
        MPDService = self.mod.main.MPDService

        class Server(object):
            service = MPDService(app, MPDServerPlugin())

            def _remove_connection(self, conn):
                pass

        server = Server()
        s, c = socket.socketpair()
        self.s = s
        c.setblocking(False)
        s.settimeout(1)
        self.conn = MPDConnection(server, c)
        self.conn.handle_init(server)
        while Gtk.events_pending():
            Gtk.main_iteration_do(True)
        self.s.recv(9999)
示例#6
0
    def setUp(self):
        config.init()
        config.set("player", "gst_pipeline", "fakesink")
        config.set("settings", "xine_driver", "none")
        module = player.init_backend(self.NAME)
        lib = library.init()
        self.player = module.init(lib.librarian)
        source = PlaylistModel()
        source.set(FILES)

        self.events = []

        def start_end_handler(player, song, *args):
            self.events.append((args[-1], song))

        self.player.connect("song-started", start_end_handler, "started")
        self.player.connect("song-ended", start_end_handler, "ended")

        self.player.setup(source, None, 0)

        self.signals = []

        def handler(type_, *args):
            self.signals.append(type_)
        connect_obj(self.player, "unpaused", handler, "unpaused")
        connect_obj(self.player, "paused", handler, "paused")
示例#7
0
def main():
    quodlibet._init_signal()

    opts = util.OptionParser(
        "Ex Falso", const.VERSION,
        _("an audio tag editor"), "[%s]" % _("directory"))

    sys.argv.append(os.path.abspath("."))
    opts, args = opts.parse()
    args[0] = os.path.realpath(args[0])

    config.init(const.CONFIG)

    app.library = quodlibet.init(icon="exfalso",
                                 name="Ex Falso",
                                 title=const.PROCESS_TITLE_EF)
    app.librarian = app.library.librarian
    app.player = quodlibet.init_backend("nullbe", app.librarian)
    pm = quodlibet.init_plugins()
    pm.rescan()

    from quodlibet.qltk.exfalsowindow import ExFalsoWindow
    app.window = ExFalsoWindow(app.library, args[0])
    app.window.init_plugins()

    from quodlibet.qltk import session
    session.init("exfalso")

    quodlibet.enable_periodic_save(save_library=False)
    quodlibet.main(app.window)

    config.save(const.CONFIG)

    print_d("Finished shutdown.")
示例#8
0
    def setUp(self):
        config.init()

        self.main = mkdtemp()

        self.dir1 = mkdtemp(dir=self.main)
        self.dir2 = mkdtemp(dir=self.main)

        h, self.cover1 = mkstemp(".png", dir=self.main)
        os.close(h)
        pb = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 10, 10)
        pb.savev(self.cover1, "png", [], [])

        h, self.cover2 = mkstemp(".png", dir=self.main)
        os.close(h)
        pb = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 20, 20)
        pb.savev(self.cover2, "png", [], [])

        fd, self.file1 = mkstemp(".mp3", dir=self.main)
        os.close(fd)
        shutil.copy(os.path.join(DATA_DIR, 'silence-44-s.mp3'), self.file1)

        fd, self.file2 = mkstemp(".mp3", dir=self.main)
        os.close(fd)
        shutil.copy(os.path.join(DATA_DIR, 'silence-44-s.mp3'), self.file2)

        self.manager = CoverManager()
示例#9
0
 def setUp(self):
     config.init()
     self.h = SongsMenuPluginHandler()
     library = SongLibrary()
     library.librarian = SongLibrarian()
     self.lib = library
     self.parent = Gtk.Window()
示例#10
0
    def setUpClass(cls):
        config.init()

        cls.mod = cls.modules["ReplayGain"]
        Kind = cls.plugins["ReplayGain"].cls
        cls.songs = []
        cls.plugin = Kind(cls.songs, None)
示例#11
0
 def setUp(self):
     config.init()
     fd, self.filename = mkstemp(".mp3")
     os.close(fd)
     shutil.copy(os.path.join(DATA_DIR, 'silence-44-s.mp3'), self.filename)
     fd, self.filename2 = mkstemp(".mp3")
     os.close(fd)
     shutil.copy(os.path.join(DATA_DIR, 'mutagen-bug.mp3'), self.filename2)
 def setUp(self):
     config.init()
     player = NullPlayer()
     song = AudioFile()
     song.bookmarks = [(10, "bla")]
     song.sanitize("/")
     player.song = song
     self.player = player
示例#13
0
def main(argv=sys.argv):
    """Main entry point"""

    config.init()
    try:
        return _main(argv)
    finally:
        config.quit()
示例#14
0
    def setUp(self):
        config.init()

        lib = SongLibrary()
        self.p2 = Pane(lib, "artist", self)
        self.p1 = Pane(lib, "genre", self.p2)
        self.last = None
        self.count = 0
示例#15
0
 def setUp(self):
     """Copy the base silent file to a temp name/location and load it"""
     config.init()
     fd, self.filename = mkstemp(suffix=self.ext, text=False)
     dst = os.fdopen(fd, 'w')
     src = open(self.base + self.ext, 'rb')
     copyfileobj(src, dst)
     dst.close()
     self.song = formats.MusicFile(self.filename)
    def setUp(self):
        config.init()
        self.library = SongLibrary()
        backend = quodlibet.player.init_backend("nullbe")
        self.device = backend.init(self.library)

        self.songs = [AudioFile({"title": x}) for x in ["song1", "song2", "song3"]]
        for song in self.songs:
            song.sanitize(fsnative(unicode(song["title"])))
示例#17
0
 def setUp(self):
     config.init()
     player = NullPlayer()
     song = AudioFile()
     song.bookmarks = [(10, "bla")]
     song.sanitize(fsnative(u"/"))
     player.song = song
     self.player = player
     self.library = SongLibrary()
示例#18
0
 def setUp(self):
     config.init()
     init_fake_app()
     app.player.paused = False
     # Only album browsers are supported currently
     app.library.clear()
     app.window.browser = AlbumList(app.library)
     self.plugin = self.plugins["Random Album Playback"].cls()
     self.albums = [A1, A2, A3]
示例#19
0
    def setUp(self):
        config.init()
        self.songlist = SongList(SongLibrary())

        self.orders_changed = 0

        def orders_changed_cb(*args):
            self.orders_changed += 1

        self.songlist.connect("orders-changed", orders_changed_cb)
 def setUp(self):
     config.init()
     config.set("browsers", "panes", "artist")
     library = SongLibrary()
     library.librarian = SongLibrarian()
     PanedBrowser.init(library)
     for af in SONGS:
         af.sanitize()
     library.add(SONGS)
     self.bar = self.Bar(library, False)
示例#21
0
    def setUp(self):
        config.init()
        self.manager = CoverManager()

        self.dir = os.path.realpath(quux("~dirname"))
        self.files = [self.full_path("12345.jpg"),
                      self.full_path("nothing.jpg")
                      ]
        for f in self.files:
            file(f, "w").close()
示例#22
0
def main(argv):
    import quodlibet
    from quodlibet.qltk import add_signal_watch, icons

    add_signal_watch(app.quit)

    opts = util.OptionParser("Ex Falso", const.VERSION, _("an audio tag editor"), "[%s]" % _("directory"))

    # FIXME: support unicode on Windows, sys.argv isn't good enough
    argv.append(os.path.abspath(fsnative(u".")))
    opts, args = opts.parse(argv[1:])
    args[0] = os.path.realpath(args[0])

    config.init(os.path.join(quodlibet.get_user_dir(), "config"))

    app.name = "Ex Falso"
    app.id = "exfalso"

    quodlibet.init(icon=icons.EXFALSO, name=app.name, proc_title=app.id)

    import quodlibet.library
    import quodlibet.player

    app.library = quodlibet.library.init()
    app.player = quodlibet.player.init_player("nullbe", app.librarian)
    from quodlibet.qltk.songlist import PlaylistModel

    app.player.setup(PlaylistModel(), None, 0)
    pm = quodlibet.init_plugins()
    pm.rescan()

    from quodlibet.qltk.exfalsowindow import ExFalsoWindow

    dir_ = args[0]
    if os.name == "nt":
        dir_ = fsdecode(dir_)
    app.window = ExFalsoWindow(app.library, dir_)
    app.window.init_plugins()

    from quodlibet.util.cover import CoverManager

    app.cover_manager = CoverManager()
    app.cover_manager.init_plugins()

    from quodlibet.qltk import session

    session.init("exfalso")

    quodlibet.enable_periodic_save(save_library=False)
    quodlibet.main(app.window)

    quodlibet.finish_first_session(app.id)
    config.save()

    print_d("Finished shutdown.")
示例#23
0
    def setUp(self):
        self.plugin = self.plugins["mpris"].cls

        config.init()
        init_fake_app()

        app.window.songlist.set_songs([A1, A2])
        app.player.go_to(None)
        self.m = self.plugin()
        self.m.enabled()
        self._replies = []
示例#24
0
    def setUp(self):
        config.init()

        self.f = get_temp_copy(os.path.join(DATA_DIR, 'silence-44-s.ogg'))
        self.f2 = get_temp_copy(os.path.join(DATA_DIR, 'silence-44-s.mp3'))
        self.s = MusicFile(self.f)
        self.s2 = MusicFile(self.f2)

        fd, self.f3 = mkstemp(".mp3")
        os.write(fd, "garbage")
        os.close(fd)
示例#25
0
    def setUp(self):
        config.init()

        self.f = get_temp_copy(get_data_path('silence-44-s.ogg'))
        self.f2 = get_temp_copy(get_data_path('silence-44-s.mp3'))
        self.s = MusicFile(self.f)
        self.s2 = MusicFile(self.f2)

        fd, self.f3 = mkstemp(".mp3")
        os.write(fd, b"garbage")
        os.close(fd)
示例#26
0
    def setUp(self):
        config.init()

        self.manager = CoverManager()
        self.dir = mkdtemp()
        self.song = self.an_album_song()

        # Safety check
        self.failIf(glob.glob(os.path.join(self.dir + "*.jpg")))
        files = [self.full_path("12345.jpg"), self.full_path("nothing.jpg")]
        for f in files:
            open(f, "w").close()
示例#27
0
    def setUp(self):
        config.init()
        self.manager = CoverManager()

        self.dir = os.path.realpath(quux("~dirname"))
        # Safety check
        self.failIf(glob.glob(self.dir + "/*.jpg"))
        self.files = [self.full_path("12345.jpg"),
                      self.full_path("nothing.jpg")
                      ]
        for f in self.files:
            open(f, "w").close()
示例#28
0
 def setUp(self):
     config.init()
     self.p = NullPlayer()
     self.w = SongLibrary()
     self.s1 = AudioFile(
         {"~#playcount": 0, "~#skipcount": 0, "~#lastplayed": 10,
          "~filename": "foo", "~#length": 1.5})
     self.s2 = AudioFile(
         {"~#playcount": 0, "~#skipcount": 0, "~#lastplayed": 10,
          "~filename": "foo", "~#length": 1.5})
     self.cm = SongTracker(self.w, self.p, self)
     self.current = None
示例#29
0
    def setUpClass(cls):
        config.init()
        browsers.init()
        library.init()
        player.init("nullbe")

        app.player = player.init_device(library.librarian)
        app.window = QuodLibetWindow(library.library, player.playlist)
        app.librarian = library.librarian
        app.player = player.playlist

        cls.plugin = cls.plugins["mpris"]
示例#30
0
    def setUp(self):
        config.init()
        init_fake_app()

        self.plugin = self.plugins["mediaserver"].cls
        self.m = self.plugin()
        self.m.enabled()
        self._replies = []
        self._args = {
            "reply_handler": self._reply,
            "error_handler": self._error
        }
示例#31
0
    def setUp(self):
        config.init()
        config.set("browsers", "panes", "artist")
        library = SongLibrary()
        library.librarian = SongLibrarian()
        PanedBrowser.init(library)
        for af in SONGS:
            af.sanitize()
        library.add(SONGS)
        self.bar = self.Bar(library)

        self.last = None
        self.emit_count = 0

        def selected_cb(browser, songs, *args):
            self.last = list(songs)
            self.emit_count += 1
        self.bar.connect("songs-selected", selected_cb)
示例#32
0
    def test_add_filename_normalize_path(self):
        if not os.name == "nt":
            return

        config.init()
        filename = self.__get_file()

        # create a equivalent path different from the original one
        if filename.upper() == filename:
            other = filename.lower()
        else:
            other = filename.upper()

        song = self.library.add_filename(filename)
        other_song = self.library.add_filename(other)
        self.assertTrue(song is other_song)
        os.unlink(filename)
        config.quit()
示例#33
0
    def setUp(self):
        config.init()
        self.lib = SongFileLibrary()
        self.songlist = SongList(self.lib)
        assert not self.lib.librarian, "not expecting a librarian - leaky test?"

        self.orders_changed = 0
        self.songs_removed: List[Set] = []

        def orders_changed_cb(*args):
            self.orders_changed += 1

        def orders_removed_cb(songlist, removed):
            self.songs_removed.append(removed)

        self.__sigs = [
            self.songlist.connect("orders-changed", orders_changed_cb),
            self.songlist.connect("songs-removed", orders_removed_cb)
        ]
示例#34
0
    def test_init_garbage_file(self):
        config.quit()

        garbage = b"\xf1=\xab\xac"

        fd, filename = mkstemp()
        os.close(fd)
        with open(filename, "wb") as f:
            f.write(garbage)

        config.init(filename)
        self.assertTrue(config.options("player"))

        invalid_filename = filename + ".not-valid"
        self.assertTrue(os.path.exists(invalid_filename))
        with open(invalid_filename, "rb") as f:
            self.assertEqual(f.read(), garbage)

        os.remove(filename)
        os.remove(invalid_filename)
示例#35
0
    def setUp(self):
        config.init()
        self.s1 = AudioFile(
            {"album": u"I Hate: Tests", "artist": u"piman", "title": u"Quuxly",
             "version": u"cake mix",
             "~filename": fsnative(u"/dir1/foobar.ogg"),
             "~#length": 224, "~#skipcount": 13, "~#playcount": 24,
             "date": u"2007-05-24"})
        self.s2 = AudioFile(
            {"album": u"Foo the Bar", "artist": u"mu", "title": u"Rockin' Out",
             "~filename": fsnative(u"/dir2/something.mp3"),
             "tracknumber": u"12/15"})

        self.s3 = AudioFile({
            "artist": u"piman\nmu",
            "~filename": fsnative(u"/test/\xf6\xe4\xfc/fo\xfc.ogg"),
            "~mountpoint": fsnative(u"/bla/\xf6\xe4\xfc/fo\xfc"),
        })
        self.s4 = AudioFile({"title": u"Ångström", "utf8": u"Ångström"})
        self.s5 = AudioFile({"title": u"oh&blahhh", "artist": u"!ohno"})
示例#36
0
 def setUp(self):
     config.init()
     self.p = NullPlayer()
     self.w = SongLibrary()
     self.s1 = AudioFile({
         "~#playcount": 0,
         "~#skipcount": 0,
         "~#lastplayed": 10,
         "~filename": "foo",
         "~#length": 1.5
     })
     self.s2 = AudioFile({
         "~#playcount": 0,
         "~#skipcount": 0,
         "~#lastplayed": 10,
         "~filename": "foo",
         "~#length": 1.5
     })
     self.cm = SongTracker(self.w, self.p, self)
     self.current = None
示例#37
0
    def setUp(self):
        config.init()

        library = SongLibrary()
        library.librarian = SongLibrarian()
        AlbumList.init(library)

        for af in SONGS:
            af.sanitize()
        library.add(SONGS)

        self.bar = AlbumList(library)

        self._id = self.bar.connect("songs-selected", self._selected)
        self._id2 = self.bar.connect("songs-activated", self._activated)
        with realized(self.bar):
            self.bar.filter_text("")
            self._wait()
        self.songs = []
        self.activated = False
示例#38
0
def init_cli(no_translations=False, config_file=None):
    """This needs to be called before any API can be used.
    Might raise in case of an error.

    Like init() but for code not using Gtk etc.
    """

    global _cli_initialized

    if _cli_initialized:
        return

    _init_python()
    config.init_defaults()
    if config_file is not None:
        config.init(config_file)
    _init_gettext(no_translations)
    _init_formats()
    _init_g()

    _cli_initialized = True
示例#39
0
    def __init__(self, on_changed=None):
        from quodlibet import const, config
        from quodlibet.qltk.exfalsowindow import ExFalsoWindow

        config.init(const.CONFIG)

        try:
            self.instance = backend, library, player = ql.init(
                gtk=False,  # Don't initialize GLib/GTK+ stuff.
                backend='nullbe')
            self.api_version = 1
        except TypeError:
            library = ql.init()
            ql.init_backend('nullbe', library.librarian)
            self.api_version = 2

        self.on_changed = on_changed
        if on_changed:
            library.connect('changed', self._on_changed)

        self.window = window = ExFalsoWindow(library)

        if self.api_version == 2:
            from quodlibet import widgets
            widgets.main = window
            widgets.watcher = library.librarian

        # Ex Falso doesn't have any shortcut for the directory and file list
        # widgets, so we hack into them using multiple get_children calls.
        # Hierarchy:
        #   Window > HPaned > VBox > FileSelector (VPaned)
        #   - ScrolledWindow > DirectoryTree (TreeView)  # directory list
        #   - ScrolledWindow > AllTreeView (TreeView)  # file list
        filesel = window.get_child().get_children()[0].get_children()[0]
        children = filesel.get_children()
        self.dirlist = children[0].child
        self.filelist = children[1].child
        assert isinstance(self.dirlist, gtk.TreeView)
        assert isinstance(self.filelist, gtk.TreeView)
示例#40
0
    def setUp(self):
        config.init()

        self.main = mkdtemp()

        self.dir1 = mkdtemp(dir=self.main)
        self.dir2 = mkdtemp(dir=self.main)

        h, self.cover1 = mkstemp(".png", dir=self.main)
        os.close(h)
        pb = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 10, 10)
        pb.savev(self.cover1, "png", [], [])

        h, self.cover2 = mkstemp(".png", dir=self.main)
        os.close(h)
        pb = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 20, 20)
        pb.savev(self.cover2, "png", [], [])

        self.file1 = get_temp_copy(get_data_path('silence-44-s.mp3'))
        self.file2 = get_temp_copy(get_data_path('silence-44-s.mp3'))

        self.manager = CoverManager()
示例#41
0
    def setUp(self):
        self.mod = self.modules["mpd_server"]
        config.init()
        init_fake_app()

        MPDConnection = self.mod.main.MPDConnection
        MPDService = self.mod.main.MPDService

        class Server(object):
            service = MPDService(app)

            def _remove_connection(self, conn):
                pass

        server = Server()
        s, c = socket.socketpair()
        self.s = s
        c.setblocking(False)
        s.settimeout(1)
        self.conn = MPDConnection(server, c)
        self.conn.handle_init(server)
        while Gtk.events_pending():
            Gtk.main_iteration_do(True)
        self.s.recv(9999)
示例#42
0
 def setUp(self):
     config.init()
     self.mod = self.modules["AcoustidSearch"]
示例#43
0
 def setUp(self):
     plugins.init()
     config.init()
示例#44
0
 def setUp(self):
     config.init()
示例#45
0
 def setUp(self):
     config.init()
     self.p = NullPlayer()
     self.l = SongLibrary()
示例#46
0
 def setUp(self):
     config.init()
     self.filename = get_temp_copy(os.path.join(DATA_DIR, 'empty.flac'))
示例#47
0
    def setUp(self):
        config.init()

        lib = SongLibrary()
        self.pane = Pane(lib, "artist")
示例#48
0
def main(argv):
    import quodlibet

    quodlibet.init_cli()

    try:
        # we want basic commands not to import gtk (doubles process time)
        assert "gi.repository.Gtk" not in sys.modules
        sys.modules["gi.repository.Gtk"] = None
        startup_actions, cmds_todo = process_arguments(argv)
    finally:
        sys.modules.pop("gi.repository.Gtk", None)

    quodlibet.init()

    from quodlibet import app
    from quodlibet.qltk import add_signal_watch, Icons
    add_signal_watch(app.quit)

    import quodlibet.player
    import quodlibet.library
    from quodlibet import config
    from quodlibet import browsers
    from quodlibet import util

    app.name = "Quod Libet"
    app.id = "quodlibet"
    quodlibet.set_application_info(Icons.QUODLIBET, app.id, app.name)

    config.init(os.path.join(quodlibet.get_user_dir(), "config"))

    library_path = os.path.join(quodlibet.get_user_dir(), "songs")

    print_d("Initializing main library (%s)" %
            (quodlibet.util.path.unexpand(library_path)))

    library = quodlibet.library.init(library_path)
    app.library = library

    # this assumes that nullbe will always succeed
    from quodlibet.player import PlayerError
    wanted_backend = os.environ.get("QUODLIBET_BACKEND",
                                    config.get("player", "backend"))
    backend_traceback = None
    for backend in [wanted_backend, "nullbe"]:
        try:
            player = quodlibet.player.init_player(backend, app.librarian)
        except PlayerError:
            backend_traceback = format_exc()
        else:
            break
    app.player = player

    os.environ["PULSE_PROP_media.role"] = "music"
    os.environ["PULSE_PROP_application.icon_name"] = "quodlibet"

    browsers.init()

    from quodlibet.qltk.songlist import SongList, get_columns

    from quodlibet.util.collection import Album
    try:
        cover_size = config.getint("browsers", "cover_size")
    except config.Error:
        pass
    else:
        if cover_size > 0:
            Album.COVER_SIZE = cover_size

    headers = get_columns()
    SongList.set_all_column_headers(headers)

    for opt in config.options("header_maps"):
        val = config.get("header_maps", opt)
        util.tags.add(opt, val)

    in_all = ("~filename ~uri ~#lastplayed ~#rating ~#playcount ~#skipcount "
              "~#added ~#bitrate ~current ~#laststarted ~basename "
              "~dirname").split()
    for Kind in browsers.browsers:
        if Kind.headers is not None:
            Kind.headers.extend(in_all)
        Kind.init(library)

    pm = quodlibet.init_plugins("no-plugins" in startup_actions)

    if hasattr(player, "init_plugins"):
        player.init_plugins()

    from quodlibet.qltk import unity
    unity.init("quodlibet.desktop", player)

    from quodlibet.qltk.songsmenu import SongsMenu
    SongsMenu.init_plugins()

    from quodlibet.util.cover import CoverManager
    app.cover_manager = CoverManager()
    app.cover_manager.init_plugins()

    from quodlibet.plugins.playlist import PLAYLIST_HANDLER
    PLAYLIST_HANDLER.init_plugins()

    from quodlibet.plugins.query import QUERY_HANDLER
    QUERY_HANDLER.init_plugins()

    from gi.repository import GLib

    def exec_commands(*args):
        for cmd in cmds_todo:
            try:
                resp = cmd_registry.run(app, *cmd)
            except CommandError:
                pass
            else:
                if resp is not None:
                    print_(resp, end="")

    from quodlibet.qltk.quodlibetwindow import QuodLibetWindow, PlayerOptions
    # Call exec_commands after the window is restored, but make sure
    # it's after the mainloop has started so everything is set up.
    app.window = window = QuodLibetWindow(
        library,
        player,
        restore_cb=lambda: GLib.idle_add(exec_commands,
                                         priority=GLib.PRIORITY_HIGH))

    app.player_options = PlayerOptions(window)

    from quodlibet.qltk.debugwindow import MinExceptionDialog
    from quodlibet.qltk.window import on_first_map
    if backend_traceback is not None:

        def show_backend_error(window):
            d = MinExceptionDialog(
                window, _("Audio Backend Failed to Load"),
                _("Loading the audio backend '%(name)s' failed. "
                  "Audio playback will be disabled.") %
                {"name": wanted_backend}, backend_traceback)
            d.run()

        # so we show the main window first
        on_first_map(app.window, show_backend_error, app.window)

    from quodlibet.plugins.events import EventPluginHandler
    pm.register_handler(EventPluginHandler(library.librarian, player))

    from quodlibet.mmkeys import MMKeysHandler
    from quodlibet.remote import Remote, RemoteError
    from quodlibet.commands import registry as cmd_registry, CommandError
    from quodlibet.qltk.tracker import SongTracker, FSInterface
    try:
        from quodlibet.qltk.dbus_ import DBusHandler
    except ImportError:
        DBusHandler = lambda player, library: None

    mmkeys_handler = MMKeysHandler(app)
    mmkeys_handler.start()

    current_path = os.path.join(quodlibet.get_user_dir(), "current")
    fsiface = FSInterface(current_path, player)
    remote = Remote(app, cmd_registry)
    try:
        remote.start()
    except RemoteError:
        exit_(1, True)

    DBusHandler(player, library)
    tracker = SongTracker(library.librarian, player, window.playlist)

    from quodlibet.qltk import session
    session.init("quodlibet")

    quodlibet.enable_periodic_save(save_library=True)

    if "start-playing" in startup_actions:
        player.paused = False

    # restore browser windows
    from quodlibet.qltk.browser import LibraryBrowser
    GLib.idle_add(LibraryBrowser.restore,
                  library,
                  player,
                  priority=GLib.PRIORITY_HIGH)

    def before_quit():
        print_d("Saving active browser state")
        try:
            app.browser.save()
        except NotImplementedError:
            pass

        print_d("Shutting down player device %r." % player.version_info)
        player.destroy()

    quodlibet.main(window, before_quit=before_quit)

    app.player_options.destroy()
    quodlibet.finish_first_session(app.id)
    mmkeys_handler.quit()
    remote.stop()
    fsiface.destroy()

    tracker.destroy()
    quodlibet.library.save()

    config.save()

    print_d("Finished shutdown.")
示例#49
0
def fake_app():
    config.init()
    init_fake_app()
    yield app
    destroy_fake_app()
    config.quit()
示例#50
0
 def setUp(self):
     config.init()
     init_fake_app()
示例#51
0
 def setUp(self):
     config.init()
     init_fake_app()
     # Avoid warnings when running with empty config
     set_columns(["artist", "title"])
     self.win = PreferencesWindow(None)
示例#52
0
 def setUp(self):
     config.init()
     config.set("editing", "save_email", "")
     config.set("editing", "save_to_songs", "1")
示例#53
0
 def setUp(self):
     SongProperties.plugins = DummyPlugins()
     config.init()
     self.library = SongLibrary()
示例#54
0
 def setUp(self):
     config.init()
     fd, self.filename = mkstemp(".mp3")
     os.close(fd)
     shutil.copy(os.path.join(DATA_DIR, 'silence-44-s.mp3'), self.filename)
示例#55
0
 def setUp(self):
     config.init()
     self.prefs = RatingsPrefs()
 def setUp(self):
     config.init()
     self.mod = self.modules["Export to HTML"]
     self.to_html = self.mod.to_html
示例#57
0
 def setUp(self):
     config.init()
     init_fake_app()
     self.plugin = self.plugins["Tray Icon"].cls()
示例#58
0
 def setUp(self):
     config.init()
     self.filename = get_temp_copy(get_data_path('empty.flac'))
示例#59
0
 def setUpClass(cls):
     config.init()
示例#60
0
 def setUp(self):
     config.init()
     h, self.filename = mkstemp(".flac")
     os.close(h)
     shutil.copy(os.path.join(DATA_DIR, 'empty.flac'), self.filename)