Add support to update strategy on global update (#7902)

* Add support to update strategy.

* Add JavaDoc and bump the LIB_VERSION_MAX constant.

* Fix a word typo.

* Store update strategy enum as integer in the DB.
This commit is contained in:
Alessandro Jean 2022-09-25 11:12:36 -03:00 committed by GitHub
parent 29fa93e829
commit ba533f30ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 89 additions and 11 deletions

View file

@ -1,6 +1,7 @@
package eu.kanade.data package eu.kanade.data
import com.squareup.sqldelight.ColumnAdapter import com.squareup.sqldelight.ColumnAdapter
import eu.kanade.tachiyomi.source.model.UpdateStrategy
import java.util.Date import java.util.Date
val dateAdapter = object : ColumnAdapter<Date, Long> { val dateAdapter = object : ColumnAdapter<Date, Long> {
@ -18,3 +19,12 @@ val listOfStringsAdapter = object : ColumnAdapter<List<String>, String> {
} }
override fun encode(value: List<String>) = value.joinToString(separator = listOfStringsSeparator) override fun encode(value: List<String>) = value.joinToString(separator = listOfStringsSeparator)
} }
val updateStrategyAdapter = object : ColumnAdapter<UpdateStrategy, Long> {
private val enumValues by lazy { UpdateStrategy.values() }
override fun decode(databaseValue: Long): UpdateStrategy =
enumValues.getOrElse(databaseValue.toInt()) { UpdateStrategy.ALWAYS_UPDATE }
override fun encode(value: UpdateStrategy): Long = value.ordinal.toLong()
}

View file

@ -3,9 +3,10 @@ package eu.kanade.data.manga
import eu.kanade.domain.chapter.model.Chapter import eu.kanade.domain.chapter.model.Chapter
import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.Manga
import eu.kanade.tachiyomi.data.database.models.LibraryManga import eu.kanade.tachiyomi.data.database.models.LibraryManga
import eu.kanade.tachiyomi.source.model.UpdateStrategy
val mangaMapper: (Long, Long, String, String?, String?, String?, List<String>?, String, Long, String?, Boolean, Long?, Long?, Boolean, Long, Long, Long, Long) -> Manga = val mangaMapper: (Long, Long, String, String?, String?, String?, List<String>?, String, Long, String?, Boolean, Long?, Long?, Boolean, Long, Long, Long, Long, UpdateStrategy) -> Manga =
{ id, source, url, artist, author, description, genre, title, status, thumbnailUrl, favorite, lastUpdate, _, initialized, viewer, chapterFlags, coverLastModified, dateAdded -> { id, source, url, artist, author, description, genre, title, status, thumbnailUrl, favorite, lastUpdate, _, initialized, viewer, chapterFlags, coverLastModified, dateAdded, updateStrategy ->
Manga( Manga(
id = id, id = id,
source = source, source = source,
@ -23,12 +24,13 @@ val mangaMapper: (Long, Long, String, String?, String?, String?, List<String>?,
genre = genre, genre = genre,
status = status, status = status,
thumbnailUrl = thumbnailUrl, thumbnailUrl = thumbnailUrl,
updateStrategy = updateStrategy,
initialized = initialized, initialized = initialized,
) )
} }
val mangaChapterMapper: (Long, Long, String, String?, String?, String?, List<String>?, String, Long, String?, Boolean, Long?, Long?, Boolean, Long, Long, Long, Long, Long, Long, String, String, String?, Boolean, Boolean, Long, Float, Long, Long, Long) -> Pair<Manga, Chapter> = val mangaChapterMapper: (Long, Long, String, String?, String?, String?, List<String>?, String, Long, String?, Boolean, Long?, Long?, Boolean, Long, Long, Long, Long, UpdateStrategy, Long, Long, String, String, String?, Boolean, Boolean, Long, Float, Long, Long, Long) -> Pair<Manga, Chapter> =
{ _id, source, url, artist, author, description, genre, title, status, thumbnailUrl, favorite, lastUpdate, next_update, initialized, viewerFlags, chapterFlags, coverLastModified, dateAdded, chapterId, mangaId, chapterUrl, name, scanlator, read, bookmark, lastPageRead, chapterNumber, sourceOrder, dateFetch, dateUpload -> { _id, source, url, artist, author, description, genre, title, status, thumbnailUrl, favorite, lastUpdate, next_update, initialized, viewerFlags, chapterFlags, coverLastModified, dateAdded, updateStrategy, chapterId, mangaId, chapterUrl, name, scanlator, read, bookmark, lastPageRead, chapterNumber, sourceOrder, dateFetch, dateUpload ->
Manga( Manga(
id = _id, id = _id,
source = source, source = source,
@ -46,6 +48,7 @@ val mangaChapterMapper: (Long, Long, String, String?, String?, String?, List<Str
genre = genre, genre = genre,
status = status, status = status,
thumbnailUrl = thumbnailUrl, thumbnailUrl = thumbnailUrl,
updateStrategy = updateStrategy,
initialized = initialized, initialized = initialized,
) to Chapter( ) to Chapter(
id = chapterId, id = chapterId,
@ -63,8 +66,8 @@ val mangaChapterMapper: (Long, Long, String, String?, String?, String?, List<Str
) )
} }
val libraryManga: (Long, Long, String, String?, String?, String?, List<String>?, String, Long, String?, Boolean, Long?, Long?, Boolean, Long, Long, Long, Long, Long, Long, Long) -> LibraryManga = val libraryManga: (Long, Long, String, String?, String?, String?, List<String>?, String, Long, String?, Boolean, Long?, Long?, Boolean, Long, Long, Long, Long, UpdateStrategy, Long, Long, Long) -> LibraryManga =
{ _id, source, url, artist, author, description, genre, title, status, thumbnail_url, favorite, last_update, next_update, initialized, viewer, chapter_flags, cover_last_modified, date_added, unread_count, read_count, category -> { _id, source, url, artist, author, description, genre, title, status, thumbnail_url, favorite, last_update, next_update, initialized, viewer, chapter_flags, cover_last_modified, date_added, update_strategy, unread_count, read_count, category ->
LibraryManga().apply { LibraryManga().apply {
this.id = _id this.id = _id
this.source = source this.source = source
@ -78,6 +81,7 @@ val libraryManga: (Long, Long, String, String?, String?, String?, List<String>?,
this.thumbnail_url = thumbnail_url this.thumbnail_url = thumbnail_url
this.favorite = favorite this.favorite = favorite
this.last_update = last_update ?: 0 this.last_update = last_update ?: 0
this.update_strategy = update_strategy
this.initialized = initialized this.initialized = initialized
this.viewer_flags = viewer.toInt() this.viewer_flags = viewer.toInt()
this.chapter_flags = chapter_flags.toInt() this.chapter_flags = chapter_flags.toInt()

View file

@ -2,6 +2,7 @@ package eu.kanade.data.manga
import eu.kanade.data.DatabaseHandler import eu.kanade.data.DatabaseHandler
import eu.kanade.data.listOfStringsAdapter import eu.kanade.data.listOfStringsAdapter
import eu.kanade.data.updateStrategyAdapter
import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.Manga
import eu.kanade.domain.manga.model.MangaUpdate import eu.kanade.domain.manga.model.MangaUpdate
import eu.kanade.domain.manga.repository.MangaRepository import eu.kanade.domain.manga.repository.MangaRepository
@ -92,6 +93,7 @@ class MangaRepositoryImpl(
chapterFlags = manga.chapterFlags, chapterFlags = manga.chapterFlags,
coverLastModified = manga.coverLastModified, coverLastModified = manga.coverLastModified,
dateAdded = manga.dateAdded, dateAdded = manga.dateAdded,
updateStrategy = manga.updateStrategy,
) )
mangasQueries.selectLastInsertedRowId() mangasQueries.selectLastInsertedRowId()
} }
@ -138,6 +140,7 @@ class MangaRepositoryImpl(
coverLastModified = value.coverLastModified, coverLastModified = value.coverLastModified,
dateAdded = value.dateAdded, dateAdded = value.dateAdded,
mangaId = value.id, mangaId = value.id,
updateStrategy = value.updateStrategy?.let(updateStrategyAdapter::encode),
) )
} }
} }

View file

@ -68,6 +68,7 @@ class UpdateManga(
genre = remoteManga.getGenres(), genre = remoteManga.getGenres(),
thumbnailUrl = thumbnailUrl, thumbnailUrl = thumbnailUrl,
status = remoteManga.status.toLong(), status = remoteManga.status.toLong(),
updateStrategy = remoteManga.update_strategy,
initialized = true, initialized = true,
), ),
) )

View file

@ -6,6 +6,7 @@ import eu.kanade.tachiyomi.data.cache.CoverCache
import eu.kanade.tachiyomi.data.database.models.MangaImpl import eu.kanade.tachiyomi.data.database.models.MangaImpl
import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.model.UpdateStrategy
import eu.kanade.tachiyomi.widget.ExtendedNavigationView import eu.kanade.tachiyomi.widget.ExtendedNavigationView
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -29,6 +30,7 @@ data class Manga(
val genre: List<String>?, val genre: List<String>?,
val status: Long, val status: Long,
val thumbnailUrl: String?, val thumbnailUrl: String?,
val updateStrategy: UpdateStrategy,
val initialized: Boolean, val initialized: Boolean,
) : Serializable { ) : Serializable {
@ -143,6 +145,7 @@ data class Manga(
genre = null, genre = null,
status = 0L, status = 0L,
thumbnailUrl = null, thumbnailUrl = null,
updateStrategy = UpdateStrategy.ALWAYS_UPDATE,
initialized = false, initialized = false,
) )
} }
@ -180,6 +183,7 @@ fun Manga.toDbManga(): DbManga = MangaImpl().also {
it.genre = genre?.let(listOfStringsAdapter::encode) it.genre = genre?.let(listOfStringsAdapter::encode)
it.status = status.toInt() it.status = status.toInt()
it.thumbnail_url = thumbnailUrl it.thumbnail_url = thumbnailUrl
it.update_strategy = updateStrategy
it.initialized = initialized it.initialized = initialized
} }
@ -201,6 +205,7 @@ fun Manga.toMangaUpdate(): MangaUpdate {
genre = genre, genre = genre,
status = status, status = status,
thumbnailUrl = thumbnailUrl, thumbnailUrl = thumbnailUrl,
updateStrategy = updateStrategy,
initialized = initialized, initialized = initialized,
) )
} }

View file

@ -1,5 +1,7 @@
package eu.kanade.domain.manga.model package eu.kanade.domain.manga.model
import eu.kanade.tachiyomi.source.model.UpdateStrategy
data class MangaUpdate( data class MangaUpdate(
val id: Long, val id: Long,
val source: Long? = null, val source: Long? = null,
@ -17,5 +19,6 @@ data class MangaUpdate(
val genre: List<String>? = null, val genre: List<String>? = null,
val status: Long? = null, val status: Long? = null,
val thumbnailUrl: String? = null, val thumbnailUrl: String? = null,
val updateStrategy: UpdateStrategy? = null,
val initialized: Boolean? = null, val initialized: Boolean? = null,
) )

View file

@ -13,6 +13,7 @@ import eu.kanade.data.AndroidDatabaseHandler
import eu.kanade.data.DatabaseHandler import eu.kanade.data.DatabaseHandler
import eu.kanade.data.dateAdapter import eu.kanade.data.dateAdapter
import eu.kanade.data.listOfStringsAdapter import eu.kanade.data.listOfStringsAdapter
import eu.kanade.data.updateStrategyAdapter
import eu.kanade.domain.backup.service.BackupPreferences import eu.kanade.domain.backup.service.BackupPreferences
import eu.kanade.domain.base.BasePreferences import eu.kanade.domain.base.BasePreferences
import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.domain.download.service.DownloadPreferences
@ -87,6 +88,7 @@ class AppModule(val app: Application) : InjektModule {
), ),
mangasAdapter = Mangas.Adapter( mangasAdapter = Mangas.Adapter(
genreAdapter = listOfStringsAdapter, genreAdapter = listOfStringsAdapter,
update_strategyAdapter = updateStrategyAdapter,
), ),
) )
} }

View file

@ -7,6 +7,7 @@ import com.hippo.unifile.UniFile
import data.Manga_sync import data.Manga_sync
import data.Mangas import data.Mangas
import eu.kanade.data.DatabaseHandler import eu.kanade.data.DatabaseHandler
import eu.kanade.data.updateStrategyAdapter
import eu.kanade.domain.backup.service.BackupPreferences import eu.kanade.domain.backup.service.BackupPreferences
import eu.kanade.domain.category.interactor.GetCategories import eu.kanade.domain.category.interactor.GetCategories
import eu.kanade.domain.category.model.Category import eu.kanade.domain.category.model.Category
@ -506,6 +507,7 @@ class BackupManager(
chapterFlags = manga.chapter_flags.toLong(), chapterFlags = manga.chapter_flags.toLong(),
coverLastModified = manga.cover_last_modified, coverLastModified = manga.cover_last_modified,
dateAdded = manga.date_added, dateAdded = manga.date_added,
updateStrategy = manga.update_strategy,
) )
mangasQueries.selectLastInsertedRowId() mangasQueries.selectLastInsertedRowId()
} }
@ -531,6 +533,7 @@ class BackupManager(
coverLastModified = manga.cover_last_modified, coverLastModified = manga.cover_last_modified,
dateAdded = manga.date_added, dateAdded = manga.date_added,
mangaId = manga.id!!, mangaId = manga.id!!,
updateStrategy = manga.update_strategy.let(updateStrategyAdapter::encode),
) )
} }
return manga.id!! return manga.id!!

View file

@ -4,6 +4,7 @@ import eu.kanade.domain.manga.model.Manga
import eu.kanade.tachiyomi.data.database.models.ChapterImpl import eu.kanade.tachiyomi.data.database.models.ChapterImpl
import eu.kanade.tachiyomi.data.database.models.MangaImpl import eu.kanade.tachiyomi.data.database.models.MangaImpl
import eu.kanade.tachiyomi.data.database.models.TrackImpl import eu.kanade.tachiyomi.data.database.models.TrackImpl
import eu.kanade.tachiyomi.source.model.UpdateStrategy
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoNumber import kotlinx.serialization.protobuf.ProtoNumber
@ -38,6 +39,7 @@ data class BackupManga(
@ProtoNumber(102) var brokenHistory: List<BrokenBackupHistory> = emptyList(), @ProtoNumber(102) var brokenHistory: List<BrokenBackupHistory> = emptyList(),
@ProtoNumber(103) var viewer_flags: Int? = null, @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 { fun getMangaImpl(): MangaImpl {
return MangaImpl().apply { return MangaImpl().apply {
@ -54,6 +56,7 @@ data class BackupManga(
date_added = this@BackupManga.dateAdded date_added = this@BackupManga.dateAdded
viewer_flags = this@BackupManga.viewer_flags ?: this@BackupManga.viewer viewer_flags = this@BackupManga.viewer_flags ?: this@BackupManga.viewer
chapter_flags = this@BackupManga.chapterFlags chapter_flags = this@BackupManga.chapterFlags
update_strategy = this@BackupManga.updateStrategy
} }
} }
@ -86,6 +89,7 @@ data class BackupManga(
viewer = (manga.viewerFlags.toInt() and ReadingModeType.MASK), viewer = (manga.viewerFlags.toInt() and ReadingModeType.MASK),
viewer_flags = manga.viewerFlags.toInt(), viewer_flags = manga.viewerFlags.toInt(),
chapterFlags = manga.chapterFlags.toInt(), chapterFlags = manga.chapterFlags.toInt(),
updateStrategy = manga.updateStrategy,
) )
} }
} }

View file

@ -93,6 +93,7 @@ fun Manga.toDomainManga(): DomainManga? {
genre = getGenres(), genre = getGenres(),
status = status.toLong(), status = status.toLong(),
thumbnailUrl = thumbnail_url, thumbnailUrl = thumbnail_url,
updateStrategy = update_strategy,
initialized = initialized, initialized = initialized,
) )
} }

View file

@ -1,5 +1,7 @@
package eu.kanade.tachiyomi.data.database.models package eu.kanade.tachiyomi.data.database.models
import eu.kanade.tachiyomi.source.model.UpdateStrategy
open class MangaImpl : Manga { open class MangaImpl : Manga {
override var id: Long? = null override var id: Long? = null
@ -28,6 +30,8 @@ open class MangaImpl : Manga {
override var date_added: Long = 0 override var date_added: Long = 0
override var update_strategy: UpdateStrategy = UpdateStrategy.ALWAYS_UPDATE
override var initialized: Boolean = false override var initialized: Boolean = false
override var viewer_flags: Int = 0 override var viewer_flags: Int = 0

View file

@ -43,6 +43,7 @@ import eu.kanade.tachiyomi.data.track.TrackService
import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.source.UnmeteredSource import eu.kanade.tachiyomi.source.UnmeteredSource
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.model.UpdateStrategy
import eu.kanade.tachiyomi.util.lang.withIOContext import eu.kanade.tachiyomi.util.lang.withIOContext
import eu.kanade.tachiyomi.util.prepUpdateCover import eu.kanade.tachiyomi.util.prepUpdateCover
import eu.kanade.tachiyomi.util.shouldDownloadNewChapters import eu.kanade.tachiyomi.util.shouldDownloadNewChapters
@ -347,6 +348,9 @@ class LibraryUpdateService(
MANGA_NON_READ in restrictions && mangaWithNotif.totalChapters > 0 && !mangaWithNotif.hasStarted -> MANGA_NON_READ in restrictions && mangaWithNotif.totalChapters > 0 && !mangaWithNotif.hasStarted ->
skippedUpdates.add(mangaWithNotif to getString(R.string.skipped_reason_not_started)) skippedUpdates.add(mangaWithNotif to getString(R.string.skipped_reason_not_started))
mangaWithNotif.update_strategy != UpdateStrategy.ALWAYS_UPDATE ->
skippedUpdates.add(mangaWithNotif to getString(R.string.skipped_reason_not_always_update))
else -> { else -> {
// Convert to the manga that contains new chapters // Convert to the manga that contains new chapters
mangaWithNotif.toDomainManga()?.let { domainManga -> mangaWithNotif.toDomainManga()?.let { domainManga ->

View file

@ -38,7 +38,7 @@ internal object ExtensionLoader {
private const val METADATA_HAS_README = "tachiyomi.extension.hasReadme" private const val METADATA_HAS_README = "tachiyomi.extension.hasReadme"
private const val METADATA_HAS_CHANGELOG = "tachiyomi.extension.hasChangelog" private const val METADATA_HAS_CHANGELOG = "tachiyomi.extension.hasChangelog"
const val LIB_VERSION_MIN = 1.2 const val LIB_VERSION_MIN = 1.2
const val LIB_VERSION_MAX = 1.3 const val LIB_VERSION_MAX = 1.4
private const val PACKAGE_FLAGS = PackageManager.GET_CONFIGURATIONS or PackageManager.GET_SIGNATURES private const val PACKAGE_FLAGS = PackageManager.GET_CONFIGURATIONS or PackageManager.GET_SIGNATURES

View file

@ -1,3 +1,4 @@
import eu.kanade.tachiyomi.source.model.UpdateStrategy;
import java.lang.String; import java.lang.String;
import kotlin.collections.List; import kotlin.collections.List;
@ -19,7 +20,8 @@ CREATE TABLE mangas(
viewer INTEGER NOT NULL, viewer INTEGER NOT NULL,
chapter_flags INTEGER NOT NULL, chapter_flags INTEGER NOT NULL,
cover_last_modified INTEGER AS Long NOT NULL, cover_last_modified INTEGER AS Long NOT NULL,
date_added INTEGER AS Long NOT NULL date_added INTEGER AS Long NOT NULL,
update_strategy INTEGER AS UpdateStrategy NOT NULL DEFAULT 0
); );
CREATE INDEX library_favorite_index ON mangas(favorite) WHERE favorite = 1; CREATE INDEX library_favorite_index ON mangas(favorite) WHERE favorite = 1;
@ -133,8 +135,8 @@ DELETE FROM mangas
WHERE favorite = 0 AND source IN :sourceIds; WHERE favorite = 0 AND source IN :sourceIds;
insert: insert:
INSERT INTO mangas(source,url,artist,author,description,genre,title,status,thumbnail_url,favorite,last_update,next_update,initialized,viewer,chapter_flags,cover_last_modified,date_added) INSERT INTO mangas(source,url,artist,author,description,genre,title,status,thumbnail_url,favorite,last_update,next_update,initialized,viewer,chapter_flags,cover_last_modified,date_added,update_strategy)
VALUES (:source,:url,:artist,:author,:description,:genre,:title,:status,:thumbnailUrl,:favorite,:lastUpdate,:nextUpdate,:initialized,:viewerFlags,:chapterFlags,:coverLastModified,:dateAdded); VALUES (:source,:url,:artist,:author,:description,:genre,:title,:status,:thumbnailUrl,:favorite,:lastUpdate,:nextUpdate,:initialized,:viewerFlags,:chapterFlags,:coverLastModified,:dateAdded,:updateStrategy);
update: update:
UPDATE mangas SET UPDATE mangas SET
@ -153,7 +155,8 @@ UPDATE mangas SET
viewer = coalesce(:viewer, viewer), viewer = coalesce(:viewer, viewer),
chapter_flags = coalesce(:chapterFlags, chapter_flags), chapter_flags = coalesce(:chapterFlags, chapter_flags),
cover_last_modified = coalesce(:coverLastModified, cover_last_modified), cover_last_modified = coalesce(:coverLastModified, cover_last_modified),
date_added = coalesce(:dateAdded, date_added) date_added = coalesce(:dateAdded, date_added),
update_strategy = coalesce(:updateStrategy, update_strategy)
WHERE _id = :mangaId; WHERE _id = :mangaId;
selectLastInsertedRowId: selectLastInsertedRowId:

View file

@ -0,0 +1 @@
ALTER TABLE mangas ADD COLUMN update_strategy INTEGER NOT NULL DEFAULT 0;

View file

@ -801,6 +801,7 @@
<string name="skipped_reason_completed">Skipped because series is complete</string> <string name="skipped_reason_completed">Skipped because series is complete</string>
<string name="skipped_reason_not_caught_up">Skipped because there are unread chapters</string> <string name="skipped_reason_not_caught_up">Skipped because there are unread chapters</string>
<string name="skipped_reason_not_started">Skipped because no chapters are read</string> <string name="skipped_reason_not_started">Skipped because no chapters are read</string>
<string name="skipped_reason_not_always_update">Skipped because series does not require updates</string>
<!-- File Picker Titles --> <!-- File Picker Titles -->
<string name="file_select_cover">Select cover image</string> <string name="file_select_cover">Select cover image</string>

View file

@ -20,6 +20,8 @@ interface SManga : Serializable {
var thumbnail_url: String? var thumbnail_url: String?
var update_strategy: UpdateStrategy
var initialized: Boolean var initialized: Boolean
fun getGenres(): List<String>? { fun getGenres(): List<String>? {
@ -50,6 +52,8 @@ interface SManga : Serializable {
status = other.status status = other.status
update_strategy = other.update_strategy
if (!initialized) { if (!initialized) {
initialized = other.initialized initialized = other.initialized
} }
@ -64,6 +68,7 @@ interface SManga : Serializable {
it.genre = genre it.genre = genre
it.status = status it.status = status
it.thumbnail_url = thumbnail_url it.thumbnail_url = thumbnail_url
it.update_strategy = update_strategy
it.initialized = initialized it.initialized = initialized
} }

View file

@ -18,5 +18,7 @@ class SMangaImpl : SManga {
override var thumbnail_url: String? = null override var thumbnail_url: String? = null
override var update_strategy: UpdateStrategy = UpdateStrategy.ALWAYS_UPDATE
override var initialized: Boolean = false override var initialized: Boolean = false
} }

View file

@ -0,0 +1,22 @@
package eu.kanade.tachiyomi.source.model
/**
* Define the update strategy for a single [SManga].
* The strategy used will only take effect on the library update.
*
* @since extensions-lib 1.4
*/
enum class UpdateStrategy {
/**
* Series marked as always update will be included in the library
* update if they aren't excluded by additional restrictions.
*/
ALWAYS_UPDATE,
/**
* Series marked as only fetch once will be automatically skipped
* during library updates. Useful for cases where the series is previously
* known to be finished and have only a single chapter, for example.
*/
ONLY_FETCH_ONCE
}