This commit is contained in:
Jobobby04
2020-12-12 12:36:29 -05:00
parent 134f776a86
commit 6f712c7f17
28 changed files with 49 additions and 8 deletions
@@ -7,12 +7,16 @@ import java.util.Locale
enum class DebugToggles(val default: Boolean) {
// Redirect to master version of gallery when encountering a gallery that has a parent/child that is already in the library
ENABLE_EXH_ROOT_REDIRECT(true),
// Enable debug overlay (only available in debug builds)
ENABLE_DEBUG_OVERLAY(true),
// Convert non-root galleries into root galleries when loading them
PULL_TO_ROOT_WHEN_LOADING_EXH_MANGA_DETAILS(true),
// Do not update the same gallery too often
RESTRICT_EXH_GALLERY_UPDATE_CHECK_FREQUENCY(true),
// Pretend that all galleries only have a single version
INCLUDE_ONLY_ROOT_WHEN_LOADING_EXH_VERSIONS(false);
@@ -266,6 +266,7 @@ class EHentaiUpdateWorker : JobService(), CoroutineScope {
db.insertManga(manga).await()
val newChapters = source.fetchChapterList(manga).awaitSingle()
val (new, _) = syncChaptersWithSource(db, newChapters, manga, source) // Not suspending, but does block, maybe fix this?
return new to db.getChapters(manga).await()
} catch (t: Throwable) {
@@ -386,6 +387,7 @@ data class UpdateEntry(val manga: Manga, val meta: EHentaiSearchMetadata, val ro
object EHentaiUpdateWorkerConstants {
const val UPDATES_PER_ITERATION = 50
@OptIn(ExperimentalTime::class)
val GALLERY_AGE_TIME = 365.days.toLongMilliseconds()
}
@@ -52,6 +52,7 @@ class MemAutoFlushingLookupTable<T>(
// Used to debounce
@Volatile
private var writeCounter = Long.MIN_VALUE
@Volatile
private var flushed = true
@@ -31,6 +31,7 @@ class ApiMangaParser(private val langs: List<String>) {
val db: DatabaseHelper get() = Injekt.get()
val metaClass = MangaDexSearchMetadata::class
/**
* Use reflection to create a new instance of metadata
*/
@@ -38,6 +39,7 @@ class ApiMangaParser(private val langs: List<String>) {
it.parameters.isEmpty()
}?.call()
?: error("Could not find no-args constructor for meta class: ${metaClass.qualifiedName}!")
/**
* Parses metadata from the input and then copies it into the manga
*
@@ -71,8 +71,8 @@ class FollowsHandler(val client: OkHttpClient, val headers: Headers, val prefere
return MetadataMangasPage(result.map { it.first }, false, result.map { it.second })
}
/**fetch follow status used when fetching status for 1 manga
*
/**
* fetch follow status used when fetching status for 1 manga
*/
private fun followStatusParse(response: Response): Track {
@@ -99,8 +99,8 @@ class FollowsHandler(val client: OkHttpClient, val headers: Headers, val prefere
return track
}
/**build Request for follows page
*
/**
* build Request for follows page
*/
private fun followsListRequest(): Request {
return GET("${MdUtil.baseUrl}${MdUtil.followsAllApi}", headers, CacheControl.FORCE_NETWORK)
@@ -29,6 +29,7 @@ class EHentaiSearchMetadata : RaisedSearchMetadata() {
var datePosted: Long? = null
var parent: String? = null
var visible: String? = null // Not a boolean
var language: String? = null
var translated: Boolean? = null
@@ -108,6 +108,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
* Whether the source has support for latest updates.
*/
override val supportsLatest get() = delegate.supportsLatest
/**
* Name of the source.
*/
@@ -121,6 +122,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
* Note the generated id sets the sign bit to 0.
*/
override val id get() = delegate.id
/**
* Default network client for doing requests.
*/
@@ -113,6 +113,7 @@ class EnhancedHttpSource(
* Whether the source has support for latest updates.
*/
override val supportsLatest get() = source().supportsLatest
/**
* Name of the source.
*/
@@ -131,6 +132,7 @@ class EnhancedHttpSource(
* Note the generated id sets the sign bit to 0.
*/
override val id get() = source().id
/**
* Default network client for doing requests.
*/
@@ -158,6 +158,7 @@ class EHConfigurator(val context: Context) {
companion object {
private const val PROFILE_NAME = "TachiyomiEH App"
private const val UCONFIG_URL = "/uconfig.php"
// Always use E-H here as EXH does not have a perks page
private const val HATH_PERKS_URL = "https://e-hentai.org/hathperks.php"
private const val PROFILE_SELECTOR = "[name=profile_set] > option"
@@ -131,6 +131,7 @@ private inline class EntryShim<K, V>(private val entry: Map.Entry<K, V>) : FakeM
*/
override val key: K
get() = entry.key
/**
* Returns the value of this key/value pair.
*/
@@ -143,6 +144,7 @@ private inline class PairShim<K, V>(private val pair: Pair<K, V>) : FakeMutableE
* Returns the key of this key/value pair.
*/
override val key: K get() = pair.first
/**
* Returns the value of this key/value pair.
*/
@@ -164,6 +166,7 @@ interface FakeMutableEntry<K, V> : MutableMap.MutableEntry<K, V> {
* Returns the key of this key/value pair.
*/
override val key: K = key
/**
* Returns the value of this key/value pair.
*/