aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLibravatar Waishnav <waishnavdeore@gmail.com>2022-07-25 00:10:04 +0530
committerLibravatar Waishnav <waishnavdeore@gmail.com>2022-07-25 00:10:04 +0530
commitb530d773fe938297a235028f6f0e85a12aac0f47 (patch)
tree194a908c07366d4218d6e24fad3b4c92a7741453 /src
parentff34b6f351cf915d95c243115dfec8cb976e69b6 (diff)
downloadshopno-os-log-sync-b530d773fe938297a235028f6f0e85a12aac0f47.tar.gz
shopno-os-log-sync-b530d773fe938297a235028f6f0e85a12aac0f47.zip
AFK closed_at variable error if date got change
Diffstat (limited to 'src')
-rwxr-xr-xsrc/Watcher/watch_log.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Watcher/watch_log.py b/src/Watcher/watch_log.py
index 1316cd1..cc85a23 100755
--- a/src/Watcher/watch_log.py
+++ b/src/Watcher/watch_log.py
@@ -47,7 +47,11 @@ def log_creation():
if (y.returned_from_afk(afk, afkTimeout)):
previous_window = "AFK"
- opened_at = os.popen(" tail -n1 "+ filename).read().split("\t")[0]
+ if os.path.exists(filename):
+ opened_at = os.popen(" tail -n1 "+ filename).read().split("\t")[0]
+ else:
+ previous_date = os.popen("""date -d "1 day ago" '+%Y-%m-%d'""").read()[:-1]
+ opened_at = os.popen(" tail -n1 ~/.cache/Watcher/raw_data/"+previous_date+".csv").read().split("\t")[0]
afk = False
if (x.is_window_changed(previous_window, afk, afkTimeout) and not afk):