From 46cb28417cff9220836e5e4aad62e54aad0b5351 Mon Sep 17 00:00:00 2001 From: Mubashshir Date: Wed, 22 Mar 2023 15:50:09 +0600 Subject: path: Use `xdg.BaseDirectory` to get cache path Signed-off-by: Mubashshir --- src/Watcher/analysis.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/Watcher/analysis.py') diff --git a/src/Watcher/analysis.py b/src/Watcher/analysis.py index 0e917f8..d43b1b4 100755 --- a/src/Watcher/analysis.py +++ b/src/Watcher/analysis.py @@ -3,11 +3,11 @@ import csv from watch_log import get_date import datetime import time_operations as to +import files # creating dictionary to store time spend on each applicaitons on that particular day def final_report(date): - path = "/home/" + os.getlogin() +"/.cache/Watcher/daily_data/" - filename = path + date + ".csv" + filename = files.daily_log(date) report = dict() if os.path.isfile(filename): @@ -64,7 +64,7 @@ def weekday_from_date(date): def weekly_logs(week = str(os.popen('''date +"W%V-%Y"''').read()[0:-1])): user = os.getlogin() - filename = "/home/"+user+"/.cache/Watcher/Analysis/"+week+".csv" + filename = files.weekly_log(week) with open(filename, "w") as csvfile: csvwriter = csv.writer(csvfile, delimiter='\t') @@ -95,4 +95,3 @@ def weekly_logs(week = str(os.popen('''date +"W%V-%Y"''').read()[0:-1])): #testing if __name__ == "__main__": weekly_logs("W29-2022") - -- cgit v1.2.3