Crops will now be split into subdirectories based on their city and label type. Instead of
crop_temp_<city-id>_<user-id>_<temp-label-id>_<label-type>.png, they will be stored as
<city-id>/<label-type>/crop_temp_<user-id>_<temp-label-id>.png.
Once this is on the servers, I will just need to run the following script to update all past data:
#!/bin/bash
# Prevents errors when no files are found.
shopt -s nullglob
# Loop over all cities.
for city in seattle-wa columbus-oh cdmx spgg pittsburgh-pa newberg-or chicago-il amsterdam la-piedad oradell-nj validation-study zurich taipei new-taipei-tw keelung-tw auckland cuenca crowdstudy burnaby teaneck-nj walla-walla-wa; do
# Loop over all label types.
for label_type in CurbRamp NoCurbRamp Obstacle SurfaceProblem NoSidewalk Crosswalk Signal Occlusion Other; do
# Create the necessary dir.
mkdir -p "${city}/${label_type}"
# Loop over all files matching the pattern if any exist.
for file in crop_temp_${city}_*_${label_type}.png; do
# Extract the piece of the filename that we keep.
user_and_temp_id=$(basename "$file" | sed "s/crop_temp_${city}_\(.*\)_${label_type}\.png/\1/")
# Construct the destination path.
dest_path="${city}/${label_type}/crop_temp_${user_and_temp_id}.png"
# Move the file.
mv "$file" "$dest_path"
done
done
done
Things to check before submitting the PR
[x] I've written a descriptive PR title.
[x] I've added/updated comments for large or confusing blocks of code.
Resolves #3502
Crops will now be split into subdirectories based on their city and label type. Instead of
crop_temp_<city-id>_<user-id>_<temp-label-id>_<label-type>.png
, they will be stored as<city-id>/<label-type>/crop_temp_<user-id>_<temp-label-id>.png
.Once this is on the servers, I will just need to run the following script to update all past data:
Things to check before submitting the PR