[modules/deezer] Update to latest API
This commit is contained in:
parent
d047e19d08
commit
8d9798c8e1
1 changed files with 16 additions and 24 deletions
|
@ -13,28 +13,21 @@ Parameters:
|
||||||
LEFT_CLICK, RIGHT_CLICK, MIDDLE_CLICK, SCROLL_UP, SCROLL_DOWN
|
LEFT_CLICK, RIGHT_CLICK, MIDDLE_CLICK, SCROLL_UP, SCROLL_DOWN
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import bumblebee.input
|
|
||||||
import bumblebee.output
|
|
||||||
import bumblebee.engine
|
|
||||||
|
|
||||||
from bumblebee.output import scrollable
|
|
||||||
|
|
||||||
try:
|
|
||||||
import dbus
|
import dbus
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
import core.module
|
||||||
|
import core.widget
|
||||||
|
import core.input
|
||||||
|
|
||||||
class Module(bumblebee.engine.Module):
|
class Module(core.module.Module):
|
||||||
def __init__(self, engine, config):
|
def __init__(self, config):
|
||||||
super(Module, self).__init__(engine, config,
|
super().__init__(config, core.widget.Widget(self.deezer))
|
||||||
bumblebee.output.Widget(full_text=self.deezer)
|
|
||||||
)
|
buttons = {'LEFT_CLICK':core.input.LEFT_MOUSE,
|
||||||
buttons = {'LEFT_CLICK':bumblebee.input.LEFT_MOUSE,
|
'RIGHT_CLICK':core.input.RIGHT_MOUSE,
|
||||||
'RIGHT_CLICK':bumblebee.input.RIGHT_MOUSE,
|
'MIDDLE_CLICK':core.input.MIDDLE_MOUSE,
|
||||||
'MIDDLE_CLICK':bumblebee.input.MIDDLE_MOUSE,
|
'SCROLL_UP':core.input.WHEEL_UP,
|
||||||
'SCROLL_UP':bumblebee.input.WHEEL_UP,
|
'SCROLL_DOWN':core.input.WHEEL_DOWN,
|
||||||
'SCROLL_DOWN':bumblebee.input.WHEEL_DOWN,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self._song = ''
|
self._song = ''
|
||||||
|
@ -45,21 +38,20 @@ class Module(bumblebee.engine.Module):
|
||||||
|
|
||||||
cmd = 'dbus-send --session --type=method_call --dest=org.mpris.MediaPlayer2.deezer \
|
cmd = 'dbus-send --session --type=method_call --dest=org.mpris.MediaPlayer2.deezer \
|
||||||
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.'
|
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.'
|
||||||
engine.input.register_callback(self, button=buttons[prev_button],
|
core.input.register(self, button=buttons[prev_button],
|
||||||
cmd=cmd + 'Previous')
|
cmd=cmd + 'Previous')
|
||||||
engine.input.register_callback(self, button=buttons[next_button],
|
core.input.register(self, button=buttons[next_button],
|
||||||
cmd=cmd + 'Next')
|
cmd=cmd + 'Next')
|
||||||
engine.input.register_callback(self, button=buttons[pause_button],
|
core.input.register(self, button=buttons[pause_button],
|
||||||
cmd=cmd + 'PlayPause')
|
cmd=cmd + 'PlayPause')
|
||||||
|
|
||||||
## @scrollable
|
|
||||||
def deezer(self, widget):
|
def deezer(self, widget):
|
||||||
return str(self._song)
|
return str(self._song)
|
||||||
|
|
||||||
def hidden(self):
|
def hidden(self):
|
||||||
return str(self._song) == ''
|
return str(self._song) == ''
|
||||||
|
|
||||||
def update(self, widgets):
|
def update(self):
|
||||||
try:
|
try:
|
||||||
bus = dbus.SessionBus()
|
bus = dbus.SessionBus()
|
||||||
deezer = bus.get_object('org.mpris.MediaPlayer2.deezer', '/org/mpris/MediaPlayer2')
|
deezer = bus.get_object('org.mpris.MediaPlayer2.deezer', '/org/mpris/MediaPlayer2')
|
||||||
|
|
Loading…
Reference in a new issue