diff options
Diffstat (limited to 'src/Watcher')
-rwxr-xr-x | src/Watcher/commands.py | 9 | ||||
-rwxr-xr-x | src/Watcher/watch_log.py | 1 | ||||
-rwxr-xr-x | src/Watcher/week_analysis.py | 6 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/Watcher/commands.py b/src/Watcher/commands.py index 4bbd8c2..6228133 100755 --- a/src/Watcher/commands.py +++ b/src/Watcher/commands.py @@ -12,7 +12,7 @@ def daily_summary(): rc.prints_report(window_opened, time_spent) def week_summary(): - W_Y = os.popen('''date +"W%U-%Y"''').read()[0:-1] + W_Y = os.popen('''date +"W%V-%Y"''').read()[0:-1] user = os.getlogin() filename = "/home/"+user+"/.cache/Watcher/Analysis/"+W_Y+".csv" with open(filename, 'r') as file: @@ -21,9 +21,9 @@ def week_summary(): app_usages = dict() for row in csvreader: if len(row[0]) == 3: - week_overview.update({row[0]:row[1]}) + week_overview.update({row[0]:row[1]}) # Weekday -- screen-time else: - app_usages.update({row[1]:row[0]}) + app_usages.update({row[1]:row[0]}) # app-name -- usage week_screen_time = "00:00:00" for x, y in week_overview.items(): @@ -43,3 +43,6 @@ def week_summary(): if x == "": x = "Home-Screen" print(" " + Color.GREEN(f'{x:<22}') + '\t ',f'{to.format_time(y):>12}') + +if __name__ == "__main__": + week_summary() diff --git a/src/Watcher/watch_log.py b/src/Watcher/watch_log.py index 98895bf..ad4a4fd 100755 --- a/src/Watcher/watch_log.py +++ b/src/Watcher/watch_log.py @@ -50,6 +50,7 @@ def log_creation(): 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: diff --git a/src/Watcher/week_analysis.py b/src/Watcher/week_analysis.py index 1f064b2..a82b5f3 100755 --- a/src/Watcher/week_analysis.py +++ b/src/Watcher/week_analysis.py @@ -10,7 +10,7 @@ def get_dates(): # The start of the week start = theday - datetime.timedelta(days=weekday) # build a simple range - dates = [start + datetime.timedelta(days=d) for d in range(weekday+1)] + dates = [start + datetime.timedelta(days=d) for d in range(weekday + 1)] dates = [str(d) for d in dates] return dates @@ -19,7 +19,7 @@ def weekday_from_date(date): day = os.popen('''date -d "'''+ date + '''" +%a''').read() return day[0:-1] -W_Y = os.popen('''date +"W%U-%Y"''').read()[0:-1] +W_Y = os.popen('''date +"W%V-%Y"''').read()[0:-1] user = os.getlogin() filename = "/home/"+user+"/.cache/Watcher/Analysis/"+W_Y+".csv" with open(filename, "w") as csvfile: @@ -39,7 +39,7 @@ with open(filename, "w") as csvfile: for i in dates: x, y = rc.extract_data(str(i)) - window_opened += x # smth is wrong here + window_opened += x time_spent += y for x, y in rc.final_report(window_opened, time_spent).items(): csvwriter.writerow([y, x]) |