aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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