This project processes trip data exported from Polarsteps.
Ensure you are using Python version 3.12
. You can check your Python version with:
python --version
Before running the project, create a virtual environment to manage dependencies:
python -m venv env
source env/bin/activate
Once the virtual environment is active, install the required packages:
pip install -r requirements.txt
Export your data from Polarsteps by following these instructions.
Once you have your Polarsteps data, copy only the trip data into the data/polarsteps-trip
folder. Ensure the file named trip.json
is located as follows:
data/polarsteps-trip/trip.json
You can now run the main script to process the trip data:
python src/main.py
Updating the photo order using the `your_trip_photos_by_pages.txt` file
The _photos_by_pages.txt
file is a critical component of managing and updating the layout of photos in your trip. It allows you to control how the photos are grouped by pages for each step of the trip.
The _photos_by_pages.txt
file consists of a sequence of steps followed by the layout of photos for each step. The format is as follows:
- Step Name: The name of the step appears on its own line.
- Photo Indexes: Each subsequent line lists the indices of photos that should be displayed together on a page. The photos for each page are separated by spaces (each index corresponds to a photo in the step).
- Empty Line: An empty line separates the different steps in the trip.
Here is an example of how the file might look:
Step 1: Day at the Beach
1 2
4 5
Step 2: Hiking in the Mountains
1 2
3
4 5
- "Step 1: Day at the Beach":
- The first page contains photos with indices 1, and 2.
- The second page contains photos with indices 4 and 5.
- "Step 2: Hiking in the Mountains":
- The first page contains photos 1 and 2.
- The second page contains photo 3.
- The third page contains photos 4, and 5.
If you want to change the layout of the photos in your trip, you can update the _photos_by_pages.txt
file directly. Here's how:
- Navigate to the directory where the file is saved (`data/`)
- Open the `_photos_by_pages.txt` file in a text editor.
- Find the step that you want to update by looking for the corresponding step name in the file.
- Modify the lines following the step name to adjust the photo layout.
- Each line represents a page of photos. List the photo indices (starting from 1) that you want on each page, separated by spaces.
- Make sure to maintain the empty line between steps.
Suppose you want to change the layout for "Step 1: Day at the Beach" such that:
- The first page should now have photos 1, and 4.
- The second page should have photos 2 and 3.
You would edit the file as follows:
Step 1: Day at the Beach
1 4
2 3
After making changes, ensure that:
- No Missing Photos: Every photo index within a step should be accounted for. Make sure you don’t miss any photos when rearranging the layout.
- Correct Indices: Use the correct photo indices. Photo indices start from 1 (not 0), and they correspond to the order of photos in each step.
- Consistent Formatting: Ensure there are no extra spaces or lines between the photo indices. Each step should be separated by an empty line.
Once you’ve updated and saved the _photos_by_pages.txt
file:
- Load the trip data in your application.
- The photo manager will read the updated
_photos_by_pages.txt
file and apply the new layout to the trip. - If any issues arise (e.g., a photo is missing), the system may revert to the default layout for that step, and you will be notified via console output.
- Missing or Incorrect Photo Indices: If you provide an index that doesn’t exist for a given step, or if any photos are missing from the layout, the system will use the default layout for the step and notify you with a message.
- Invalid File Format: Ensure the file format follows the described structure. Any deviation may result in errors or unintended behavior.
Using the _photos_by_pages.txt
file allows you to have complete control over how your trip photos are displayed. By organizing photo indices into pages, you can customize the photo layout per step, ensuring that your trip is displayed just the way you want it.