Ejemplo n.º 1
0
 def SetPosition(self, track_id, position):
     if track_id == self._get_trackid(PLAYER.current):
         position /= MICROSECOND
         PLAYER.seek(position)
     else:
         # treat request as stale
         pass
Ejemplo n.º 2
0
 def PlaybackStatus(self):
     if PLAYER.is_playing():
         return 'Playing'
     elif PLAYER.is_paused():
         return 'Paused'
     else:
         return 'Stopped'
Ejemplo n.º 3
0
def _delete_event(window, event, exaile):
    """ window behavior on closing, according to sound menu spec:
        https://wiki.ubuntu.com/SoundMenu
        """
    if PLAYER.is_playing():
        window.hide()
    else:
        exaile.gui.main.quit()
    return True
Ejemplo n.º 4
0
    def __init__(self):
        self.inhibited = False
        self.lock = _thread.allocate_lock()

        # Initialize parent object
        super().__init__(PLAYER)

        # Inhibit if player currently playing
        if PLAYER.is_playing():
            self.inhibit()
Ejemplo n.º 5
0
def on_media_key(key, exaile):
    from xl.player import PLAYER, QUEUE
    {
        'XF86AudioPlay': PLAYER.toggle_pause,
        'XF86AudioStop': PLAYER.stop,
        'XF86AudioPrev': QUEUE.prev,
        'XF86AudioNext': QUEUE.next,
        'XF86AudioPause': PLAYER.toggle_pause,
        'XF86AudioMedia': exaile.gui.main.window.present,
        'XF86AudioRewind': lambda: PLAYER.seek(0),
    }[key]()
Ejemplo n.º 6
0
def on_media_key(key, exaile):
    from xl.player import PLAYER, QUEUE
    {
        'XF86AudioPlay': PLAYER.toggle_pause,
        'XF86AudioStop': PLAYER.stop,
        'XF86AudioPrev': QUEUE.prev,
        'XF86AudioNext': QUEUE.next,
        'XF86AudioPause': PLAYER.toggle_pause,
        'XF86AudioMedia': exaile.gui.main.window.present,
        'XF86AudioRewind': lambda: PLAYER.seek(0),
    }[key]()
Ejemplo n.º 7
0
    def __init__(self, bus_name, object_path, interface):
        try:
            bus = dbus.SessionBus()
            obj =  bus.get_object(bus_name, object_path)
            self.iface = dbus.Interface(obj, interface)
            logger.info('Suspend Bus Acquired')
        except dbus.DBusException:
            raise EnvironmentError(bus_name + ' bus not available')

        self.inhibited = False
        self.lock = _thread.allocate_lock()

        # Initialize parent object
        adapters.PlaybackAdapter.__init__(self, PLAYER)

        # Inhibit if player currently playing
        if PLAYER.is_playing():
            self.inhibit()
Ejemplo n.º 8
0
    def __init__(self, bus_name, object_path, interface):
        try:
            bus = dbus.SessionBus()
            obj = bus.get_object(bus_name, object_path)
            self.iface = dbus.Interface(obj, interface)
            logger.info('Suspend Bus Acquired')
        except dbus.DBusException:
            raise EnvironmentError(bus_name + ' bus not available')

        self.inhibited = False
        self.lock = _thread.allocate_lock()

        # Initialize parent object
        adapters.PlaybackAdapter.__init__(self, PLAYER)

        # Inhibit if player currently playing
        if PLAYER.is_playing():
            self.inhibit()
Ejemplo n.º 9
0
 def Volume(self, value):
     PLAYER.set_volume(value * 100.0)
Ejemplo n.º 10
0
 def Volume(self):
     # Range: 0.0 ~ 1.0
     return PLAYER.get_volume() / 100.0
Ejemplo n.º 11
0
 def Position(self):
     pos = PLAYER.get_position() / NANOSECOND * MICROSECOND
     return dbus.Int64(pos)
Ejemplo n.º 12
0
 def Stop(self):
     PLAYER.stop()
Ejemplo n.º 13
0
 def Seek(self, offset):
     position = PLAYER.get_position() / NANOSECOND
     position += offset / MICROSECOND
     PLAYER.seek(position)
Ejemplo n.º 14
0
 def PlayPause(self):
     if PLAYER.is_stopped():
         QUEUE.play()
     else:
         PLAYER.toggle_pause()
Ejemplo n.º 15
0
 def Pause(self):
     PLAYER.pause()