Skip to content

feat(opds): ask before overwriting a book already on SD - #56

Merged
prokrypt merged 1 commit into
developmentfrom
claude/project-thread-poetck
Sep 27, 2026
Merged

prokrypt merged 1 commit into
developmentfrom
claude/project-thread-poetck

Conversation

@prokrypt

Copy link
Copy Markdown
Owner

Before: downloading a book from the OPDS browser silently replaced a copy already on the SD card.

After: when the book is already there, the browser asks "Book already on SD card. Overwrite?" and shows the existing file's size and modification date (for example "2.3 MB, 2026-09-27 09:08"). Cancel is selected by default. Confirm downloads and replaces the file through the existing .part staging, so a failed download still keeps the old copy.

How: requestDownload opens the destination read-only. That one lookup gives existence, size and the FAT modification time, and nothing is written to SD unless the user confirms. The size is formatted with integer math. The FAT date is decoded by hand (no strftime) and validated with DaylightSaving::isValidDate. The prompt reuses ConfirmationActivity. The download path is computed once and passed to downloadBook.

Size: default (C3) +1,224 B flash, x4-pro-light-sleep +1,184 B flash; static RAM (.data/.bss) is unchanged on both.

Test: download a book, then select it again. The prompt should appear. Cancel keeps the old file, and Confirm replaces it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XgLRarbAmBVepTPKCK7mgd


Generated by Claude Code

Before downloading, open the destination read-only; if a book is already
there, show a Cancel/Confirm dialog (Cancel focused) with its size and FAT
modification date, formatted by hand without strftime. No SD writes unless
the user confirms. The download path is computed once and passed through.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XgLRarbAmBVepTPKCK7mgd
@prokrypt
prokrypt merged commit f8214b8 into development Sep 27, 2026
9 checks passed
@prokrypt
prokrypt deleted the claude/project-thread-poetck branch September 27, 2026 17:51
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.

2 participants