def _status(app): player = app.player window = app.window f = StringIO() if player.paused: strings = ["paused"] else: strings = ["playing"] strings.append(type(app.browser).__name__) strings.append("%0.3f" % player.volume) strings.append(window.order.get_active_name()) strings.append((window.repeat.get_active() and "on") or "off") progress = 0 if player.info: length = player.info.get("~#length", 0) if length: progress = player.get_position() / (length * 1000.0) strings.append("%0.3f" % progress) f.write(" ".join(strings) + "\n") try: f.write(app.browser.status + "\n") except AttributeError: pass return f.getvalue()
def _status(app): player = app.player f = StringIO() if player.paused: strings = ["paused"] else: strings = ["playing"] strings.append(type(app.browser).__name__) po = app.player_options strings.append("%0.3f" % player.volume) strings.append("shuffle" if po.shuffle else "inorder") strings.append("on" if po.repeat else "off") progress = 0 if player.info: length = player.info.get("~#length", 0) if length: progress = player.get_position() / (length * 1000.0) strings.append("%0.3f" % progress) f.write(" ".join(strings) + "\n") try: f.write(app.browser.status + "\n") except AttributeError: pass return f.getvalue()
def _dump_queue(app): window = app.window f = StringIO() for song in window.playlist.q.get(): f.write(song("~uri") + "\n") return f.getvalue()
def _dump_browsers(app): f = StringIO() for i, b in enumerate(browsers.browsers): f.write("%d. %s\n" % (i, browsers.name(b))) return f.getvalue()
def _dump_browsers(app): f = StringIO() for i, b in enumerate(browsers.browsers): if not b.is_empty: f.write("%d. %s\n" % (i, browsers.name(b))) return f.getvalue()