diff options
author | 2023-03-22 15:50:09 +0600 | |
---|---|---|
committer | 2023-03-22 16:43:38 +0600 | |
commit | 46cb28417cff9220836e5e4aad62e54aad0b5351 (patch) | |
tree | 4ffb2246bb0d0653c0c0fb765e3f801097ce1367 /misc | |
parent | 695623e4f60f7937e53cd3be0c921ff40edaca82 (diff) | |
download | shopno-os-log-sync-46cb28417cff9220836e5e4aad62e54aad0b5351.tar.gz shopno-os-log-sync-46cb28417cff9220836e5e4aad62e54aad0b5351.zip |
path: Use `xdg.BaseDirectory` to get cache path
Signed-off-by: Mubashshir <ahmubashshir@gmail.com>
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/export_to_2.0 | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/misc/export_to_2.0 b/misc/export_to_2.0 index ef30ffe..d6fe65c 100755 --- a/misc/export_to_2.0 +++ b/misc/export_to_2.0 @@ -5,12 +5,11 @@ sys.path.insert(0, "/usr/share/Watcher/") import csv from watch_log import get_date import datetime +import files import time_operations as to def extract_data(date): - user = os.getlogin() - path = "/home/" + user +"/.cache/Watcher/raw_data/" - filename = path + date + ".csv" + filename = files.raw_log(date) l = list() # l = list of (app_name, time spent on app on that session) d = dict() @@ -64,7 +63,7 @@ def final_report(window_opened, time_spent): def export_to_new(date): window_opened, time_spent = extract_data(date) sorted_report = final_report(window_opened, time_spent) - filename = "/home/"+os.getlogin()+"/.cache/Watcher/daily_data/"+date+".csv" + filename = files.daily_log(date) overwrite_Data = [] with open(filename, 'w') as csvfile: for x,y in sorted_report.items(): @@ -76,8 +75,6 @@ def export_to_new(date): del sorted_report del overwrite_Data -path = "/home/" + os.getlogin() +"/.cache/Watcher/raw_data/" +path = os.path.dirname(files.raw_log('empty')) for file in os.listdir(path): export_to_new(file[:-4]) - - |