rastabrew

git clone https://git.tarina.org/rastabrew
Log | Files | Refs

commit 63952699f0b4684299064399a8b9d7274cc4de26
parent cdcf1e6de0b0e47855c2b36476a145371bad5d64
Author: rob <rob@tarina.org>
Date:   Sat, 27 Aug 2022 13:00:25 +0300

yo yo

Diffstat:
Mride_on.py | 42+++++++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/ride_on.py b/ride_on.py @@ -17,11 +17,11 @@ db_local = basedir+'rastabrew.db' db = web.database(dbn='sqlite', db=db_local) db2 = web.database(dbn=config.dbn, host=config.host, user=config.user, port=config.port, db=config.db, pw=config.pw) -os.system('pkill -9 brew1') -os.system('pkill -9 brew2') -time.sleep(1) -os.system(basedir + 'brew1 &') -os.system(basedir + 'brew2 &') +#os.system('pkill -9 brew1') +#os.system('pkill -9 brew2') +#time.sleep(1) +#os.system(basedir + 'brew1 &') +#os.system(basedir + 'brew2 &') term = Terminal() @@ -36,17 +36,25 @@ with Onewire('u') as o: def read_givarna(): brew1 = 0 brew2 = 0 - try: - f = open("/dev/shm/brew1", "r") - brew1 = f.read() - except: - print('could not read file') - try: - f = open("/dev/shm/brew2", "r") - brew2 = f.read() - except: - print('could not read file') - return int(brew1), int(brew2) + while True: + try: + f = open("/dev/shm/brew1", "r") + brew1 = f.read() + except: + print('could not read file') + try: + f = open("/dev/shm/brew2", "r") + brew2 = f.read() + except: + print('could not read file') + try: + brew1 = int(brew1) + brew2 = int(brew2) + except: + print('fuck') + pass + if type(brew1) == int and type(brew2) == int: + return brew1, brew2 def is_webz_on(): try: @@ -100,7 +108,7 @@ def save_givare(addbubs, viken): brew1_old, brew2_old = read_givarna() totbubs1 = load_givare('brew1').brew1 totbubs2 = load_givare('brew2').brew2 - +brew1, brew2 = read_givarna() while True: brew1, brew2 = read_givarna() if brew1_old < brew1: