Beispiel #1
0
def main():
    """Start the app."""
    thread(watch_player)
    ui.init()
    try:
        ui.mainloop()
    except KeyboardInterrupt:
        pass
    finally:
        exit()
Beispiel #2
0
def main():
    """Start the app."""
    thread(watch_player)
    ui.init()
    try:
        ui.mainloop()
    except KeyboardInterrupt:
        pass
    finally:
        exit()
Beispiel #3
0
def watch_player():
    """Main loop which checks for new song and updates the metadata."""
    while True:
        if not player.running():
            exit()
        player.get_status()
        if player.state == 'stop':
            md.reset_tags()
        elif (player.artist != md.artist or player.title != md.title
              or player.album != md.album):
            needsupdate = ['lyrics', 'guitartabs']
            if player.artist != md.artist:
                needsupdate += ['artistbio']
            if bg:
                needsupdate += ['backdrops']
                if player.album != md.album:
                    needsupdate += ['cover']
            md.set_tags()
            for item in needsupdate:
                thread(md.get, (item, ))
        time.sleep(1)
Beispiel #4
0
def watch_player():
    """Main loop which checks for new song and updates the metadata."""
    while True:
        if not player.running():
            exit()
        player.get_status()
        if player.state == 'stop':
            md.reset_tags()
        elif (player.artist != md.artist
                or player.title != md.title
                or player.album != md.album):
            needsupdate = ['lyrics', 'guitartabs']
            if player.artist != md.artist:
                needsupdate += ['artistbio']
            if bg:
                needsupdate += ['backdrops']
                if player.album != md.album:
                    needsupdate += ['cover']
            md.set_tags()
            for item in needsupdate:
                thread(md.get, (item,))
        time.sleep(1)
Beispiel #5
0
 def reload(self, type):
     """Reload metadata for current view."""
     from lyvi.utils import thread
     import lyvi.metadata
     lyvi.md.delete(type, lyvi.md.artist, lyvi.md.title, lyvi.md.album)
     thread(lyvi.md.get, (type,))
Beispiel #6
0
import dbus
import dbus.exceptions
import dbus.glib
import dbus.mainloop.glib
from gi.repository import GObject

from lyvi.players import Player
from lyvi.utils import thread


# Initialize the DBus loop, required to enable asynchronous dbus calls
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
GObject.threads_init()
dbus.glib.init_threads()
loop = GObject.MainLoop()
thread(loop.run)


def find():
    """Return the initialized mpris.Player class, otherwise
    return None if no player was found."""
    try:
        for name in dbus.SessionBus().list_names():
            if name.startswith('org.mpris.MediaPlayer2.'):
                return Player(name[len('org.mpris.MediaPlayer2.'):])
    except dbus.exceptions.DBusException:
        pass
    return None


def running(playername):
Beispiel #7
0
import dbus
import dbus.exceptions
import dbus.glib
import dbus.mainloop.glib
from gi.repository import GObject

from lyvi.players import Player
from lyvi.utils import thread

# Initialize the DBus loop, required to enable asynchronous dbus calls
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
GObject.threads_init()
dbus.glib.init_threads()
loop = GObject.MainLoop()
thread(loop.run)


def find():
    """Return the initialized mpris.Player class, otherwise
    return None if no player was found."""
    try:
        for name in dbus.SessionBus().list_names():
            if name.startswith('org.mpris.MediaPlayer2.'):
                return Player(name[len('org.mpris.MediaPlayer2.'):])
    except dbus.exceptions.DBusException:
        pass
    return None


def running(playername):