mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2025-01-11 19:29:10 +01:00
Removing the logic for cleaning the old way for saving custom manga info
This commit is contained in:
parent
2c7db3c2be
commit
928fc06e58
@ -114,11 +114,6 @@ interface MangaQueries : DbProvider {
|
|||||||
.withPutResolver(MangaInfoPutResolver())
|
.withPutResolver(MangaInfoPutResolver())
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
fun resetMangaInfo(manga: Manga) = db.put()
|
|
||||||
.`object`(manga)
|
|
||||||
.withPutResolver(MangaInfoPutResolver(true))
|
|
||||||
.prepare()
|
|
||||||
|
|
||||||
fun deleteManga(manga: Manga) = db.delete().`object`(manga).prepare()
|
fun deleteManga(manga: Manga) = db.delete().`object`(manga).prepare()
|
||||||
|
|
||||||
fun deleteMangas(mangas: List<Manga>) = db.delete().objects(mangas).prepare()
|
fun deleteMangas(mangas: List<Manga>) = db.delete().objects(mangas).prepare()
|
||||||
|
@ -9,11 +9,11 @@ import eu.kanade.tachiyomi.data.database.inTransactionReturn
|
|||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
import eu.kanade.tachiyomi.data.database.tables.MangaTable
|
import eu.kanade.tachiyomi.data.database.tables.MangaTable
|
||||||
|
|
||||||
class MangaInfoPutResolver(val reset: Boolean = false) : PutResolver<Manga>() {
|
class MangaInfoPutResolver() : PutResolver<Manga>() {
|
||||||
|
|
||||||
override fun performPut(db: StorIOSQLite, manga: Manga) = db.inTransactionReturn {
|
override fun performPut(db: StorIOSQLite, manga: Manga) = db.inTransactionReturn {
|
||||||
val updateQuery = mapToUpdateQuery(manga)
|
val updateQuery = mapToUpdateQuery(manga)
|
||||||
val contentValues = if (reset) resetToContentValues(manga) else mapToContentValues(manga)
|
val contentValues = mapToContentValues(manga)
|
||||||
|
|
||||||
val numberOfRowsUpdated = db.lowLevel().update(updateQuery, contentValues)
|
val numberOfRowsUpdated = db.lowLevel().update(updateQuery, contentValues)
|
||||||
PutResult.newUpdateResult(numberOfRowsUpdated, updateQuery.table())
|
PutResult.newUpdateResult(numberOfRowsUpdated, updateQuery.table())
|
||||||
@ -32,13 +32,4 @@ class MangaInfoPutResolver(val reset: Boolean = false) : PutResolver<Manga>() {
|
|||||||
put(MangaTable.COL_ARTIST, manga.originalArtist)
|
put(MangaTable.COL_ARTIST, manga.originalArtist)
|
||||||
put(MangaTable.COL_DESCRIPTION, manga.originalDescription)
|
put(MangaTable.COL_DESCRIPTION, manga.originalDescription)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun resetToContentValues(manga: Manga) = ContentValues(1).apply {
|
|
||||||
val splitter = "▒ ▒∩▒"
|
|
||||||
put(MangaTable.COL_TITLE, manga.title.split(splitter).last())
|
|
||||||
put(MangaTable.COL_GENRE, manga.genre?.split(splitter)?.lastOrNull())
|
|
||||||
put(MangaTable.COL_AUTHOR, manga.author?.split(splitter)?.lastOrNull())
|
|
||||||
put(MangaTable.COL_ARTIST, manga.artist?.split(splitter)?.lastOrNull())
|
|
||||||
put(MangaTable.COL_DESCRIPTION, manga.description?.split(splitter)?.lastOrNull())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -729,7 +729,6 @@ class LibraryPresenter(
|
|||||||
scope.launch {
|
scope.launch {
|
||||||
val mangaToDelete = mangas.distinctBy { it.id }
|
val mangaToDelete = mangas.distinctBy { it.id }
|
||||||
mangaToDelete.forEach { manga ->
|
mangaToDelete.forEach { manga ->
|
||||||
db.resetMangaInfo(manga).executeOnIO()
|
|
||||||
coverCache.deleteFromCache(manga)
|
coverCache.deleteFromCache(manga)
|
||||||
val source = sourceManager.get(manga.source) as? HttpSource
|
val source = sourceManager.get(manga.source) as? HttpSource
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
@ -927,7 +926,7 @@ class LibraryPresenter(
|
|||||||
private var lastLibraryItems: List<LibraryItem>? = null
|
private var lastLibraryItems: List<LibraryItem>? = null
|
||||||
private var lastCategories: List<Category>? = null
|
private var lastCategories: List<Category>? = null
|
||||||
|
|
||||||
/** Give library manga to a date added based on min chapter fetch + remove custom info */
|
/** Give library manga to a date added based on min chapter fetch */
|
||||||
fun updateDB() {
|
fun updateDB() {
|
||||||
val db: DatabaseHelper = Injekt.get()
|
val db: DatabaseHelper = Injekt.get()
|
||||||
db.inTransaction {
|
db.inTransaction {
|
||||||
@ -938,7 +937,6 @@ class LibraryPresenter(
|
|||||||
manga.date_added = chapters.minByOrNull { it.date_fetch }?.date_fetch ?: 0L
|
manga.date_added = chapters.minByOrNull { it.date_fetch }?.date_fetch ?: 0L
|
||||||
db.insertManga(manga).executeAsBlocking()
|
db.insertManga(manga).executeAsBlocking()
|
||||||
}
|
}
|
||||||
db.resetMangaInfo(manga).executeAsBlocking()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,6 @@ open class BrowseSourcePresenter(
|
|||||||
coverCache.deleteFromCache(manga)
|
coverCache.deleteFromCache(manga)
|
||||||
val downloadManager: DownloadManager = Injekt.get()
|
val downloadManager: DownloadManager = Injekt.get()
|
||||||
downloadManager.deleteManga(manga, source)
|
downloadManager.deleteManga(manga, source)
|
||||||
db.resetMangaInfo(manga).executeAsBlocking()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user