Add a option to force migrate all nhentai manga to the nhentai other lang
Dont blame me if this breaks your library
This commit is contained in:
parent
e284c7a921
commit
10c8c3baee
@ -10,6 +10,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.model.toSManga
|
||||
import eu.kanade.tachiyomi.source.online.all.NHentai
|
||||
import exh.EXHMigrations
|
||||
import exh.eh.EHentaiThrottleManager
|
||||
import exh.eh.EHentaiUpdateWorker
|
||||
@ -21,6 +22,7 @@ import exh.savedsearches.JsonSavedSearch
|
||||
import exh.source.EH_SOURCE_ID
|
||||
import exh.source.EXH_SOURCE_ID
|
||||
import exh.source.isEhBasedManga
|
||||
import exh.source.nHentaiSourceIds
|
||||
import exh.util.cancellable
|
||||
import exh.util.executeOnIO
|
||||
import exh.util.jobScheduler
|
||||
@ -31,7 +33,6 @@ import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.Json
|
||||
import uy.kohesive.injekt.api.get
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.lang.RuntimeException
|
||||
import java.util.UUID
|
||||
@ -358,4 +359,25 @@ object DebugFunctions {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun migrateAllNhentaiToOtherLang() {
|
||||
val sources = nHentaiSourceIds.toMutableList()
|
||||
.also { it.remove(NHentai.otherId) }
|
||||
.joinToString(separator = ",")
|
||||
|
||||
db.inTransaction {
|
||||
db.lowLevel().executeSQL(
|
||||
RawQuery.builder()
|
||||
.query(
|
||||
"""
|
||||
UPDATE ${MangaTable.TABLE}
|
||||
SET ${MangaTable.COL_SOURCE} = ${NHentai.otherId}
|
||||
WHERE ${MangaTable.COL_FAVORITE} = 1 AND ${MangaTable.COL_SOURCE} in ($sources)
|
||||
""".trimIndent()
|
||||
)
|
||||
.affectsTables(MangaTable.TABLE)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user