mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-12 23:34:34 -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:
@@ -1,8 +0,0 @@
|
||||
package suwayomi.tachidesk.manga.impl.backup.models
|
||||
|
||||
class LibraryManga : MangaImpl() {
|
||||
|
||||
var unread: Int = 0
|
||||
|
||||
var category: Int = 0
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package suwayomi.tachidesk.manga.impl.backup.models
|
||||
|
||||
import eu.kanade.tachiyomi.source.model.UpdateStrategy
|
||||
import org.jetbrains.exposed.sql.ResultRow
|
||||
import suwayomi.tachidesk.manga.model.table.MangaTable
|
||||
|
||||
@@ -25,6 +26,8 @@ open class MangaImpl : Manga {
|
||||
|
||||
override var thumbnail_url: String? = null
|
||||
|
||||
override var update_strategy: UpdateStrategy = UpdateStrategy.ALWAYS_UPDATE
|
||||
|
||||
override var favorite: Boolean = false
|
||||
|
||||
override var last_update: Long = 0
|
||||
|
||||
@@ -7,6 +7,7 @@ package suwayomi.tachidesk.manga.impl.backup.proto
|
||||
* 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 okio.buffer
|
||||
import okio.gzip
|
||||
import okio.sink
|
||||
@@ -59,17 +60,18 @@ object ProtoBackupExport : ProtoBackupBase() {
|
||||
private fun backupManga(databaseManga: Query, flags: BackupFlags): List<BackupManga> {
|
||||
return databaseManga.map { mangaRow ->
|
||||
val backupManga = BackupManga(
|
||||
mangaRow[MangaTable.sourceReference],
|
||||
mangaRow[MangaTable.url],
|
||||
mangaRow[MangaTable.title],
|
||||
mangaRow[MangaTable.artist],
|
||||
mangaRow[MangaTable.author],
|
||||
mangaRow[MangaTable.description],
|
||||
mangaRow[MangaTable.genre]?.split(", ") ?: emptyList(),
|
||||
MangaStatus.valueOf(mangaRow[MangaTable.status]).value,
|
||||
mangaRow[MangaTable.thumbnail_url],
|
||||
TimeUnit.SECONDS.toMillis(mangaRow[MangaTable.inLibraryAt]),
|
||||
0 // not supported in Tachidesk
|
||||
source = mangaRow[MangaTable.sourceReference],
|
||||
url = mangaRow[MangaTable.url],
|
||||
title = mangaRow[MangaTable.title],
|
||||
artist = mangaRow[MangaTable.artist],
|
||||
author = mangaRow[MangaTable.author],
|
||||
description = mangaRow[MangaTable.description],
|
||||
genre = mangaRow[MangaTable.genre]?.split(", ") ?: emptyList(),
|
||||
status = MangaStatus.valueOf(mangaRow[MangaTable.status]).value,
|
||||
thumbnailUrl = mangaRow[MangaTable.thumbnail_url],
|
||||
dateAdded = TimeUnit.SECONDS.toMillis(mangaRow[MangaTable.inLibraryAt]),
|
||||
viewer = 0, // not supported in Tachidesk
|
||||
updateStrategy = UpdateStrategy.valueOf(mangaRow[MangaTable.updateStrategy])
|
||||
)
|
||||
|
||||
val mangaId = mangaRow[MangaTable.id].value
|
||||
|
||||
@@ -145,6 +145,7 @@ object ProtoBackupImport : ProtoBackupBase() {
|
||||
it[genre] = manga.genre
|
||||
it[status] = manga.status
|
||||
it[thumbnail_url] = manga.thumbnail_url
|
||||
it[updateStrategy] = manga.update_strategy.name
|
||||
|
||||
it[sourceReference] = manga.source
|
||||
|
||||
@@ -193,6 +194,7 @@ object ProtoBackupImport : ProtoBackupBase() {
|
||||
it[genre] = manga.genre ?: dbManga[genre]
|
||||
it[status] = manga.status
|
||||
it[thumbnail_url] = manga.thumbnail_url ?: dbManga[thumbnail_url]
|
||||
it[updateStrategy] = manga.update_strategy.name
|
||||
|
||||
it[initialized] = dbManga[initialized] || manga.description != null
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package suwayomi.tachidesk.manga.impl.backup.proto.models
|
||||
|
||||
import eu.kanade.tachiyomi.source.model.UpdateStrategy
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
import suwayomi.tachidesk.manga.impl.backup.models.ChapterImpl
|
||||
@@ -35,7 +36,8 @@ data class BackupManga(
|
||||
@ProtoNumber(101) var chapterFlags: Int = 0,
|
||||
@ProtoNumber(102) var brokenHistory: List<BrokenBackupHistory> = emptyList(),
|
||||
@ProtoNumber(103) var viewer_flags: Int? = null,
|
||||
@ProtoNumber(104) var history: List<BackupHistory> = emptyList()
|
||||
@ProtoNumber(104) var history: List<BackupHistory> = emptyList(),
|
||||
@ProtoNumber(105) var updateStrategy: UpdateStrategy = UpdateStrategy.ALWAYS_UPDATE
|
||||
) {
|
||||
fun getMangaImpl(): MangaImpl {
|
||||
return MangaImpl().apply {
|
||||
@@ -52,6 +54,7 @@ data class BackupManga(
|
||||
date_added = this@BackupManga.dateAdded
|
||||
viewer_flags = this@BackupManga.viewer_flags ?: this@BackupManga.viewer
|
||||
chapter_flags = this@BackupManga.chapterFlags
|
||||
update_strategy = this@BackupManga.updateStrategy
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user