Refactored
This commit is contained in:
+5
-8
@@ -5,7 +5,7 @@ from jay_diff import jay_merge_full
|
||||
|
||||
BASE = "/media/jens/cifs/jens@moon/projects/we_collect/results"
|
||||
VIN = 'WVWZZZE1ZMP010760'
|
||||
NICK = 'alex'
|
||||
USER = 'alex'
|
||||
YEAR = 2024
|
||||
MONTH = 10
|
||||
DAY = ['20', '21', '22']
|
||||
@@ -103,7 +103,8 @@ def convert(timestamp_str: str, pattern: str = "%Y-%m-%dT%H:%M:%S.%f%z"):
|
||||
return result
|
||||
|
||||
|
||||
path = os.path.join(BASE, VIN)
|
||||
path = os.path.join(BASE, USER)
|
||||
path = os.path.join(path, VIN)
|
||||
path = os.path.join(path, str(YEAR))
|
||||
path = os.path.join(path, str(MONTH))
|
||||
|
||||
@@ -123,12 +124,8 @@ for day in day_list:
|
||||
day_path = os.path.join(month_path, day)
|
||||
|
||||
# Sort out files with unknown nickname
|
||||
file_list = []
|
||||
for filename in os.listdir(day_path):
|
||||
if NICK in filename:
|
||||
file_list.append(filename)
|
||||
|
||||
file_list_sorted = sorted(file_list, key=lambda f: convert(f, pattern=f"{VIN}_{NICK}_%Y-%m-%dT%H-%M-%S.json"))
|
||||
file_list = os.listdir(day_path)
|
||||
file_list_sorted = sorted(file_list, key=lambda f: convert(f, pattern=f"records_%Y-%m-%dT%H-%M-%S.json"))
|
||||
print("Files in '", day_path, "' :")
|
||||
# prints all files
|
||||
print(file_list_sorted)
|
||||
|
||||
Reference in New Issue
Block a user