Re: Plugin Amarok



Hi Rafael,

I've only recently posted a similar plugin on this list (Oct 22nd).
maybe we should try to combine the two?

Here's a list of things that I haven't figured out so far:

There are two things that I couldn't figure out:
- start amarok if not running and user hits "play" (via dbus)
- make sure Amarok does not show up twice in kupfer's menu. It shows
up once with the "Launch" option (like every normal application), and
a second time with the "Search Contents" option (that's my plugin).



cheers,
andreas

On Wed, Nov 17, 2010 at 12:24 AM, Rafael Brundo Uriarte
<rafael uriarte gmail com> wrote:
> 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
> _______________________________________________
> kupfer-list mailing list
> kupfer-list gnome org
> http://mail.gnome.org/mailman/listinfo/kupfer-list
>

Attachment: amarok.py
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]