From 93f6a6fa6467215388f9cd024aff8528d925ce94 Mon Sep 17 00:00:00 2001 From: realraum Date: Mon, 26 Apr 2010 02:52:53 +0000 Subject: [PATCH] new panic, new nobodyhere --- switch-power.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/switch-power.py b/switch-power.py index 1d38e68..6b8b9f5 100755 --- a/switch-power.py +++ b/switch-power.py @@ -182,25 +182,25 @@ def eventNobodyHere(): logging.info("event: noone here, switching off: "+present_ids) for id in present_ids.split(" "): switchPower(id,False) + for id in present_ids.split(" "): + time.sleep(0.3) switchPower(id,False) def eventPanic(): logging.info("event: Panic:, switching around: "+uwscfg.slug_ids_panic) lst1 = uwscfg.slug_ids_panic.split(" ") - lst2 = lst1 - lst2.append(lst2.pop(0)) - #guarantee list has even number of elements by multiplying it with a factor of 2 - lst=zip(lst1,lst2) * 8 - lst2=None - switchPower(lst[0][0],True) - for (id1,id2) in lst: - switchPower(id2,True) - time.sleep(0.3) - switchPower(id1,False) - time.sleep(0.6) - for id in lst1: + lst2 = map(lambda e:[e,True], lst1) + for delay in map(lambda e: (40-e)/133.0,range(0,20)): + e = random.choice(lst2) + e[1]=not e[1] + switchPower(e[0],e[1]) + time.sleep(delay) + random.shuffle(lst1) + for rep in lst1: switchPower(id,False) + time.sleep(1.2) eventPresent() + ######################## -- 1.7.10.4