2019-04-06 13:35:36 +02:00
|
|
|
package exh.debug
|
|
|
|
|
|
2019-04-18 23:40:13 +02:00
|
|
|
import android.app.Application
|
2021-07-02 23:51:02 +02:00
|
|
|
import androidx.work.WorkManager
|
2022-07-03 19:37:27 +02:00
|
|
|
import eu.kanade.data.AndroidDatabaseHandler
|
2022-04-23 01:40:09 +02:00
|
|
|
import eu.kanade.data.DatabaseHandler
|
2022-07-03 19:37:27 +02:00
|
|
|
import eu.kanade.domain.manga.interactor.GetAllManga
|
|
|
|
|
import eu.kanade.domain.manga.interactor.GetExhFavoriteMangaWithMetadata
|
2022-07-03 05:52:03 +02:00
|
|
|
import eu.kanade.domain.manga.interactor.GetFavorites
|
2022-07-03 19:37:27 +02:00
|
|
|
import eu.kanade.domain.manga.interactor.GetFlatMetadataById
|
|
|
|
|
import eu.kanade.domain.manga.interactor.GetSearchMetadata
|
|
|
|
|
import eu.kanade.domain.manga.interactor.InsertFlatMetadata
|
2022-07-03 05:52:03 +02:00
|
|
|
import eu.kanade.domain.manga.interactor.UpdateManga
|
|
|
|
|
import eu.kanade.domain.manga.model.toMangaInfo
|
2019-04-06 13:35:36 +02:00
|
|
|
import eu.kanade.tachiyomi.data.database.tables.MangaTable
|
|
|
|
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
2019-04-14 18:12:58 +02:00
|
|
|
import eu.kanade.tachiyomi.source.SourceManager
|
2021-08-16 20:28:17 +02:00
|
|
|
import eu.kanade.tachiyomi.source.online.all.NHentai
|
2020-02-22 11:12:30 +01:00
|
|
|
import exh.EXHMigrations
|
2020-05-17 02:56:45 +02:00
|
|
|
import exh.eh.EHentaiThrottleManager
|
2019-04-18 23:40:13 +02:00
|
|
|
import exh.eh.EHentaiUpdateWorker
|
2020-02-10 20:04:16 +01:00
|
|
|
import exh.metadata.metadata.EHentaiSearchMetadata
|
2021-01-26 06:40:57 +01:00
|
|
|
import exh.source.EH_SOURCE_ID
|
|
|
|
|
import exh.source.EXH_SOURCE_ID
|
2021-08-16 20:28:17 +02:00
|
|
|
import exh.source.nHentaiSourceIds
|
2020-05-07 15:14:52 +02:00
|
|
|
import exh.util.jobScheduler
|
2020-04-04 22:30:05 +02:00
|
|
|
import kotlinx.coroutines.runBlocking
|
|
|
|
|
import uy.kohesive.injekt.injectLazy
|
2021-07-02 23:51:02 +02:00
|
|
|
import java.util.UUID
|
2019-04-06 13:35:36 +02:00
|
|
|
|
2020-11-25 21:57:05 +01:00
|
|
|
@Suppress("unused")
|
2019-04-06 13:35:36 +02:00
|
|
|
object DebugFunctions {
|
2019-04-18 23:40:13 +02:00
|
|
|
val app: Application by injectLazy()
|
2022-07-03 05:52:03 +02:00
|
|
|
val handler: DatabaseHandler by injectLazy()
|
2019-04-06 13:35:36 +02:00
|
|
|
val prefs: PreferencesHelper by injectLazy()
|
2019-04-14 18:12:58 +02:00
|
|
|
val sourceManager: SourceManager by injectLazy()
|
2022-07-03 05:52:03 +02:00
|
|
|
val updateManga: UpdateManga by injectLazy()
|
|
|
|
|
val getFavorites: GetFavorites by injectLazy()
|
2022-07-03 19:37:27 +02:00
|
|
|
val getFlatMetadataById: GetFlatMetadataById by injectLazy()
|
|
|
|
|
val insertFlatMetadata: InsertFlatMetadata by injectLazy()
|
|
|
|
|
val getExhFavoriteMangaWithMetadata: GetExhFavoriteMangaWithMetadata by injectLazy()
|
|
|
|
|
val getSearchMetadata: GetSearchMetadata by injectLazy()
|
|
|
|
|
val getAllManga: GetAllManga by injectLazy()
|
2019-04-06 13:35:36 +02:00
|
|
|
|
2020-02-22 11:12:30 +01:00
|
|
|
fun forceUpgradeMigration() {
|
2020-11-30 20:35:31 +01:00
|
|
|
prefs.ehLastVersionCode().set(1)
|
2020-02-22 11:12:30 +01:00
|
|
|
EXHMigrations.upgrade(prefs)
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-14 04:15:09 +02:00
|
|
|
fun forceSetupJobs() {
|
2020-11-30 20:35:31 +01:00
|
|
|
prefs.ehLastVersionCode().set(0)
|
2020-08-14 04:15:09 +02:00
|
|
|
EXHMigrations.upgrade(prefs)
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-10 20:04:16 +01:00
|
|
|
fun resetAgedFlagInEXHManga() {
|
|
|
|
|
runBlocking {
|
2022-07-03 19:37:27 +02:00
|
|
|
getExhFavoriteMangaWithMetadata.await().forEach { manga ->
|
|
|
|
|
val meta = getFlatMetadataById.await(manga.id)?.raise<EHentaiSearchMetadata>() ?: return@forEach
|
2020-08-14 04:15:09 +02:00
|
|
|
// remove age flag
|
|
|
|
|
meta.aged = false
|
2022-07-03 19:37:27 +02:00
|
|
|
insertFlatMetadata.await(meta)
|
2020-02-10 20:04:16 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-05-17 02:56:45 +02:00
|
|
|
private val throttleManager = EHentaiThrottleManager()
|
2020-02-10 20:04:16 +01:00
|
|
|
|
2020-10-28 00:52:32 +01:00
|
|
|
fun getDelegatedSourceList(): String = SourceManager.currentDelegatedSources.map { it.value.sourceName + " : " + it.value.sourceId + " : " + it.value.factory }.joinToString(separator = "\n")
|
2020-06-26 01:35:44 +02:00
|
|
|
|
2020-07-30 22:15:38 +02:00
|
|
|
fun resetEHGalleriesForUpdater() {
|
2020-05-17 02:56:45 +02:00
|
|
|
throttleManager.resetThrottle()
|
|
|
|
|
runBlocking {
|
2022-07-03 19:37:27 +02:00
|
|
|
val allManga = getExhFavoriteMangaWithMetadata.await()
|
2020-05-17 02:56:45 +02:00
|
|
|
|
2020-08-14 04:15:09 +02:00
|
|
|
val eh = sourceManager.get(EH_SOURCE_ID)
|
|
|
|
|
val ex = sourceManager.get(EXH_SOURCE_ID)
|
2020-05-17 02:56:45 +02:00
|
|
|
|
2020-08-14 04:15:09 +02:00
|
|
|
allManga.forEach { manga ->
|
2020-05-17 02:56:45 +02:00
|
|
|
throttleManager.throttle()
|
2022-07-03 05:52:03 +02:00
|
|
|
|
|
|
|
|
val networkManga = when (manga.source) {
|
|
|
|
|
EH_SOURCE_ID -> eh
|
|
|
|
|
EXH_SOURCE_ID -> ex
|
|
|
|
|
else -> return@forEach
|
|
|
|
|
}?.getMangaDetails(manga.toMangaInfo()) ?: return@forEach
|
|
|
|
|
|
|
|
|
|
updateManga.awaitUpdateFromSource(manga, networkManga, true)
|
2020-05-17 02:56:45 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun getEHMangaListWithAgedFlagInfo(): String {
|
2022-07-03 05:52:03 +02:00
|
|
|
return runBlocking {
|
2022-07-03 19:37:27 +02:00
|
|
|
getExhFavoriteMangaWithMetadata.await().map { manga ->
|
|
|
|
|
val meta = getFlatMetadataById.await(manga.id)?.raise<EHentaiSearchMetadata>() ?: return@map
|
2022-07-03 05:52:03 +02:00
|
|
|
"Aged: ${meta.aged}\t Title: ${manga.title}"
|
2020-05-17 01:44:12 +02:00
|
|
|
}
|
2022-07-03 05:52:03 +02:00
|
|
|
}.joinToString(",\n")
|
2020-05-17 01:44:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun countAgedFlagInEXHManga(): Int {
|
2022-07-03 05:52:03 +02:00
|
|
|
return runBlocking {
|
2022-07-03 19:37:27 +02:00
|
|
|
getExhFavoriteMangaWithMetadata.await()
|
2022-07-03 05:52:03 +02:00
|
|
|
.count { manga ->
|
2022-07-03 19:37:27 +02:00
|
|
|
val meta = getFlatMetadataById.await(manga.id)
|
2022-07-03 05:52:03 +02:00
|
|
|
?.raise<EHentaiSearchMetadata>()
|
|
|
|
|
?: return@count false
|
|
|
|
|
meta.aged
|
2020-05-17 01:44:12 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-06 13:35:36 +02:00
|
|
|
fun addAllMangaInDatabaseToLibrary() {
|
2022-07-03 19:37:27 +02:00
|
|
|
(handler as AndroidDatabaseHandler).rawQuery {
|
|
|
|
|
it.execute(
|
|
|
|
|
null,
|
|
|
|
|
"""
|
|
|
|
|
UPDATE ${MangaTable.TABLE}
|
|
|
|
|
SET ${MangaTable.COL_FAVORITE} = 1
|
|
|
|
|
""".trimIndent(),
|
|
|
|
|
0,
|
2020-05-02 06:46:24 +02:00
|
|
|
)
|
2019-04-06 13:35:36 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-03 05:52:03 +02:00
|
|
|
fun countMangaInDatabaseInLibrary() = runBlocking { getFavorites.await().size }
|
2019-04-06 13:35:36 +02:00
|
|
|
|
2022-07-03 19:37:27 +02:00
|
|
|
fun countMangaInDatabaseNotInLibrary() = runBlocking { getAllManga.await() }.count { !it.favorite }
|
2019-04-06 13:35:36 +02:00
|
|
|
|
2022-07-03 19:37:27 +02:00
|
|
|
fun countMangaInDatabase() = runBlocking { getAllManga.await() }.size
|
2019-04-06 13:35:36 +02:00
|
|
|
|
2022-07-03 19:37:27 +02:00
|
|
|
fun countMetadataInDatabase() = runBlocking { getSearchMetadata.await().size }
|
2019-04-06 13:35:36 +02:00
|
|
|
|
2022-07-03 19:37:27 +02:00
|
|
|
fun countMangaInLibraryWithMissingMetadata() = runBlocking {
|
|
|
|
|
runBlocking { getAllManga.await() }.count {
|
|
|
|
|
it.favorite && getSearchMetadata.await(it.id) == null
|
|
|
|
|
}
|
2019-04-06 13:35:36 +02:00
|
|
|
}
|
|
|
|
|
|
2022-07-03 05:52:03 +02:00
|
|
|
fun clearSavedSearches() = runBlocking { handler.await { saved_searchQueries.deleteAll() } }
|
2019-04-14 18:12:58 +02:00
|
|
|
|
2020-07-30 21:56:18 +02:00
|
|
|
fun listAllSources() = sourceManager.getCatalogueSources().joinToString("\n") {
|
2021-06-02 03:09:03 +02:00
|
|
|
"${it.id}: ${it.name} (${it.lang.uppercase()})"
|
2020-07-30 21:56:18 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-11 03:15:48 +02:00
|
|
|
fun listAllSourcesClassName() = sourceManager.getCatalogueSources().joinToString("\n") {
|
2021-06-02 03:09:03 +02:00
|
|
|
"${it::class.qualifiedName}: ${it.name} (${it.lang.uppercase()})"
|
2020-08-11 03:15:48 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-30 22:15:38 +02:00
|
|
|
fun listVisibleSources() = sourceManager.getVisibleCatalogueSources().joinToString("\n") {
|
2021-06-02 03:09:03 +02:00
|
|
|
"${it.id}: ${it.name} (${it.lang.uppercase()})"
|
2020-07-30 21:56:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun listAllHttpSources() = sourceManager.getOnlineSources().joinToString("\n") {
|
2021-06-02 03:09:03 +02:00
|
|
|
"${it.id}: ${it.name} (${it.lang.uppercase()})"
|
2020-07-30 21:56:18 +02:00
|
|
|
}
|
2020-07-30 22:15:38 +02:00
|
|
|
fun listVisibleHttpSources() = sourceManager.getVisibleOnlineSources().joinToString("\n") {
|
2021-06-02 03:09:03 +02:00
|
|
|
"${it.id}: ${it.name} (${it.lang.uppercase()})"
|
2020-07-30 21:56:18 +02:00
|
|
|
}
|
2019-04-14 18:12:58 +02:00
|
|
|
|
|
|
|
|
fun convertAllEhentaiGalleriesToExhentai() = convertSources(EH_SOURCE_ID, EXH_SOURCE_ID)
|
|
|
|
|
|
|
|
|
|
fun convertAllExhentaiGalleriesToEhentai() = convertSources(EXH_SOURCE_ID, EH_SOURCE_ID)
|
|
|
|
|
|
2021-07-02 23:50:22 +02:00
|
|
|
fun testLaunchEhentaiBackgroundUpdater() {
|
|
|
|
|
EHentaiUpdateWorker.launchBackgroundTest(app)
|
2019-04-18 23:40:13 +02:00
|
|
|
}
|
|
|
|
|
|
2019-08-13 03:09:39 +02:00
|
|
|
fun rescheduleEhentaiBackgroundUpdater() {
|
2020-04-22 23:26:46 +02:00
|
|
|
EHentaiUpdateWorker.scheduleBackground(app)
|
2019-08-13 03:09:39 +02:00
|
|
|
}
|
|
|
|
|
|
2021-03-07 08:47:48 +01:00
|
|
|
fun listScheduledJobs() = app.jobScheduler.allPendingJobs.joinToString(",\n") { j ->
|
2021-07-02 23:51:02 +02:00
|
|
|
val info = j.extras.getString("EXTRA_WORK_SPEC_ID")?.let {
|
|
|
|
|
WorkManager.getInstance(app).getWorkInfoById(UUID.fromString(it)).get()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
"""
|
|
|
|
|
{
|
|
|
|
|
id: ${info.id},
|
|
|
|
|
isPeriodic: ${j.extras["EXTRA_IS_PERIODIC"]},
|
|
|
|
|
state: ${info.state.name},
|
|
|
|
|
tags: [
|
|
|
|
|
${info.tags.joinToString(separator = ",\n ")}
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
""".trimIndent()
|
|
|
|
|
} else {
|
|
|
|
|
"""
|
|
|
|
|
{
|
|
|
|
|
info: ${j.id},
|
|
|
|
|
isPeriodic: ${j.isPeriodic},
|
|
|
|
|
isPersisted: ${j.isPersisted},
|
|
|
|
|
intervalMillis: ${j.intervalMillis},
|
|
|
|
|
}
|
|
|
|
|
""".trimIndent()
|
2020-05-02 06:46:24 +02:00
|
|
|
}
|
2021-03-07 08:47:48 +01:00
|
|
|
}
|
2019-08-13 03:09:39 +02:00
|
|
|
|
2020-04-22 23:26:46 +02:00
|
|
|
fun cancelAllScheduledJobs() = app.jobScheduler.cancelAll()
|
2019-08-13 03:09:39 +02:00
|
|
|
|
2019-04-14 18:12:58 +02:00
|
|
|
private fun convertSources(from: Long, to: Long) {
|
2022-07-03 19:37:27 +02:00
|
|
|
(handler as AndroidDatabaseHandler).rawQuery {
|
|
|
|
|
it.execute(
|
|
|
|
|
null,
|
|
|
|
|
"""
|
|
|
|
|
UPDATE ${MangaTable.TABLE}
|
|
|
|
|
SET ${MangaTable.COL_SOURCE} = $to
|
|
|
|
|
WHERE ${MangaTable.COL_SOURCE} = $from
|
|
|
|
|
""".trimIndent(),
|
|
|
|
|
0,
|
|
|
|
|
)
|
|
|
|
|
}
|
2019-04-14 18:12:58 +02:00
|
|
|
}
|
2020-06-23 00:09:30 +02:00
|
|
|
|
2022-03-27 20:11:37 +02:00
|
|
|
/*fun copyEHentaiSavedSearchesToExhentai() {
|
2020-06-23 00:09:30 +02:00
|
|
|
runBlocking {
|
2020-08-14 04:15:09 +02:00
|
|
|
val source = sourceManager.get(EH_SOURCE_ID) as? CatalogueSource ?: return@runBlocking
|
|
|
|
|
val newSource = sourceManager.get(EXH_SOURCE_ID) as? CatalogueSource ?: return@runBlocking
|
2020-11-30 20:35:31 +01:00
|
|
|
val savedSearches = prefs.savedSearches().get().mapNotNull {
|
2020-06-23 00:09:30 +02:00
|
|
|
try {
|
|
|
|
|
val id = it.substringBefore(':').toLong()
|
2020-07-01 21:05:19 +02:00
|
|
|
if (id != source.id) return@mapNotNull null
|
2020-10-13 19:46:20 +02:00
|
|
|
Json.decodeFromString<JsonSavedSearch>(it.substringAfter(':'))
|
2020-06-23 00:09:30 +02:00
|
|
|
} catch (t: RuntimeException) {
|
|
|
|
|
// Load failed
|
2021-03-07 06:23:23 +01:00
|
|
|
xLogE("Failed to load saved search!", t)
|
2020-06-23 00:09:30 +02:00
|
|
|
t.printStackTrace()
|
|
|
|
|
null
|
|
|
|
|
}
|
2020-07-01 21:05:19 +02:00
|
|
|
}.toMutableList()
|
2020-11-30 20:35:31 +01:00
|
|
|
savedSearches += prefs.savedSearches().get().mapNotNull {
|
2020-06-23 00:09:30 +02:00
|
|
|
try {
|
|
|
|
|
val id = it.substringBefore(':').toLong()
|
2020-07-01 21:05:19 +02:00
|
|
|
if (id != newSource.id) return@mapNotNull null
|
2020-10-13 19:46:20 +02:00
|
|
|
Json.decodeFromString<JsonSavedSearch>(it.substringAfter(':'))
|
2020-06-23 00:09:30 +02:00
|
|
|
} catch (t: RuntimeException) {
|
|
|
|
|
// Load failed
|
2021-03-07 06:23:23 +01:00
|
|
|
xLogE("Failed to load saved search!", t)
|
2020-06-23 00:09:30 +02:00
|
|
|
t.printStackTrace()
|
|
|
|
|
null
|
|
|
|
|
}
|
2020-07-01 21:05:19 +02:00
|
|
|
}.filterNot { newSavedSearch -> savedSearches.any { it.name == newSavedSearch.name } }
|
2020-06-23 00:09:30 +02:00
|
|
|
|
2020-11-30 20:35:31 +01:00
|
|
|
val otherSerialized = prefs.savedSearches().get().filter {
|
2020-06-23 00:09:30 +02:00
|
|
|
!it.startsWith("${newSource.id}:")
|
|
|
|
|
}
|
|
|
|
|
val newSerialized = savedSearches.map {
|
2020-10-12 20:20:54 +02:00
|
|
|
"${newSource.id}:" + Json.encodeToString(it)
|
2020-06-23 00:09:30 +02:00
|
|
|
}
|
2020-11-30 20:35:31 +01:00
|
|
|
prefs.savedSearches().set((otherSerialized + newSerialized).toSet())
|
2020-06-23 00:09:30 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun copyExhentaiSavedSearchesToEHentai() {
|
|
|
|
|
runBlocking {
|
2020-08-14 04:15:09 +02:00
|
|
|
val source = sourceManager.get(EXH_SOURCE_ID) as? CatalogueSource ?: return@runBlocking
|
|
|
|
|
val newSource = sourceManager.get(EH_SOURCE_ID) as? CatalogueSource ?: return@runBlocking
|
2020-11-30 20:35:31 +01:00
|
|
|
val savedSearches = prefs.savedSearches().get().mapNotNull {
|
2020-06-23 00:09:30 +02:00
|
|
|
try {
|
|
|
|
|
val id = it.substringBefore(':').toLong()
|
2020-07-01 21:05:19 +02:00
|
|
|
if (id != source.id) return@mapNotNull null
|
2020-10-13 19:46:20 +02:00
|
|
|
Json.decodeFromString<JsonSavedSearch>(it.substringAfter(':'))
|
2020-06-23 00:09:30 +02:00
|
|
|
} catch (t: RuntimeException) {
|
|
|
|
|
// Load failed
|
2021-03-07 06:23:23 +01:00
|
|
|
xLogE("Failed to load saved search!", t)
|
2020-06-23 00:09:30 +02:00
|
|
|
t.printStackTrace()
|
|
|
|
|
null
|
|
|
|
|
}
|
2020-07-01 21:05:19 +02:00
|
|
|
}.toMutableList()
|
2020-11-30 20:35:31 +01:00
|
|
|
savedSearches += prefs.savedSearches().get().mapNotNull {
|
2020-06-23 00:09:30 +02:00
|
|
|
try {
|
|
|
|
|
val id = it.substringBefore(':').toLong()
|
2020-07-01 21:05:19 +02:00
|
|
|
if (id != newSource.id) return@mapNotNull null
|
2020-10-13 19:46:20 +02:00
|
|
|
Json.decodeFromString<JsonSavedSearch>(it.substringAfter(':'))
|
2020-06-23 00:09:30 +02:00
|
|
|
} catch (t: RuntimeException) {
|
|
|
|
|
// Load failed
|
2021-03-07 06:23:23 +01:00
|
|
|
xLogE("Failed to load saved search!", t)
|
2020-06-23 00:09:30 +02:00
|
|
|
t.printStackTrace()
|
|
|
|
|
null
|
|
|
|
|
}
|
2020-07-01 21:05:19 +02:00
|
|
|
}.filterNot { newSavedSearch -> savedSearches.any { it.name == newSavedSearch.name } }
|
2020-06-23 00:09:30 +02:00
|
|
|
|
2020-11-30 20:35:31 +01:00
|
|
|
val otherSerialized = prefs.savedSearches().get().filter {
|
2020-06-23 00:09:30 +02:00
|
|
|
!it.startsWith("${newSource.id}:")
|
|
|
|
|
}
|
|
|
|
|
val newSerialized = savedSearches.map {
|
2020-10-12 20:20:54 +02:00
|
|
|
"${newSource.id}:" + Json.encodeToString(it)
|
2020-06-23 00:09:30 +02:00
|
|
|
}
|
2020-11-30 20:35:31 +01:00
|
|
|
prefs.savedSearches().set((otherSerialized + newSerialized).toSet())
|
2020-06-23 00:09:30 +02:00
|
|
|
}
|
2022-03-27 20:11:37 +02:00
|
|
|
}*/
|
2021-04-15 00:16:23 +02:00
|
|
|
|
2021-04-15 01:01:41 +02:00
|
|
|
fun fixReaderViewerBackupBug() {
|
2022-07-03 19:37:27 +02:00
|
|
|
(handler as AndroidDatabaseHandler).rawQuery {
|
|
|
|
|
it.execute(
|
|
|
|
|
null,
|
|
|
|
|
"""
|
|
|
|
|
UPDATE ${MangaTable.TABLE}
|
|
|
|
|
SET ${MangaTable.COL_VIEWER} = 0
|
|
|
|
|
WHERE ${MangaTable.COL_VIEWER} = -1
|
|
|
|
|
""".trimIndent(),
|
|
|
|
|
0,
|
2021-04-15 00:16:23 +02:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-08 02:53:52 +02:00
|
|
|
|
|
|
|
|
fun resetReaderViewerForAllManga() {
|
2022-07-03 19:37:27 +02:00
|
|
|
(handler as AndroidDatabaseHandler).rawQuery {
|
|
|
|
|
it.execute(
|
|
|
|
|
null,
|
|
|
|
|
"""
|
|
|
|
|
UPDATE ${MangaTable.TABLE}
|
|
|
|
|
SET ${MangaTable.COL_VIEWER} = 0
|
|
|
|
|
""".trimIndent(),
|
|
|
|
|
0,
|
2021-07-08 02:53:52 +02:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-16 20:28:17 +02:00
|
|
|
|
|
|
|
|
fun migrateAllNhentaiToOtherLang() {
|
|
|
|
|
val sources = nHentaiSourceIds.toMutableList()
|
|
|
|
|
.also { it.remove(NHentai.otherId) }
|
|
|
|
|
.joinToString(separator = ",")
|
|
|
|
|
|
2022-07-03 19:37:27 +02:00
|
|
|
(handler as AndroidDatabaseHandler).rawQuery {
|
|
|
|
|
it.execute(
|
|
|
|
|
null,
|
|
|
|
|
"""
|
|
|
|
|
UPDATE ${MangaTable.TABLE}
|
|
|
|
|
SET ${MangaTable.COL_SOURCE} = ${NHentai.otherId}
|
|
|
|
|
WHERE ${MangaTable.COL_FAVORITE} = 1 AND ${MangaTable.COL_SOURCE} in ($sources)
|
|
|
|
|
""".trimIndent(),
|
|
|
|
|
0,
|
2021-08-16 20:28:17 +02:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-06-26 19:52:05 +02:00
|
|
|
|
|
|
|
|
fun resetFilteredScanlatorsForAllManga() {
|
2022-07-03 19:37:27 +02:00
|
|
|
(handler as AndroidDatabaseHandler).rawQuery {
|
|
|
|
|
it.execute(
|
|
|
|
|
null,
|
|
|
|
|
"""
|
|
|
|
|
UPDATE ${MangaTable.TABLE}
|
|
|
|
|
SET ${MangaTable.COL_FILTERED_SCANLATORS} = NULL
|
|
|
|
|
""".trimIndent(),
|
|
|
|
|
0,
|
2022-06-26 19:52:05 +02:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-02-10 20:04:16 +01:00
|
|
|
}
|