Fix wrapped-course false positive in picker; add build version display

Sort Unsorted's destination picker still listed a course whose real
video content sat two levels deep inside its own "display name"
folder (a common release-bundle extraction shape), alongside empty
leftover folders from the extraction that neither of the two earlier
exclusion checks could safely rule out - an empty folder is
indistinguishable from a legitimate freshly-created category. Detect
this case by comparing token similarity between a folder's own name
and its single course child's name: high overlap means they're naming
the same thing (a redundant wrapper), not a deliberate category
holding one course.

Also bake the build's git commit + build time into the Docker image
(git rev-parse at build time, .git deleted again immediately after) so
a push's effect on the running container is actually visible - shown
on the Settings page and in /health - instead of having to guess
whether a webhook rebuild picked up the latest commit.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-24 13:52:32 -04:00
co-authored by Claude Sonnet 5
parent 7fbe63e05c
commit 8d1ce72372
5 changed files with 111 additions and 16 deletions
+12 -2
View File
@@ -5,8 +5,9 @@ FROM python:3.13.5-slim-bookworm
WORKDIR /app
# ffprobe (from ffmpeg) reads each video's duration for the library
# browser's "how long is this course" display
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg \
# browser's "how long is this course" display; git is only needed
# transiently below, to bake this build's commit into the image
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg git \
&& rm -rf /var/lib/apt/lists/*
# copy the dependencies file to the working directory
@@ -19,6 +20,15 @@ RUN pip install -r requirements.txt
# copy the content of the local src directory to the working directory
COPY . .
# Record which commit and when this image was built, so the running app
# can show it (Settings page, /health) - a full-image-rebuild webhook
# deploy gives no other visible confirmation that a push actually landed
# in the running container. .git is removed right after so the image
# doesn't carry the repo's full history.
RUN (git rev-parse --short HEAD 2>/dev/null || echo unknown) > /app/BUILD_VERSION \
&& date -u +"%Y-%m-%d %H:%M UTC" >> /app/BUILD_VERSION \
&& rm -rf /app/.git
EXPOSE 5000
# add healthcheck using Python standard library