mirror of
https://github.com/gotson/komga.git
synced 2026-02-14 19:33:02 +01:00
fix(opds): prepend position for series in ordered collection
This commit is contained in:
parent
b89e3b2ebb
commit
7e5a1412ca
1 changed files with 8 additions and 4 deletions
|
|
@ -319,7 +319,9 @@ class OpdsController(
|
|||
if (!collection.ordered) series.sortedBy { it.metadata.titleSort }
|
||||
else series
|
||||
|
||||
val entries = sorted.map { it.toOpdsEntry() }
|
||||
val entries = sorted.mapIndexed { index, it ->
|
||||
it.toOpdsEntry(if (collection.ordered) index + 1 else null)
|
||||
}
|
||||
|
||||
OpdsFeedNavigation(
|
||||
id = collection.id.toString(),
|
||||
|
|
@ -336,14 +338,16 @@ class OpdsController(
|
|||
}
|
||||
|
||||
|
||||
private fun SeriesWithInfo.toOpdsEntry(): OpdsEntryNavigation =
|
||||
OpdsEntryNavigation(
|
||||
title = metadata.title,
|
||||
private fun SeriesWithInfo.toOpdsEntry(prepend: Int? = null): OpdsEntryNavigation {
|
||||
val pre = prepend?.let { decimalFormat.format(it) + " - " } ?: ""
|
||||
return OpdsEntryNavigation(
|
||||
title = pre + metadata.title,
|
||||
updated = series.lastModifiedDate.atZone(ZoneId.systemDefault()) ?: ZonedDateTime.now(),
|
||||
id = series.id.toString(),
|
||||
content = "",
|
||||
link = OpdsLinkFeedNavigation(OpdsLinkRel.SUBSECTION, "${routeBase}series/${series.id}")
|
||||
)
|
||||
}
|
||||
|
||||
private fun BookWithInfo.toOpdsEntry(prependNumber: Boolean): OpdsEntryAcquisition {
|
||||
val mediaTypes = media.pages.map { it.mediaType }.distinct()
|
||||
|
|
|
|||
Loading…
Reference in a new issue