Plugin Question
- From: Steve <steve thatbytes co uk>
- To: kupfer-list gnome org
- Subject: Plugin Question
- Date: Thu, 16 Jun 2011 17:06:58 +0100
I have wrote the plugin below:
from __future__ import absolute_import
__kupfer_name__ = _("Spotify")
__kupfer_sources__ = ("SpotifySource", )
__description__ = _("Control spofity media player.")
__version__ = "0.1"
__author__ = "Stephen Johnson <steve thatbytes co uk>"
import dbus
from kupfer.objects import RunnableLeaf, Source
from kupfer.obj.apps import AppLeafContentMixin
from kupfer import utils, icons, pretty
import pynotify
class PlayPause (RunnableLeaf):
def run(self):
RunnableLeaf.__init__(self, name=_("Play/Pause"))
session = dbus.SessionBus.get_session()
self.spotify =
session.get_object("org.mpris.MediaPlayer2.spotify","/org/mpris/MediaPlayer2")
self.spotify.PlayPause()
def get_description(self):
return _("Resume/Pause playback in Spotify")
def get_icon_name(self):
return "media-playback-start"
class Next (RunnableLeaf):
def __init__(self):
session = dbus.SessionBus.get_session()
self.spotify =
session.get_object("org.mpris.MediaPlayer2.spotify","/org/mpris/MediaPlayer2")
RunnableLeaf.__init__(self, name=_("Next"))
def run(self):
self.spotify.Next()
def get_description(self):
return _("Jump to next track in Spotify")
def get_icon_name(self):
return "media-skip-forward"
class Previous (RunnableLeaf):
def __init__(self):
RunnableLeaf.__init__(self, name=_("Previous"))
def run(self):
session = dbus.SessionBus.get_session()
self.spotify =
session.get_object("org.mpris.MediaPlayer2.spotify","/org/mpris/MediaPlayer2")
self.spotify.Previous()
def get_description(self):
return _("Jump to previous track in Previos")
def get_icon_name(self):
return "media-skip-backward"
class SpotifySource (AppLeafContentMixin, Source):
appleaf_content_id = 'spotify'
def __init__(self):
Source.__init__(self, _("Spotify"))
def get_items(self):
yield PlayPause()
yield Next()
yield Previous()
def provides(self):
yield RunnableLeaf
def get_description(self):
return __description__
def get_icon_name(self):
return "spotify"
Im just wondering how i can change its behaviour so that so its spotify
-> Next. Please forgive my ignorance but im finding the documentation
hard to get through.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]