Index: plugins_base/currentSong/__init__.py =================================================================== --- plugins_base/currentSong/__init__.py (revision 1391) +++ plugins_base/currentSong/__init__.py (working copy) @@ -26,6 +26,7 @@ from Rhythmbox import Rhythmbox from QuodLibet import QuodLibet from Listen import Listen + from Songbird import Songbird else: from Winamp import Winamp from CurrentSong import CurrentSong Index: plugins_base/currentSong/Songbird.py =================================================================== --- plugins_base/currentSong/Songbird.py (revision 0) +++ plugins_base/currentSong/Songbird.py (revision 0) @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- + +# This file is part of emesene. +# +# Emesene is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# emesene is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with emesene; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +VERSION = '0.1' +IFACE_NAME = 'org.mozilla.songbird' +IFACE_PATH = '/org/mozilla/songbird' + +import CurrentSong + +class Songbird( CurrentSong.DbusBase ): + '''Songbird Interface''' + + def __init__( self ): + CurrentSong.DbusBase.__init__( self, IFACE_NAME, self.setInterface ) + + try: self.iface + except: self.iface = None + + def setInterface( self ): + proxy_obj = self.bus.get_object( IFACE_NAME, IFACE_PATH ) + self.iface = self.module.Interface( proxy_obj, IFACE_NAME ) + +# def getCoverPath( self ): +# if self.iface: +# return self.iface.get_cover_path() +# else: +# return None + + def setCurrentSongData( self ): + if self.iface: + self.artist = self.iface.getArtist() + self.title = self.iface.getTitle() + self.album = self.iface.getAlbum() + + def getVersion( self ): + try: + self.iface.get_version() + except: + return False + + return True + + def isPlaying( self ): + if self.iface and self.iface.getStatus() == "playing": + return True + + return False + + def check( self ): + if not self.iface or not self.isNameActive(IFACE_NAME): + return + + if self.artist != self.iface.getArtist() or \ + self.title != self.iface.getTitle() or \ + self.album != self.iface.getAlbum(): + self.setCurrentSongData() + return True + + return False +