import xmmsclient import xmmsclient.glib as xg import xmmsclient.collections as xc import os import gobject loop = gobject.MainLoop() xmms = xmmsclient.XMMS("pygnt-test") xmms.connect(os.getenv("XMMS_PATH")) conn = xg.GLibConnector(xmms) def got_list_of_songs_in_pl(result): list = result.value() pos = 1 for song in list: def got_song_details(result): info = result.value() def safe(ar, at): try: return str(ar[at]) except: return "" position = str(pos) # XXX: This does NOT work title = safe(info, 'title') artist = safe(info, 'artist') album = safe(info, 'album') time = safe(info, 'time') # XXX: What should I really use? print position, " | ", title, " | ", artist, " | ", album, " | ", time # song is the medialib id xmms.medialib_get_info(song, got_song_details) pos = pos + 1 xmms.playlist_list_entries(None, got_list_of_songs_in_pl) loop.run()