Log result in Tsumino and minor code cleanup
This commit is contained in:
parent
72504ca53f
commit
450fcccaa6
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.source.online.english
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import com.crashlytics.android.Crashlytics
|
||||||
import com.github.salomonbrys.kotson.*
|
import com.github.salomonbrys.kotson.*
|
||||||
import com.google.gson.JsonParser
|
import com.google.gson.JsonParser
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
@ -13,6 +14,7 @@ import eu.kanade.tachiyomi.source.model.*
|
|||||||
import eu.kanade.tachiyomi.source.online.LewdSource
|
import eu.kanade.tachiyomi.source.online.LewdSource
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import eu.kanade.tachiyomi.util.toast
|
||||||
import exh.TSUMINO_SOURCE_ID
|
import exh.TSUMINO_SOURCE_ID
|
||||||
import exh.ui.captcha.CaptchaCompletionVerifier
|
import exh.ui.captcha.CaptchaCompletionVerifier
|
||||||
import exh.ui.captcha.SolveCaptchaActivity
|
import exh.ui.captcha.SolveCaptchaActivity
|
||||||
@ -316,19 +318,24 @@ class Tsumino(private val context: Context): ParsedHttpSource(), LewdSource<Tsum
|
|||||||
Page(index, chapter.url + "#${index + 1}", newImageUrl.toString())
|
Page(index, chapter.url + "#${index + 1}", newImageUrl.toString())
|
||||||
}
|
}
|
||||||
}.doOnError {
|
}.doOnError {
|
||||||
val aspNetCookie = preferences.eh_ts_aspNetCookie().getOrDefault()
|
try {
|
||||||
|
val aspNetCookie = preferences.eh_ts_aspNetCookie().getOrDefault()
|
||||||
|
|
||||||
val cookiesMap = if(aspNetCookie.isNotBlank())
|
val cookiesMap = if (aspNetCookie.isNotBlank())
|
||||||
mapOf(ASP_NET_COOKIE_NAME to aspNetCookie)
|
mapOf(ASP_NET_COOKIE_NAME to aspNetCookie)
|
||||||
else
|
else
|
||||||
emptyMap()
|
emptyMap()
|
||||||
|
|
||||||
SolveCaptchaActivity.launch(context,
|
SolveCaptchaActivity.launch(context,
|
||||||
this,
|
this,
|
||||||
cookiesMap,
|
cookiesMap,
|
||||||
CAPTCHA_SCRIPT,
|
CAPTCHA_SCRIPT,
|
||||||
"$BASE_URL/Read/Auth/$id")
|
"$BASE_URL/Read/Auth/$id")
|
||||||
}
|
} catch(t: Throwable) {
|
||||||
|
Crashlytics.logException(t)
|
||||||
|
context.toast("Could not launch captcha-solving activity: ${t.message}")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun verify(url: String): Boolean {
|
override fun verify(url: String): Boolean {
|
||||||
|
@ -67,9 +67,9 @@ class LibraryCategoryAdapter(val view: LibraryCategoryView) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val thisCache = globalSearchCache.getOrPut(view.category.name, {
|
val thisCache = globalSearchCache.getOrPut(view.category.name) {
|
||||||
SearchCache(mangas.size)
|
SearchCache(mangas.size)
|
||||||
})
|
}
|
||||||
|
|
||||||
if(thisCache.ready) {
|
if(thisCache.ready) {
|
||||||
//Skip everything if cache matches our query exactly
|
//Skip everything if cache matches our query exactly
|
||||||
|
@ -31,17 +31,17 @@ fun Realm.queryMetadataFromManga(manga: Manga,
|
|||||||
fun Realm.syncMangaIds(mangas: List<LibraryItem>) {
|
fun Realm.syncMangaIds(mangas: List<LibraryItem>) {
|
||||||
Timber.d("--> EH: Begin syncing ${mangas.size} manga IDs...")
|
Timber.d("--> EH: Begin syncing ${mangas.size} manga IDs...")
|
||||||
executeTransaction {
|
executeTransaction {
|
||||||
mangas.filter {
|
mangas.forEach { manga ->
|
||||||
isLewdSource(it.manga.source)
|
if(isLewdSource(manga.manga.source)) {
|
||||||
}.forEach { manga ->
|
try {
|
||||||
try {
|
manga.hasMetadata =
|
||||||
manga.hasMetadata =
|
queryMetadataFromManga(manga.manga).findFirst()?.let { meta ->
|
||||||
queryMetadataFromManga(manga.manga).findFirst()?.let { meta ->
|
meta.mangaId = manga.manga.id
|
||||||
meta.mangaId = manga.manga.id
|
true
|
||||||
true
|
} ?: false
|
||||||
} ?: false
|
} catch (e: Exception) {
|
||||||
} catch(e: Exception) {
|
Timber.w(e, "Error syncing manga IDs! Ignoring...")
|
||||||
Timber.w(e, "Error syncing manga IDs! Ignoring...")
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user