This commit is contained in:
parent
123803d619
commit
c39bd1ce53
1 changed files with 13 additions and 2 deletions
|
@ -7,6 +7,16 @@ from time import sleep
|
|||
from buba.bubacmd import BubaCmd
|
||||
|
||||
|
||||
WEEKDAYS_DE = [
|
||||
"Mo",
|
||||
"Di",
|
||||
"Mi",
|
||||
"Do",
|
||||
"Fr",
|
||||
"Sa",
|
||||
"So"
|
||||
]
|
||||
|
||||
class BubaAnimation:
|
||||
def __init__(self, buba: BubaCmd):
|
||||
self.log = logging.getLogger(type(self).__name__)
|
||||
|
@ -42,13 +52,14 @@ class BubaAnimation:
|
|||
now_delta = dt - now
|
||||
day_delta = dt - from_day_start
|
||||
if now_delta < timedelta(seconds=60):
|
||||
return "now"
|
||||
return "jetzt"
|
||||
if now_delta < timedelta(minutes=30):
|
||||
return f"{int(now_delta.seconds / 60)}m"
|
||||
if day_delta < timedelta(hours=24):
|
||||
return f"{int((now_delta.seconds + 3599) / 3600)}h"
|
||||
if day_delta < timedelta(days=7):
|
||||
return dt.strftime("%a") # weekday
|
||||
# return dt.strftime("%a") # weekday
|
||||
return WEEKDAYS_DE[dt.weekday()]
|
||||
return dt.strftime("%d.%m.")
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue