예제 #1
0
def stopper():
    stop = get_field("stop")
    if stop:
        player.kill()
        return simplepage(body = "%s stopped." % song)
    else:
        f = Form()
        f.add_submit("stop", "Stop")
        return simplepage(body= ("Playing %s" % song) +
                          f.render())
예제 #2
0
def selector(songs):
    global player, song
    chosen = get_field("select")
    if chosen:
        song = chosen
        player = play(song)
        redirect("stopper") # works with Mozilla, but not with lynx/elinks
    else:
        f = Form()
        f.add_single_select("select", options=songs)
        f.add_submit("play", "Play!")
        return f.render()