From 47e7214bd7308fa2183b67ca1163204de6ca6bc6 Mon Sep 17 00:00:00 2001 From: rmsitz Date: Wed, 26 Aug 2026 10:58:01 -0400 Subject: [PATCH] Add progress/recently-added sort to Library browser The sort dropdown only had Name (A-Z/Z-A) - no way to surface "what did I just download" or "what am I closest to finishing" without scrolling. Adds Progress and Recently Added, backed by each course's completion_percentage and folder mtime (already/newly attached in list_library_directory and search_library_courses). Folders have neither, so they naturally sort to the end under these two modes. Co-Authored-By: Claude Sonnet 5 --- CHANGELOG.md | 1 + README.md | 3 ++- VERSION | 2 +- offlineu_core.py | 8 ++++++++ templates/course_dashboard.html | 18 +++++++++++++++--- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f66f08..04ee6cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +2026-08-26 14:57 UTC — Add progress/recently-added sort to Library browser 2026-08-26 14:45 UTC — Redesign expandable lists to a leaner, flat style 2026-08-26 14:27 UTC — Add expand all/collapse all to the course tree 2026-08-26 14:13 UTC — Header/footer polish, fix dead link, add focus rings diff --git a/README.md b/README.md index c7fb7b8..92b7815 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,8 @@ silently stay blank instead of erroring. **Library browsing** - Lazy-loading folder browser (grid or list view) with search, including an - opt-in transcript search across subtitle files + opt-in transcript search across subtitle files. Sortable by name, + progress, or how recently a course showed up in the library - Course cards show media file count, total video/audio runtime, and completion % at a glance - Cover art: uses a manually-placed `cover`/`folder`/`thumbnail`/`thumb`/ diff --git a/VERSION b/VERSION index 51b7f31..84544b0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2026-08-26 14:45 UTC — redesign expandable lists to a leaner, flat style +2026-08-26 14:57 UTC — add progress/recently-added sort to Library browser diff --git a/offlineu_core.py b/offlineu_core.py index 48fc718..a2fcde2 100644 --- a/offlineu_core.py +++ b/offlineu_core.py @@ -1288,6 +1288,10 @@ def list_library_directory(dir_path: str, skip_hidden: bool = True) -> Dict[str, item['hidden'] = is_hidden item['favorited'] = os.path.abspath(entry_path_str) in favorite_set item['completion_percentage'] = _course_completion_percentage(entry, item['media_files']) + try: + item['mtime'] = entry.stat().st_mtime + except OSError: + item['mtime'] = 0 items.append(item) else: if skip_hidden: @@ -2078,6 +2082,10 @@ def search_library_courses(query: str) -> List[Dict[str, Any]]: item = _course_summary(course) item['favorited'] = os.path.abspath(str(course)) in favorite_set item['completion_percentage'] = _course_completion_percentage(course, item['media_files']) + try: + item['mtime'] = course.stat().st_mtime + except OSError: + item['mtime'] = 0 results.append(item) return results diff --git a/templates/course_dashboard.html b/templates/course_dashboard.html index be6e6ac..56318f8 100644 --- a/templates/course_dashboard.html +++ b/templates/course_dashboard.html @@ -1243,6 +1243,8 @@