- c.schedule_add(now + 4, "normal", "play", track)
- print " waiting for it to play"
- waited = 0
- p = c.playing()
- while p is None and waited < 10:
- time.sleep(1)
- waited += 1
- p = c.playing()
- assert waited < 10, "checking track played within a reasonable period"
- assert waited > 2, "checking track didn't play immediately"
+ when = now() + 3
+ c.schedule_add(when, "normal", "play", track)
+ print " disorder schedule-list output:"
+ print string.join(dtest.command(["disorder",
+ "--config", disorder._configfile,
+ "--no-per-user-config",
+ "schedule-list"]), ""),
+ p = next_playing(c)
+ assert p["track"] == track, "checking right track played"
+ assert int(p["when"]) >= when, "checking track played at right time"
+ assert c.schedule_list() == [], "checking schedule is empty"
+ wait_idle(c)
+ print " scheduling an enable-random for the future"
+ c.schedule_add(now() + 3, "junk", "set-global", "random-play", "yes")
+ print " disorder schedule-list output:"
+ print string.join(dtest.command(["disorder",
+ "--config", disorder._configfile,
+ "--no-per-user-config",
+ "schedule-list"]), ""),
+ next_playing(c)
+ print " disabling random play"
+ c.random_disable()
+ wait_idle(c)
+ print " scheduling track to play later via command line"
+ when = now() + 3
+ dtest.command(["disorder",
+ "--config", disorder._configfile,
+ "--no-per-user-config",
+ "schedule-play",
+ time.strftime("%Y-%m-%d %H:%M:%S",
+ time.localtime(when)),
+ "normal",
+ track])
+ print " disorder schedule-list output:"
+ print string.join(dtest.command(["disorder",
+ "--config", disorder._configfile,
+ "--no-per-user-config",
+ "schedule-list"]), ""),
+ p = next_playing(c)