aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLibravatar Waishnav <waishnavdeore@gmail.com>2022-03-15 16:02:23 +0530
committerLibravatar Waishnav <waishnavdeore@gmail.com>2022-03-15 16:02:23 +0530
commit7754fe414354ba8cea2cb86e3a269b01f509e9d4 (patch)
tree6d3e7491b4128567c4eb0443569d4138ff74f6bd /src
parentca6527e70cc125383c2b2b85f741b1f4fb92ab1b (diff)
downloadshopno-os-log-sync-7754fe414354ba8cea2cb86e3a269b01f509e9d4.tar.gz
shopno-os-log-sync-7754fe414354ba8cea2cb86e3a269b01f509e9d4.zip
fixing issue in watch_log | occurs is file doesn't exist
Diffstat (limited to 'src')
-rwxr-xr-xsrc/Watcher/watch_log.py15
-rwxr-xr-xsrc/bin/watcher1
-rw-r--r--src/service/watcher.service10
3 files changed, 7 insertions, 19 deletions
diff --git a/src/Watcher/watch_log.py b/src/Watcher/watch_log.py
index ad4a4fd..5fca72f 100755
--- a/src/Watcher/watch_log.py
+++ b/src/Watcher/watch_log.py
@@ -35,6 +35,13 @@ def append_line_in_csv(date, closed_time, window_name):
afk = False
def log_creation():
global afk
+
+ filename = "/home/"+os.getlogin()+"/.cache/Watcher/raw_data/"+get_date()+".csv"
+ if not(os.path.isfile(filename)):
+ with open(filename, 'a') as csvfile:
+ csvwriter = csv.writer(csvfile, delimiter='\t')
+ csvwriter.writerow([get_time(), "00:00:00", "User-logged-in"])
+
append_line_in_csv(get_date(), get_time(), "User-logged-in")
while True:
previous_window = x.active_window()
@@ -48,13 +55,5 @@ def log_creation():
afk_closed_time = get_time()
append_line_in_csv(date, afk_closed_time, "AFK")
-
if __name__ == "__main__":
- os.popen('''python /usr/share/Watcher/week_analysis.py''')
- filename = "/home/"+os.getlogin()+"/.cache/Watcher/raw_data/"+get_date()+".csv"
- if not(os.path.isfile(filename)):
- with open(filename, 'a') as csvfile:
- csvwriter = csv.writer(csvfile, delimiter='\t')
- csvwriter.writerow([get_time(), "00:00:00", ""])
-
log_creation()
diff --git a/src/bin/watcher b/src/bin/watcher
index 506fa8c..2d4551e 100755
--- a/src/bin/watcher
+++ b/src/bin/watcher
@@ -3,7 +3,6 @@
import os
import sys
sys.path.insert(0, "/usr/share/Watcher/")
-import argparse
import watch_log as x
from colored_text import Color
import commands as cmd
diff --git a/src/service/watcher.service b/src/service/watcher.service
deleted file mode 100644
index 90bd2a8..0000000
--- a/src/service/watcher.service
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Get the perspective from Watcher about your Screen-Time
-
-[Service]
-ExecStart=/bin/python /usr/share/Watcher/watch_log.py
-Type=simple
-Restart=on-failure
-
-[Install]
-WantedBy=multi-user.target