Skip to content

Commit

Permalink
fix 2^8 bug where the 2nd part is all numeric
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonjchen committed Dec 22, 2024
1 parent 7acfd55 commit 20bc603
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ predict-bug-report-2024-09-01:
./cog/generate.sh
cog predict -i route="https://connect.comma.ai/a4653a9be878a408/00000029--e1c8705a52/132/144" -i renderType=ui

predict-bug-all-number:
./cog/generate.sh
cog predict -i route="https://connect.comma.ai/fe18f736cb0d7813/00000497--5809888120/1611/1635" -i renderType=ui


# Push using modified cog
push:
./cog/generate.sh
Expand Down
2 changes: 1 addition & 1 deletion clip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ fi
RECORDING_LENGTH=$_arg_length_seconds
RECORDING_LENGTH_PLUS_SMEAR=$(($RECORDING_LENGTH + $SMEAR_AMOUNT))
# Cleanup trailing segment count. Seconds is what matters
ROUTE=$(echo "$_arg_route_id" | sed -E 's/--[0-9]+$//g')
ROUTE=$(echo "$_arg_route_id" | sed -E 's/--[0-9]{1,4}$//g')
# Segment ID is the floor of the starting seconds divided by 60
SEGMENT_NUM=$(($STARTING_SEC / 60))
SEGMENT_ID="$ROUTE--$SEGMENT_NUM"
Expand Down
5 changes: 4 additions & 1 deletion downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ def downloadSegments(
# Examples:
# a2a0ccea32023010|2023-07-27--13-01-19 -> a2a0ccea32023010|2023-07-27--13-01-19
# a2a0ccea32023010|2023-07-27--13-01-19--5 -> a2a0ccea32023010|2023-07-27--13-01-19
route = re.sub(r"--\d+$", "", route_or_segment)
# Let through rare cases where the second part is fully numeric
print(f"Route or segment: {route_or_segment}")
route = re.sub(r"--\d{,4}+$", "", route_or_segment)
print(f"Downloading route {route}")
# Dongle ID is the part before the |
dongle_id = route.split("|")[0]

Expand Down

0 comments on commit 20bc603

Please sign in to comment.