class XMMS2USM: def __init__(self): self.ml = gobject.MainLoop(None, False) self.xmms = xmmsclient.XMMS("ubuntu-sound-menu") try: self.xmms.connect(os.getenv("XMMS_PATH"), self.dieme) except IOError, detail: print "Connection failed:", detail sys.exit(1) self.conn = xmmsclient.glib.GLibConnector(self.xmms) self.confdir = xmmsclient.userconfdir_get() self.dbus = DBusGMainLoop(set_as_default=True) """self.xmms.playback_current_id(self.my_current_id)""" self.xmms.broadcast_playback_status(self.update_playback_status) self.xmms.broadcast_playback_current_id(self.update_nowplaying) self.sound_menu = SoundMenuControls('xmms2') self.sound_menu._sound_menu_next = self._sound_menu_next self.sound_menu._sound_menu_previous = self._sound_menu_previous self.sound_menu._sound_menu_is_playing = self._sound_menu_is_playing self.sound_menu._sound_menu_play = self._sound_menu_play self.sound_menu._sound_menu_pause = self._sound_menu_pause self.sound_menu._sound_menu_raise = self._sound_menu_raise self.playback_status = False timeout_add_seconds(1, self.firstupdate) self.ml.run()
def __init__(self): self.__at = AlbumThing() self.__cfg = ConfigParser.ConfigParser() self.__configuration_file = os.path.join(xmmsclient.userconfdir_get(), 'clients', 'AlbumThing.ini') # defaults self.__cfg.add_section('common') self.__cfg.set('common', 'start_xmms2d', '0') self.__cfg.add_section('ui') self.__cfg.set('ui', 'show_cover_art', '1') self.__cfg.set('ui', 'show_alternative_cover_art', '0') self.__cfg.set('ui', 'combine_va_albums', '1') self.__cfg.add_section('win') self.__cfg.set('win', 'width', '500') self.__cfg.set('win', 'height', '600') self.__cfg.set('win', 'pos_x', '0') self.__cfg.set('win', 'pos_y', '0') self.__cfg.set('win', 'pos_hpaned', '160') self.__cfg.add_section('behaviour') self.__cfg.set('behaviour', 'random_album', '0') try: fd = open (self.__configuration_file, 'r') self.__cfg.readfp(fd) except IOError: pass
def __init__(self): xmmsDirectory = xmmsclient.userconfdir_get() configPath = os.path.join(xmmsDirectory, "clients/openboxMenu/configPresets.ini") self.errorMessage = None self.config = ConfigParser.RawConfigParser() try: result = self.config.read(configPath) if len(result) != 1: self.errorMessage = 'Preset file not found' except ConfigParser.ParsingError as error: self.errorMessage = 'Preset file parsing error'
def __init__(self, path=None): if not path: confdir = xmmsclient.userconfdir_get() path = os.path.join(confdir, 'clients', 'ccx2') try: os.makedirs(path) except OSError: pass path = os.path.join(path, 'ccx2.conf') if not os.path.exists(path): try: print >> sys.stderr, 'no config file found, making default one in %s' % path f = open(path, 'w') print >> f, DEFAULT_CONFIG f.close() except Exception, e: print >> sys.stderr, 'error while writing config file: %s' % e path = None
def __init__(self): self._current = -1 self._server = None self._artist = "" self._album = "" self._title = "" self._tracknr = None self._duration = None self._date = None self._genre = None self._playtime = 0 self._start = False self._albumart = None # Stores the result of the currently queried media info and playtime self._media_info_res = None self._confdir = os.path.join(xmmsclient.userconfdir_get(), 'clients', XMMS2.CLIENT_NAME) Control.__init__(self)
## ## You should have received a copy of the GNU General Public License ## along with nymp. If not, see <http://www.gnu.org/licenses/>. ## ############################################################################## from xmmsclient import userconfdir_get import os import os.path import json from nymp.defaults import defaults CONF_DIR = os.path.join(userconfdir_get(), "clients", "nymp") cache = {} def load_config(name): fn = os.path.join(CONF_DIR, name + ".json") if os.path.exists(fn): try: f = open(fn, 'r') cache[name] = json.load(f) except: logging.exception("Unable to load configuration") cache[name] = None finally: f.close()
print "no picture" print "" def plugin_list_cb(result): for i in result.get_list(): print i.get('shortname'), i.get('description') def xform_media_browse_cb(result): print result.get_type() print result.get_dict() def sigint_callback(signal, frame) : xc.exit_loop() print xmmsclient.userconfdir_get() signal.signal(signal.SIGINT, sigint_callback) xc = xmmsclient.XMMS () while True: try: print 'trying to connect..' xc.connect() break except IOError: pass #res = xc.signal_playback_playtime(pt_callback)
def get_config_dir(): """Get configuration directory according to XMMS2 guideline""" return join(userconfdir_get(), "clients", CLIENT_ID)
def plugin_list_cb(result): for i in result.get_list(): print i.get('shortname'), i.get('description') def xform_media_browse_cb(result): print result.get_type() print result.get_dict() def sigint_callback(signal, frame): xc.exit_loop() print xmmsclient.userconfdir_get() signal.signal(signal.SIGINT, sigint_callback) xc = xmmsclient.XMMS() while True: try: print 'trying to connect..' xc.connect() break except IOError: pass #res = xc.signal_playback_playtime(pt_callback) res = xc.broadcast_playback_current_id(playback_current_id_cb) xc.playback_current_id(playback_current_id_cb)