diff --git a/pyproject.toml b/pyproject.toml index cfc7455..aa7de98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "file_auto_expiry" -version = "0.0.1" +version = "0.0.2" description = "WATCloud project containing scripts to check if directories / files are expired" readme = "README.md" requires-python = ">=3.7, <4" diff --git a/src/file_auto_expiry/utils/interface.py b/src/file_auto_expiry/utils/interface.py index 5d2d981..f4f3796 100644 --- a/src/file_auto_expiry/utils/interface.py +++ b/src/file_auto_expiry/utils/interface.py @@ -82,13 +82,17 @@ def collect_expired_file_information(folder_path, save_file, scrape_time, expiry write_jsonl_information(path_info, save_file, scrape_time, expiry_threshold) -def write_jsonl_information(dict_info, file_path, scrape_time, expiry_threshold): +def write_jsonl_information(dict_info, file_path, scrape_time, expiry_threshold=""): current_time = time.time() with open(file_path, "w") as file: - file.write(json.dumps({"scrape_time:": scrape_time, + if expiry_threshold=="": + file.write(json.dumps({"scrape_time:": scrape_time, + "scrape_time_datetime": str(datetime.datetime.fromtimestamp(scrape_time))}), + "\n") + else: + file.write(json.dumps({"scrape_time:": scrape_time, "scrape_time_datetime": str(datetime.datetime.fromtimestamp(scrape_time)), - "expiry_threshold": expiry_threshold}), + "\n") + "expiry_threshold": str(datetime.datetime.fromtimestamp(expiry_threshold))}) + "\n") file.write(json.dumps({"time_for_scrape_sec": current_time - scrape_time, "time_for_scrape_min": (current_time - scrape_time) / 60}) + "\n") @@ -139,4 +143,4 @@ def collect_creator_information(path_info_file, save_file, scrape_time): "uid": user[1], "gid": user[2]} - write_jsonl_information(creator_info, save_file, scrape_time, "") + write_jsonl_information(creator_info, save_file, scrape_time) \ No newline at end of file