aboutsummaryrefslogtreecommitdiff
path: root/src/Watcher/analysis.py
diff options
context:
space:
mode:
authorLibravatar Mubashshir <[email protected]>2023-03-22 15:50:09 +0600
committerLibravatar Mubashshir <[email protected]>2023-03-22 16:43:38 +0600
commit46cb28417cff9220836e5e4aad62e54aad0b5351 (patch)
tree4ffb2246bb0d0653c0c0fb765e3f801097ce1367 /src/Watcher/analysis.py
parent695623e4f60f7937e53cd3be0c921ff40edaca82 (diff)
downloadshopno-os-log-sync-46cb28417cff9220836e5e4aad62e54aad0b5351.tar.gz
shopno-os-log-sync-46cb28417cff9220836e5e4aad62e54aad0b5351.zip
path: Use `xdg.BaseDirectory` to get cache path
Signed-off-by: Mubashshir <[email protected]>
Diffstat (limited to '')
-rwxr-xr-xsrc/Watcher/analysis.py7
1 files changed, 3 insertions, 4 deletions
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")
-