From 0627c2073939f0bad717d44149f880a9cf1c35e5 Mon Sep 17 00:00:00 2001 From: gileadmcgee Date: Thu, 22 Oct 2015 18:37:33 -0700 Subject: [PATCH] enabled turning off feed scripts --- scripts/watcher/config-example.py | 2 ++ scripts/watcher/watcher.py | 42 +++++++++++-------------------- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/scripts/watcher/config-example.py b/scripts/watcher/config-example.py index 3ed899ad..e35849cd 100644 --- a/scripts/watcher/config-example.py +++ b/scripts/watcher/config-example.py @@ -22,3 +22,5 @@ # the minute of each hour that you would like the feed script triggered. feed_script_time = 42 + +feed_script_active = False diff --git a/scripts/watcher/watcher.py b/scripts/watcher/watcher.py index 641ae15d..31624d0d 100644 --- a/scripts/watcher/watcher.py +++ b/scripts/watcher/watcher.py @@ -12,7 +12,11 @@ rpc = GrapheneWebsocket("localhost", 8092, "", "") - +def unlockWallet(): + if config.feed_script_active = True: + print("unlocking wallet") + rpc.unlock(config.wallet_password) + time.sleep(10) def closeScreens(): print("closing wallet") @@ -54,19 +58,13 @@ def watch(tries): if tries > 2: closeScreens() resync() - print("unlocking wallet") - rpc.unlock(config.wallet_password) - print("wallet unlocked") - time.sleep(30) + unlockWallet() tries = 0 return tries else: closeScreens() openScreens() - print("unlocking wallet") - rpc.unlock(config.wallet_password) - print("wallet unlocked") - time.sleep(30) + unlockWallet() tries += 1 return tries else: @@ -99,8 +97,7 @@ def checkTime(): crash = 0 closeScreens() openScreens() -print("unlocking wallet") -rpc.unlock(config.wallet_password) +unlockWallet() @@ -117,53 +114,44 @@ def checkTime(): crash = 0 closeScreens() resync() - print("unlocking wallet") - rpc.unlock(config.wallet_password) - print("wallet unlocked") + unlockWallet() else: crash += 1 print("error. restarting.") closeScreens() openScreens() - print("unlocking wallet") - rpc.unlock(config.wallet_password) - print("wallet unlocked") + unlockWallet() except: try: if crash > 2: crash = 0 closeScreen() resync() - print("unlocking wallet") - rpc.unlock(config.wallet_password) + unlockWallet() else: crash += 1 print("error... restarting") closeScreens() openScreens() - print("unlocking wallet") - rpc.unlock(config.wallet_password) + unlockWallet() except: try: if crash > 2: crash = 0 closeScreens() resync() - print("unlocking wallet") - rpc.unlock(config.wallet_password) + unlockWallet() else: crash += 1 print("error. restarting.") closeScreens() openScreens() - print("unlocking wallet") - rpc.unlock(config.wallet_password) + unlockWallet() except: crash = 0 closeScreens() resync() - print("unlocking wallet") - rpc.unlock(config.wallet_password) + unlockWallet()