add page title
This commit is contained in:
@@ -53,7 +53,7 @@ fun getChapterList(mangaId: Int): List<ChapterDataClass> {
|
||||
}
|
||||
}
|
||||
|
||||
fun getPages(chapterId: Int, mangaId: Int): List<PageDataClass> {
|
||||
fun getPages(chapterId: Int, mangaId: Int): Pair<ChapterDataClass, List<PageDataClass>> {
|
||||
return transaction {
|
||||
val chapterEntry = ChapterTable.select { ChapterTable.id eq chapterId }.firstOrNull()!!
|
||||
assert(mangaId == chapterEntry[ChapterTable.manga].value) // sanity check
|
||||
@@ -67,12 +67,24 @@ fun getPages(chapterId: Int, mangaId: Int): List<PageDataClass> {
|
||||
}
|
||||
).toBlocking().first()
|
||||
|
||||
return@transaction pagesList.map {
|
||||
val chapter = ChapterDataClass(
|
||||
chapterEntry[ChapterTable.id].value,
|
||||
chapterEntry[ChapterTable.url],
|
||||
chapterEntry[ChapterTable.name],
|
||||
chapterEntry[ChapterTable.date_upload],
|
||||
chapterEntry[ChapterTable.chapter_number],
|
||||
chapterEntry[ChapterTable.scanlator],
|
||||
mangaId
|
||||
)
|
||||
|
||||
val pages = pagesList.map {
|
||||
PageDataClass(
|
||||
it.index,
|
||||
getTrueImageUrl(it, source)
|
||||
)
|
||||
}
|
||||
|
||||
return@transaction Pair(chapter, pages)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ fun getMangaList(sourceId: Long, pageNum: Int = 1, popular: Boolean): List<Manga
|
||||
|
||||
MangaDataClass(
|
||||
mangaEntityId,
|
||||
sourceId.toLong(),
|
||||
sourceId,
|
||||
|
||||
manga.url,
|
||||
manga.title,
|
||||
|
||||
@@ -80,3 +80,17 @@ fun getSourceList(): List<SourceDataClass> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getSource(sourceId: Long): SourceDataClass {
|
||||
return transaction {
|
||||
val source = SourceTable.select { SourceTable.id eq sourceId }.firstOrNull()!!
|
||||
|
||||
return@transaction SourceDataClass(
|
||||
source[SourceTable.id].value.toString(),
|
||||
source[SourceTable.name],
|
||||
Locale(source[SourceTable.lang]).getDisplayLanguage(Locale(source[SourceTable.lang])),
|
||||
ExtensionsTable.select { ExtensionsTable.id eq source[SourceTable.extension] }.first()[ExtensionsTable.iconUrl],
|
||||
getHttpSource(source[SourceTable.id].value).supportsLatest
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user