Exemplo n.º 1
0
    global orchestra_thread
    while orchestra_thread.is_alive():
        time.sleep(0.1)

server = Server(options)
count = 0
while True:
    sessiondir = options.sessiondirs[count % len(options.sessiondirs)]
    logfilename = "%s/session.log" % sessiondir
    print "playing %s" % sessiondir

    tr_log = TrLogReader(logfilename, options.torrentname,
                         realtime=options.realtime,
                         pretend_sequential=options.pretend_sequential).get_log()
    tr_log.ignore_non_downloaded_files()

    orchestra = Orchestra(sessiondir, tr_log, options)
    server.set_orchestra(orchestra)

    if not options.realtime and len(orchestra.chunks) == 0:
        raise Exception("No chunks to play. Unsupported file format?")

    play()
    wait_for_play_completion_or_interruption()

    print "completed playback"

    time.sleep(options.pause)
    orchestra.reset()
    count += 1