mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-17 09:43:33 -05:00
add support for Extensions Lib 1.4 (#496)
* Support extensions lib 1.4 * Fix build * Support UpdateStrategy * Update extension lib min/max to match Tachiyomi * Use HttpSource.getMangaUrl and add Chapter.realUrl
This commit is contained in:
@@ -35,6 +35,9 @@ data class ChapterDataClass(
|
||||
/** the date we fist saw this chapter*/
|
||||
val fetchedAt: Long,
|
||||
|
||||
/** the website url of this chapter*/
|
||||
val realUrl: String? = null,
|
||||
|
||||
/** is chapter downloaded */
|
||||
val downloaded: Boolean,
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ package suwayomi.tachidesk.manga.model.dataclass
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import eu.kanade.tachiyomi.source.model.UpdateStrategy
|
||||
import suwayomi.tachidesk.manga.impl.util.lang.trimAll
|
||||
import suwayomi.tachidesk.manga.model.table.MangaStatus
|
||||
import java.time.Instant
|
||||
@@ -38,6 +39,8 @@ data class MangaDataClass(
|
||||
var lastFetchedAt: Long? = 0,
|
||||
var chaptersLastFetchedAt: Long? = 0,
|
||||
|
||||
var updateStrategy: UpdateStrategy = UpdateStrategy.ALWAYS_UPDATE,
|
||||
|
||||
val freshData: Boolean = false,
|
||||
var unreadCount: Long? = null,
|
||||
var downloadCount: Long? = null,
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.jetbrains.exposed.sql.select
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
import suwayomi.tachidesk.manga.impl.Chapter.getChapterMetaMap
|
||||
import suwayomi.tachidesk.manga.model.dataclass.ChapterDataClass
|
||||
import suwayomi.tachidesk.manga.model.table.MangaTable.nullable
|
||||
|
||||
object ChapterTable : IntIdTable() {
|
||||
val url = varchar("url", 2048)
|
||||
@@ -29,6 +30,9 @@ object ChapterTable : IntIdTable() {
|
||||
|
||||
val sourceOrder = integer("source_order")
|
||||
|
||||
/** the real url of a chapter used for the "open in WebView" feature */
|
||||
val realUrl = varchar("real_url", 2048).nullable()
|
||||
|
||||
val isDownloaded = bool("is_downloaded").default(false)
|
||||
|
||||
val pageCount = integer("page_count").default(-1)
|
||||
@@ -38,21 +42,22 @@ object ChapterTable : IntIdTable() {
|
||||
|
||||
fun ChapterTable.toDataClass(chapterEntry: ResultRow) =
|
||||
ChapterDataClass(
|
||||
chapterEntry[id].value,
|
||||
chapterEntry[url],
|
||||
chapterEntry[name],
|
||||
chapterEntry[date_upload],
|
||||
chapterEntry[chapter_number],
|
||||
chapterEntry[scanlator],
|
||||
chapterEntry[manga].value,
|
||||
chapterEntry[isRead],
|
||||
chapterEntry[isBookmarked],
|
||||
chapterEntry[lastPageRead],
|
||||
chapterEntry[lastReadAt],
|
||||
chapterEntry[sourceOrder],
|
||||
chapterEntry[fetchedAt],
|
||||
chapterEntry[isDownloaded],
|
||||
chapterEntry[pageCount],
|
||||
transaction { ChapterTable.select { manga eq chapterEntry[manga].value }.count().toInt() },
|
||||
getChapterMetaMap(chapterEntry[id])
|
||||
id = chapterEntry[id].value,
|
||||
url = chapterEntry[url],
|
||||
name = chapterEntry[name],
|
||||
uploadDate = chapterEntry[date_upload],
|
||||
chapterNumber = chapterEntry[chapter_number],
|
||||
scanlator = chapterEntry[scanlator],
|
||||
mangaId = chapterEntry[manga].value,
|
||||
read = chapterEntry[isRead],
|
||||
bookmarked = chapterEntry[isBookmarked],
|
||||
lastPageRead = chapterEntry[lastPageRead],
|
||||
lastReadAt = chapterEntry[lastReadAt],
|
||||
index = chapterEntry[sourceOrder],
|
||||
fetchedAt = chapterEntry[fetchedAt],
|
||||
realUrl = chapterEntry[realUrl],
|
||||
downloaded = chapterEntry[isDownloaded],
|
||||
pageCount = chapterEntry[pageCount],
|
||||
chapterCount = transaction { ChapterTable.select { manga eq chapterEntry[manga].value }.count().toInt() },
|
||||
meta = getChapterMetaMap(chapterEntry[id])
|
||||
)
|
||||
|
||||
@@ -8,6 +8,7 @@ package suwayomi.tachidesk.manga.model.table
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.UpdateStrategy
|
||||
import org.jetbrains.exposed.dao.id.IntIdTable
|
||||
import org.jetbrains.exposed.sql.ResultRow
|
||||
import suwayomi.tachidesk.manga.impl.Manga.getMangaMetaMap
|
||||
@@ -42,31 +43,34 @@ object MangaTable : IntIdTable() {
|
||||
|
||||
val lastFetchedAt = long("last_fetched_at").default(0)
|
||||
val chaptersLastFetchedAt = long("chapters_last_fetched_at").default(0)
|
||||
|
||||
val updateStrategy = varchar("update_strategy", 256).default(UpdateStrategy.ALWAYS_UPDATE.name)
|
||||
}
|
||||
|
||||
fun MangaTable.toDataClass(mangaEntry: ResultRow) =
|
||||
MangaDataClass(
|
||||
mangaEntry[this.id].value,
|
||||
mangaEntry[sourceReference].toString(),
|
||||
id = mangaEntry[this.id].value,
|
||||
sourceId = mangaEntry[sourceReference].toString(),
|
||||
|
||||
mangaEntry[url],
|
||||
mangaEntry[title],
|
||||
proxyThumbnailUrl(mangaEntry[this.id].value),
|
||||
mangaEntry[MangaTable.thumbnailUrlLastFetched],
|
||||
url = mangaEntry[url],
|
||||
title = mangaEntry[title],
|
||||
thumbnailUrl = proxyThumbnailUrl(mangaEntry[this.id].value),
|
||||
thumbnailUrlLastFetched = mangaEntry[thumbnailUrlLastFetched],
|
||||
|
||||
mangaEntry[initialized],
|
||||
initialized = mangaEntry[initialized],
|
||||
|
||||
mangaEntry[artist],
|
||||
mangaEntry[author],
|
||||
mangaEntry[description],
|
||||
mangaEntry[genre].toGenreList(),
|
||||
Companion.valueOf(mangaEntry[status]).name,
|
||||
mangaEntry[inLibrary],
|
||||
mangaEntry[inLibraryAt],
|
||||
artist = mangaEntry[artist],
|
||||
author = mangaEntry[author],
|
||||
description = mangaEntry[description],
|
||||
genre = mangaEntry[genre].toGenreList(),
|
||||
status = Companion.valueOf(mangaEntry[status]).name,
|
||||
inLibrary = mangaEntry[inLibrary],
|
||||
inLibraryAt = mangaEntry[inLibraryAt],
|
||||
meta = getMangaMetaMap(mangaEntry[id].value),
|
||||
realUrl = mangaEntry[realUrl],
|
||||
lastFetchedAt = mangaEntry[lastFetchedAt],
|
||||
chaptersLastFetchedAt = mangaEntry[chaptersLastFetchedAt]
|
||||
chaptersLastFetchedAt = mangaEntry[chaptersLastFetchedAt],
|
||||
updateStrategy = UpdateStrategy.valueOf(mangaEntry[updateStrategy])
|
||||
)
|
||||
|
||||
enum class MangaStatus(val value: Int) {
|
||||
|
||||
Reference in New Issue
Block a user