Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for opds-pse for undownloaded chapters #1278

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

ShirishSaxena
Copy link

@ShirishSaxena ShirishSaxena commented Feb 22, 2025

Relates to #1265.

Changes

  • Added OPDS-PSE support for undownloaded chapters.
  • Modified GET chapter/{{chapterId}/download to create a CBZ file for folder downloads.
  • Removed manga descriptions from chapter entries to reduce XML size for manga with very long descriptions. Each chapter entry now returns the manga title, chapter name, and the scanlator.
  • Adds unicodes as a prefix to chapter titles in the OPDS feed when the chapter is has been read, in progress, or not started.
  • Page streaming now updates the lastPageRead for chapter

Notes

  • OPDS-PSE doesn't work without pageCount, and the redirected endpoint also fails even if we return a hardcoded count in the chapter entry. So, added a check in ChapterForDownload to update the PageTableList & PageCount only when there is a mismatch.
    -I tried making this call for all chapters in the paginated manga feed, but even with just 20 entries per page, it felt pretty slow. Plus, OPDS clients don’t really seem to support seamless chapter reading (KOReader definitely doesn’t). So instead, I added a separate “detail” page for each chapter when the page count is missing. This way, we can read undownloaded chapters, and if we revisit the chapter later, it won’t redirect us to the detail page again.

FYI: I use KOReader to read manga, so this entire modification is based on that.

KOReader screen recording for this change
Screenrecording_20250222_131141.mp4
KoReader with "D" as prefix for downloaded chapter Chapter 126 for Slime's manga was downloaded in a folder.

image

KOreader.mp4

@Robonau
Copy link
Contributor

Robonau commented Feb 22, 2025

@zeedif your input is probably welcomed here

@zeedif
Copy link
Contributor

zeedif commented Feb 22, 2025

@ShirishSaxena Thank you for the contribution. While the [D] prefix for downloaded chapters is functional, I find it creates visual inconsistency between prefixed and non-prefixed entries. We could use emoji pairs to indicate downloaded/undownloaded states while maintaining alignment:

Downloaded Chapter Emojis

  • Checkmark - Universal "completed" symbol
  • 📁 File Folder - Direct file reference
  • 💾 Floppy Disk - Classic "saved" metaphor
  • 📥 Inbox Tray - Content "received"
  • 🗃️ Card File Box - Organized storage
  • 🟢 Green Circle - Traffic light "go" system
  • ✔️ Heavy Checkmark - Definitive confirmation
  • 📦 Package - Contained/archived content
  • ⬇️ Down Arrow - Downloaded state
  • 🔒 Locked - Local secured access

Undownloaded Chapter Emojis

  • 🌐 Globe - Streaming from web
  • Hourglass - Pending action
  • ↗️ NE Arrow - External resource
  • ☁️ Cloud - Remote content
  • White Circle - Empty/unfilled state
  • 🔄 Arrows CW - Refresh/stream again
  • Dash - Minimal "not present"
  • ⏯️ Play/Pause - On-demand streaming
  • 🚀 Rocket - Instant access metaphor
  • 🔗 Link - Network dependency

@zeedif
Copy link
Contributor

zeedif commented Feb 22, 2025

I find the support for reading manga without downloading useful, as it saves the hassle of going to the web UI and downloading them manually. However, I wonder if it’s possible to mark a chapter as 'read' when accessed via OPDS. For example, triggering the 'read' status either after downloading its CBZ through OPDS or when reaching the last image via OPDS-PSE streaming.

@ShirishSaxena
Copy link
Author

@zeedif , I didn’t give much thought to the "[D]" identifier, and yeah, you’re right.
I added the Unicode characters that I felt were appropriate (Most I searched were sadly not supported by KOReader and this is my main goto...) for chapter progression in the Chapters feed. Now, each chapter feed goes to the chapterMetadata feed regardless of whether it’s downloaded or not, so adding a downloaded identifier didn’t make much sense anymore. We could possibly include it in the metadata page/feed...
Also, added page progression updates for PSE streaming. While it's possible to mark chapters as read whenever a download occurs through OPDS, I feel it doesn’t make sense. It makes more sense to have it in page streaming since we're actively reading there.

OPDS-PSE.-.Chapter.Progress.mp4

@zeedif
Copy link
Contributor

zeedif commented Feb 22, 2025

The implementation seems fine to me, though requiring a chapter "detail feed" adds unnecessary friction to the OPDS navigation flow. While I understand the current limitation of slow pageCount checks on paginated feeds, a longer-term solution would be to pre-fetch pageCount once during library addition or chapter discovery (e.g., background tasks when manga is added/updated). This would eliminate the need for the detail feed entirely.

@Syer10
Copy link
Collaborator

Syer10 commented Feb 22, 2025

The implementation seems fine to me, though requiring a chapter "detail feed" adds unnecessary friction to the OPDS navigation flow. While I understand the current limitation of slow pageCount checks on paginated feeds, a longer-term solution would be to pre-fetch pageCount once during library addition or chapter discovery (e.g., background tasks when manga is added/updated). This would eliminate the need for the detail feed entirely.

Pre-fetching page count is not possible, since that requires a request to the source and there are manga that have hundreds of chapters. Its not viable.

@ShirishSaxena
Copy link
Author

ShirishSaxena commented Feb 23, 2025

I think I have all the changes from my end, but let me know if I need to make any other changes... Final change also includes the library updates feed, similar to 'Updates' we have in the web UI & Android app.

LIbrary Feed SS

Screenshot_20250224_003448

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.

5 participants