Plugin Amarok
- From: Rafael Brundo Uriarte <rafael uriarte gmail com>
- To: kupfer-list gnome org
- Subject: Plugin Amarok
- Date: Tue, 16 Nov 2010 21:24:03 -0200
Folks,
I've developed a very simple plugin to control amarok playback(based
on the audacious one, thanks folks). it has got only Play, Pause,
Stop, Next Song and Previous Song (amarok 2.X hasn't got yet and dbus
interface to manage collection). I am not sure if it's worth to put in
the official release but for those who use amarok and want to give a
try, here it go (just save as ~/.local/share/kupfer/plugins/amarok.py
) :
"
__kupfer_name__ = _("Amarok")
__kupfer_sources__ = ("AmarokSource", )
__description__ = _("Very Simple Plugin to Control Amarok(2.X)
Playback, it includes Play, Stop, Pause, Next Song and Previous Song.
Make sure that amarok is running")
__version__ = "2010-11-16"
__author__ = "Rafael Brundo Uriarte<rafael uriarte gmail com>"
import subprocess
from kupfer.objects import Leaf, Source, Action
from kupfer.objects import AppLeaf, RunnableLeaf, SourceLeaf
from kupfer.obj.apps import AppLeafContentMixin
from kupfer import objects, icons, utils
from kupfer import plugin_support
from kupfer import kupferstring
class Play (RunnableLeaf):
def __init__(self):
RunnableLeaf.__init__(self, name=_("Play"))
def run(self):
utils.launch_commandline("qdbus org.mpris.amarok /Player Play",
in_terminal=False)
def get_description(self):
return _("Resume playback in Amarok")
def get_icon_name(self):
return "media-playback-start"
class Stop (RunnableLeaf):
def __init__(self):
RunnableLeaf.__init__(self, name=_("Stop"))
def run(self):
utils.launch_commandline("qdbus org.mpris.amarok /Player Stop",
in_terminal=False)
def get_description(self):
return _("Stop playback in Amarok")
def get_icon_name(self):
return "media-playback-stop"
class Pause (RunnableLeaf):
def __init__(self):
RunnableLeaf.__init__(self, name=_("Pause"))
def run(self):
utils.launch_commandline("qdbus org.mpris.amarok /Player Pause",
in_terminal=False)
def get_description(self):
return _("Pause playback in Amarok")
def get_icon_name(self):
return "media-playback-pause"
class Next (RunnableLeaf):
def __init__(self):
RunnableLeaf.__init__(self, name=_("Next"))
def run(self):
utils.launch_commandline("qdbus org.mpris.amarok /Player Next",
in_terminal=False)
def get_description(self):
return _("Jump to next track in Amarok")
def get_icon_name(self):
return "media-skip-forward"
class Previous (RunnableLeaf):
def __init__(self):
RunnableLeaf.__init__(self, name=_("Previous"))
def run(self):
utils.launch_commandline("qdbus org.mpris.amarok
/Player Prev", in_terminal=False)
def get_description(self):
return _("Jump to previous track in Amarok")
def get_icon_name(self):
return "media-skip-backward"
class AmarokSource (AppLeafContentMixin, Source):
appleaf_content_id = "Amarok"
source_user_reloadable = True
def __init__(self):
Source.__init__(self, _("Amarok"))
def get_items(self):
yield Play()
yield Stop()
yield Pause()
yield Next()
yield Previous()
def get_description(self):
return __description__
def get_icon_name(self):
return "Amarok"
def provides(self):
yield RunnableLeaf
"
The next one I am planning (apart from improving this one) is to
control the general volume (Mute, Volume Up....)
any suggestion or critic is welcome...
cheers
Rafael Brundo Uriarte
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]