def ajax_volume(cmd): vol = int(pympc.lastStatus["status"]["volume"]) if cmd == "down": pympc.genericSingle("setvol", [vol - 5]) elif cmd == "up": pympc.genericSingle("setvol", [vol + 5]) elif cmd == "mute": global __mutedVolume __mutedVolume = vol pympc.genericSingle("setvol", [0]) elif cmd == "unmute": pympc.genericSingle("setvol", [vol])
def ajax_pl_addStream(): pympc.genericSingle("add", [request.form["stream"]]) return ""
def ajax_pl_delete(track): pympc.genericSingle("delete", [track])
def ajax_toggle(flag): val = 1 - int(pympc.lastStatus["status"][flag]) pympc.genericSingle(flag, [val])
def ajax_stats(): res = pympc.genericSingle("stats")[1] res["load"] = repr(os.getloadavg()) return res
def ajax_play(track): pympc.genericSingle("play", [track])
def ajax_stop(): pympc.genericSingle("stop")
def ajax_prev(): pympc.genericSingle("previous")
def ajax_pause(pause): pympc.genericSingle("pause", [pause])
def ajax_next(): pympc.genericSingle("next")
def ajax_pl_replace(name): pympc.genericSingle("clear") pympc.genericSingle("load", [name]) return ""
def ajax_pl_load(name): pympc.genericSingle("load", [name]) return ""
def ajax_pl_add(uri): pympc.genericSingle("add", [uri]) return ""
def ajax_pl_save(): pympc.genericSingle("save", [request.form["name"]]) return ""