Add support for opds-pse for undownloaded chapters (#1278)

* Add OPDS page streaming for undownloaded chapters

* Add [D] in chapter title prefix when isDownloaded

* Removed Chapter.isDownloaded check in query for other opds endpoints

* Add chapter progression tracking for streaming and refactor code

* dd  Unicode for chapters with 0 pages [post pageRefresh]

* Add Library Updates feed and remove redundant metadata fetching for OPDS chapters and manga

* Address PR comments & add chapter markAsRead for cbzDownload

* Address PR comment/s

* Rem. markAsRead for chapter download

* Rem. markAsRead for chapter download

---------

Co-authored-by: ShowY <showypro@gmail.com>
This commit is contained in:
Shirish
2025-03-08 22:01:07 +05:30
committed by GitHub
parent 3be165a551
commit 95d9293fe0
13 changed files with 427 additions and 143 deletions

View File

@@ -278,6 +278,31 @@ object OpdsV1Controller {
},
)
var chapterMetadataFeed =
handler(
pathParam<Int>("mangaId"),
pathParam<Int>("chapterId"),
documentWith = {
withOperation {
summary("OPDS Chapter Details Feed")
description("OPDS feed for a specific undownloaded chapter of a manga")
}
},
behaviorOf = { ctx, mangaId, chapterId ->
ctx.future {
future {
Opds.getChapterMetadataFeed(mangaId, chapterId, BASE_URL)
}.thenApply { xml ->
ctx.contentType(OPDS_MIME).result(xml)
}
}
},
withResults = {
httpCode(HttpStatus.OK)
httpCode(HttpStatus.NOT_FOUND)
},
)
// Specific Source Feed
val sourceFeed =
handler(
@@ -407,4 +432,28 @@ object OpdsV1Controller {
httpCode(HttpStatus.NOT_FOUND)
},
)
// Main Library Updates Feed
val libraryUpdatesFeed =
handler(
queryParam<Int?>("pageNumber"),
documentWith = {
withOperation {
summary("OPDS Library Updates Feed")
description("OPDS feed listing recent manga chapter updates")
}
},
behaviorOf = { ctx, pageNumber ->
ctx.future {
future {
Opds.getLibraryUpdatesFeed(BASE_URL, pageNumber ?: 1)
}.thenApply { xml ->
ctx.contentType(OPDS_MIME).result(xml)
}
}
},
withResults = {
httpCode(HttpStatus.OK)
},
)
}