From 8c7724ecb9c9d12695e581be9fb417b13790a1e4 Mon Sep 17 00:00:00 2001 From: Tabledevil Date: Wed, 5 Mar 2025 20:38:35 +0100 Subject: [PATCH] Update create_gpx_tracks.py --- create_gpx_tracks.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/create_gpx_tracks.py b/create_gpx_tracks.py index d7d9fc4..4c584e5 100644 --- a/create_gpx_tracks.py +++ b/create_gpx_tracks.py @@ -168,7 +168,15 @@ def process_timeline_json(input_file): if not points: continue - output_file = f"track_{date}.gpx" + # Extract year and month from date (format: YYYY-MM-DD) + year, month, _ = date.split('-') + + # Create directory structure + dir_path = os.path.join(year, month) + os.makedirs(dir_path, exist_ok=True) + + # Update output file path + output_file = os.path.join(dir_path, f"track_{date}.gpx") print(f"Creating {output_file} with {len(points)} trackpoints...") # Sort points by timestamp