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