From f16b8b468f6c3db750aad477183fb0727a0fb792 Mon Sep 17 00:00:00 2001 From: Tero Vuotila Date: Thu, 15 Sep 2016 16:48:45 +0300 Subject: [PATCH] Minimalistic design --- coffee.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/coffee.py b/coffee.py index e2133f4..4d71131 100755 --- a/coffee.py +++ b/coffee.py @@ -11,10 +11,11 @@ cups = data['current'] / 10 brewed_at_datetime = datetime.datetime.strptime(data['brewed_at'], '%Y-%m-%d %H:%M:%S.%f') brewed_at = brewed_at_datetime.strftime('%H:%M') +ago = int((datetime.datetime.now() - brewed_at_datetime).total_seconds()/60) if cups > 0: - print (':coffee:' * cups, 'brewed ', brewed_at) + print('%sX:coffee:%smin' % (cups, ago)) else: - print ('empty pan, last brew', brewed_at) + print(':x:%smin' % ago) # Notify when new pan