mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2024-12-25 16:21:50 +01:00
reformat
This commit is contained in:
parent
c200785479
commit
320d7e2536
@ -31,10 +31,10 @@ object Chapter {
|
|||||||
val source = getHttpSource(mangaDetails.sourceId.toLong())
|
val source = getHttpSource(mangaDetails.sourceId.toLong())
|
||||||
|
|
||||||
val chapterList = source.fetchChapterList(
|
val chapterList = source.fetchChapterList(
|
||||||
SManga.create().apply {
|
SManga.create().apply {
|
||||||
title = mangaDetails.title
|
title = mangaDetails.title
|
||||||
url = mangaDetails.url
|
url = mangaDetails.url
|
||||||
}
|
}
|
||||||
).awaitSingle()
|
).awaitSingle()
|
||||||
|
|
||||||
val chapterCount = chapterList.count()
|
val chapterCount = chapterList.count()
|
||||||
@ -73,33 +73,35 @@ object Chapter {
|
|||||||
val dbChapterList = transaction { ChapterTable.selectAll() }
|
val dbChapterList = transaction { ChapterTable.selectAll() }
|
||||||
|
|
||||||
dbChapterList.forEach {
|
dbChapterList.forEach {
|
||||||
(it[ChapterTable.chapterIndex] >= chapterList.size
|
(
|
||||||
|| chapterList[it[ChapterTable.chapterIndex]].url != it[ChapterTable.url])
|
it[ChapterTable.chapterIndex] >= chapterList.size ||
|
||||||
|
chapterList[it[ChapterTable.chapterIndex]].url != it[ChapterTable.url]
|
||||||
|
)
|
||||||
|
|
||||||
ChapterTable.deleteWhere { ChapterTable.id eq it[ChapterTable.id] }
|
ChapterTable.deleteWhere { ChapterTable.id eq it[ChapterTable.id] }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val dbChapterMap = transaction { ChapterTable.selectAll() }
|
val dbChapterMap = transaction { ChapterTable.selectAll() }
|
||||||
.associateBy({ it[ChapterTable.url] }, { it })
|
.associateBy({ it[ChapterTable.url] }, { it })
|
||||||
|
|
||||||
chapterList.mapIndexed { index, it ->
|
chapterList.mapIndexed { index, it ->
|
||||||
|
|
||||||
val dbChapter = dbChapterMap.getValue(it.url)
|
val dbChapter = dbChapterMap.getValue(it.url)
|
||||||
|
|
||||||
ChapterDataClass(
|
ChapterDataClass(
|
||||||
it.url,
|
it.url,
|
||||||
it.name,
|
it.name,
|
||||||
it.date_upload,
|
it.date_upload,
|
||||||
it.chapter_number,
|
it.chapter_number,
|
||||||
it.scanlator,
|
it.scanlator,
|
||||||
mangaId,
|
mangaId,
|
||||||
|
|
||||||
dbChapter[ChapterTable.isRead],
|
dbChapter[ChapterTable.isRead],
|
||||||
dbChapter[ChapterTable.isBookmarked],
|
dbChapter[ChapterTable.isBookmarked],
|
||||||
dbChapter[ChapterTable.lastPageRead],
|
dbChapter[ChapterTable.lastPageRead],
|
||||||
|
|
||||||
chapterCount - index,
|
chapterCount - index,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,10 +118,10 @@ object Chapter {
|
|||||||
val source = getHttpSource(mangaEntry[MangaTable.sourceReference])
|
val source = getHttpSource(mangaEntry[MangaTable.sourceReference])
|
||||||
|
|
||||||
val pageList = source.fetchPageList(
|
val pageList = source.fetchPageList(
|
||||||
SChapter.create().apply {
|
SChapter.create().apply {
|
||||||
url = chapterEntry[ChapterTable.url]
|
url = chapterEntry[ChapterTable.url]
|
||||||
name = chapterEntry[ChapterTable.name]
|
name = chapterEntry[ChapterTable.name]
|
||||||
}
|
}
|
||||||
).awaitSingle()
|
).awaitSingle()
|
||||||
|
|
||||||
val chapterId = chapterEntry[ChapterTable.id].value
|
val chapterId = chapterEntry[ChapterTable.id].value
|
||||||
@ -146,19 +148,19 @@ object Chapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ChapterDataClass(
|
return ChapterDataClass(
|
||||||
chapterEntry[ChapterTable.url],
|
chapterEntry[ChapterTable.url],
|
||||||
chapterEntry[ChapterTable.name],
|
chapterEntry[ChapterTable.name],
|
||||||
chapterEntry[ChapterTable.date_upload],
|
chapterEntry[ChapterTable.date_upload],
|
||||||
chapterEntry[ChapterTable.chapter_number],
|
chapterEntry[ChapterTable.chapter_number],
|
||||||
chapterEntry[ChapterTable.scanlator],
|
chapterEntry[ChapterTable.scanlator],
|
||||||
mangaId,
|
mangaId,
|
||||||
chapterEntry[ChapterTable.isRead],
|
chapterEntry[ChapterTable.isRead],
|
||||||
chapterEntry[ChapterTable.isBookmarked],
|
chapterEntry[ChapterTable.isBookmarked],
|
||||||
chapterEntry[ChapterTable.lastPageRead],
|
chapterEntry[ChapterTable.lastPageRead],
|
||||||
|
|
||||||
chapterEntry[ChapterTable.chapterIndex],
|
chapterEntry[ChapterTable.chapterIndex],
|
||||||
chapterCount.toInt(),
|
chapterCount.toInt(),
|
||||||
pageList.count()
|
pageList.count()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user