diff options
author | 2022-07-24 23:25:46 +0530 | |
---|---|---|
committer | 2022-07-24 23:25:46 +0530 | |
commit | ff34b6f351cf915d95c243115dfec8cb976e69b6 (patch) | |
tree | 43a05255ff7b35cd221a257ed405d96f9a46d05d /src/Watcher/watch_log.py | |
parent | 9a9c5b176997c1aec0c1c05a9fbe3d3cc26eff99 (diff) | |
download | shopno-os-log-sync-ff34b6f351cf915d95c243115dfec8cb976e69b6.tar.gz shopno-os-log-sync-ff34b6f351cf915d95c243115dfec8cb976e69b6.zip |
removing error of 3 min timeout due to AFK | updating acitve_window_title function
Diffstat (limited to 'src/Watcher/watch_log.py')
-rwxr-xr-x | src/Watcher/watch_log.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Watcher/watch_log.py b/src/Watcher/watch_log.py index 250670d..1316cd1 100755 --- a/src/Watcher/watch_log.py +++ b/src/Watcher/watch_log.py @@ -47,15 +47,23 @@ def log_creation(): if (y.returned_from_afk(afk, afkTimeout)): previous_window = "AFK" + opened_at = os.popen(" tail -n1 "+ filename).read().split("\t")[0] afk = False if (x.is_window_changed(previous_window, afk, afkTimeout) and not afk): if(y.is_afk(afkTimeout)): afk = True - closed_at = get_time() # for next_window its the opening time + # minimizing error + closed_at = time_difference("00:02:58", get_time()) + else: + closed_at = get_time() # for next_window its the opening time + date = get_date() filename = "/home/"+os.getlogin()+"/.cache/Watcher/raw_data/"+date+".csv" append_line_in_csv(date, opened_at, closed_at, previous_window) if __name__ == "__main__": - log_creation() + #log_creation() + filename = "/home/"+os.getlogin()+"/.cache/Watcher/raw_data/"+get_date()+".csv" + opened_at = os.popen(" tail -n1 "+ filename).read().split("\t")[0] + print(opened_at) |