Skip to content

fix: reddit.sh symlink, subtitle CPU safety flag, broken batch command - #1

Open
emaag wants to merge 6 commits into
masterfrom
worktree-vmgr-scan-fixes
Open

fix: reddit.sh symlink, subtitle CPU safety flag, broken batch command#1
emaag wants to merge 6 commits into
masterfrom
worktree-vmgr-scan-fixes

Conversation

@emaag

@emaag emaag commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Carries forward in-progress work that was sitting uncommitted in the checkout: catalog scan/search implementation (catalog_drive, list_cataloged_drives, search_catalog), fzf-based directory/file pickers, and reddit CLI tab-completion.
  • lib/reddit.sh was committed as a broken symlink — git mode 120000 pointing to ../../lib/reddit.sh, which resolves outside the repo entirely. It only worked by accident on the original machine (a sibling checkout happened to exist at that path). Any fresh clone, CI run, or git worktree fails to source the reddit module. Replaced with the real file contents.
  • lib/subtitles.sh had lost its --fp16 False CPU safety flag, documented as preventing memory spikes on CPU-only Whisper runs. Root cause: tests/integration/test_subtitles.sh's mock whisper binary didn't recognize --fp16/--verbose, silently misparsing them as the input file and breaking 23/186 tests — a pre-existing failure already present at HEAD before any of this session's work. Fixed the mock's arg parser instead of leaving the safety flag stripped out.
  • The batch command was a silent no-op. Both vmgr batch <dir> (CLI) and "Batch Rename Multiple Folders" (interactive menu option 1) called batch_process_folders with zero arguments, which requires an operation name and a folder list — it always failed immediately and returned, while start_operation/end_operation still printed a "success" banner around it. Added batch_rename_interactive (mirroring the existing batch_flatten_interactive/batch_cleanup_interactive) for the menu path, and made the CLI path fail with a clear message instead of pretending to succeed.

Test plan

  • bash tests/run_tests.sh — 186/186 passing (was 23 failing at HEAD before these fixes)
  • ./video-manager-ultimate.sh --help loads all modules including reddit.sh cleanly
  • ./video-manager-ultimate.sh batch /tmp now exits 1 with a clear error instead of a false success banner
  • bash -n syntax check on all changed files

🤖 Generated with Claude Code

emaag and others added 6 commits July 15, 2026 13:19
… reddit.sh symlink and CPU subtitle safety flag

Carries forward in-progress work found uncommitted in the checkout
(catalog_drive/list_cataloged_drives/search_catalog implementations,
fzf-based directory/file pickers, reddit CLI completion) and fixes
issues found during a full scan of vmgr/:

- lib/reddit.sh was committed as a symlink to a path outside the repo
  (../../lib/reddit.sh), which only resolved by accident on the
  original author's machine. Any fresh clone, CI run, or worktree
  failed to source the reddit module. Replaced with the real file.
- lib/subtitles.sh had lost the --fp16 False safety flag for CPU
  runs (documented as preventing memory spikes). It was dropped
  because tests/integration/test_subtitles.sh's mock whisper didn't
  recognize --fp16/--verbose and silently mis-parsed args as a
  result — 23/186 tests were already failing at HEAD before this
  work. Fixed the mock instead of removing the safety flag.
- The batch CLI/menu path called batch_process_folders with no
  operation or folders, so "Batch Rename" (menu option 1) and
  `vmgr batch <dir>` were permanent silent no-ops that still printed
  a success banner. Added batch_rename_interactive (mirroring the
  existing flatten/cleanup wrappers) and made the CLI path fail
  clearly instead of pretending to succeed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Base model was a weak default for anyone with a GPU. Medium fits
comfortably in 8GB VRAM (e.g. RTX 4060 laptop) with a solid
accuracy/speed tradeoff; falls back to CPU automatically via
detect_gpu() if no GPU is present, just slower per file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…on image-sparse pages

Two bugs found while investigating reports of the reddit downloader
behaving unreliably:

- lib/ui.sh: the output-directory prompt used pick_directory(), which
  only accepts paths that already exist. Since the whole point is
  choosing a new folder to download into, any custom path typed by
  the user was silently discarded in favor of the auto-computed
  default with no warning — images landed somewhere other than what
  was asked for. Reverted to a plain prompt (this is what it was
  before the fzf-picker refactor; pick_directory is correct for the
  other menus that pick *existing* dirs, just not this one).

- lib/reddit.sh: download_subreddit_images() treated a "hot" listing
  page with zero direct-image posts as the end of the subreddit and
  stopped pagination entirely, even when the Reddit API's `after`
  token indicated more pages existed. Any subreddit with a run of
  text/video/link posts ahead of image posts in the hot ordering
  would return 0 downloads. Now only the `after` token (Reddit's own
  end-of-listing signal) terminates the loop; a page with no matching
  images just moves on to the next one. Verified with a mocked
  two-page fetch (page 1: no images, page 2: one image) — previously
  stopped at page 1 with 0 downloaded, now correctly finds the image
  on page 2.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Every menu selection previously needed a digit + Enter, and every
completed action forced a "Press Enter to continue..." pause — two
required keystrokes per step, all the way down.

- run_menu_loop() (lib/core.sh) now reads one keystroke via
  `read -rsn1` instead of a full line, so choosing a menu option is
  a single keypress. Added an opt-out 4th arg (single_key) for the
  one menu with two-digit options (Subtitles, up to 11) which still
  needs line-based input; every other menu defaults to single-key.
- interactive_menu() (lib/ui.sh) — the top-level main menu — had its
  own separate read loop that didn't go through run_menu_loop at all
  and was still Enter-based; switched it to the same single-keystroke
  read for consistency.
- Added pause_for_user() (lib/core.sh), a single-keystroke "Press any
  key to continue..." helper, and replaced all 70 Enter-requiring
  `read -p "Press Enter to continue..."` call sites in lib/ui.sh with
  it.

Verified end-to-end over a real pty: bare 'Q' with no Enter exits
immediately (status 0, ~0s), bare digit keys open/leave submenus
instantly, and a bare keystroke dismisses the post-action pause.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The single-keystroke work only touched run_menu_loop() call sites.
Three nested menus inside _handle_subtitles_choice() and one inside
_handle_catalog_choice() build their own screen and read the choice
directly with a bare `read -r`, bypassing run_menu_loop entirely —
they kept requiring digit + Enter while every menu around them now
responds to a single keystroke. Reported as "it hangs": pressing a
digit and waiting (as trained by the rest of the app) just sits there
until Enter is pressed.

Converted all of them to single-keystroke reads:
- Advanced Subtitle Settings (adv_choice) and its nested Filters &
  Selection submenu (filter_choice)
- Whisper model/format pickers in Configure Subtitle Settings
  (model_choice, format_choice — lang_choice stays line-based, it's
  a typed language code, not a menu pick)
- Catalog Settings (setting_choice)

Advanced Subtitle Settings has 11 options, which doesn't fit
single-digit selection, so items 10 and 11 (Set Max Files, Configure
Filters & Selection) are relabeled [M] and [F] instead of renumbered
— same options, letter keys instead of two-digit numbers, so the
whole menu can go single-keystroke without ambiguity.

Verified live over a pty: Main Menu -> Subtitles -> Advanced Settings
-> bare '1' with no Enter now toggles GPU acceleration immediately
and shows the post-action pause, matching every other menu.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
handle_subtitles() was left at single_key=false out of caution while
fixing the nested Advanced Settings menu, based on an earlier scan
that found options up to "11" inside _handle_subtitles_choice() —
but those belonged to the nested adv_choice case (inside branch 4),
not this function's own top-level case statement, which only ever
matches 1-6. Now that adv_choice reads independently as a single
keystroke (previous commit), there's no reason this outer menu needs
Enter. Flipped to single_key=true (the default).

Verified live over tmux: Main Menu -> '2' -> Subtitles menu -> '4' ->
Advanced Settings -> '1' -> GPU toggled instantly, all bare
keystrokes, no Enter anywhere in the chain.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@emaag
emaag marked this pull request as ready for review July 15, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant