E-Hentai: switch to SourceFactory

This commit is contained in:
Eugene 2019-10-27 15:24:12 -04:00
parent 40c5cb33aa
commit 170c382b15
No known key found for this signature in database
GPG Key ID: E1FD745328866B0A
6 changed files with 145 additions and 152 deletions

View File

@ -4,8 +4,8 @@ apply plugin: 'kotlin-android'
ext {
appName = 'Tachiyomi: E-Hentai'
pkgNameSuffix = 'all.ehentai'
extClass = '.EHJapanese; .EHEnglish; .EHChinese; .EHDutch; .EHFrench; .EHGerman; .EHHungarian; .EHItalian; .EHKorean; .EHPolish; .EHPortuguese; .EHRussian; .EHSpanish; .EHThai; .EHVietnamese; .EHSpeechless; .EHOther'
extVersionCode = 6
extClass = '.EHFactory'
extVersionCode = 7
libVersion = '1.2'
}

View File

@ -0,0 +1,26 @@
package eu.kanade.tachiyomi.extension.all.ehentai
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory
class EHFactory : SourceFactory {
override fun createSources(): List<Source> = listOf(
EHentai("ja", "japanese"),
EHentai("en", "english"),
EHentai("zh", "chinese"),
EHentai("nl", "dutch"),
EHentai("fr", "french"),
EHentai("de", "german"),
EHentai("hu", "hungarian"),
EHentai("it", "italian"),
EHentai("ko", "korean"),
EHentai("pl", "polish"),
EHentai("pt", "portuguese"),
EHentai("ru", "russian"),
EHentai("es", "spanish"),
EHentai("th", "thai"),
EHentai("vi", "vietnamese"),
EHentai("none", "n/a"),
EHentai("other", "other")
)
}

View File

@ -1,42 +0,0 @@
package eu.kanade.tachiyomi.extension.all.ehentai
/**
* E-Hentai languages
*/
class EHJapanese : EHentai("ja", "japanese")
class EHEnglish : EHentai("en", "english")
class EHChinese : EHentai("zh", "chinese")
class EHDutch : EHentai("nl", "dutch")
class EHFrench : EHentai("fr", "french")
class EHGerman : EHentai("de", "german")
class EHHungarian : EHentai("hu", "hungarian")
class EHItalian : EHentai("it", "italian")
class EHKorean : EHentai("ko", "korean")
class EHPolish : EHentai("pl", "polish")
class EHPortuguese : EHentai("pt", "portuguese")
class EHRussian : EHentai("ru", "russian")
class EHSpanish : EHentai("es", "spanish")
class EHThai : EHentai("th", "thai")
class EHVietnamese : EHentai("vi", "vietnamese")
class EHSpeechless : EHentai("none", "n/a")
class EHOther : EHentai("other", "other")
fun getAllEHentaiLanguages() = listOf(
EHJapanese(),
EHEnglish(),
EHChinese(),
EHDutch(),
EHFrench(),
EHGerman(),
EHHungarian(),
EHItalian(),
EHKorean(),
EHPolish(),
EHPortuguese(),
EHRussian(),
EHSpanish(),
EHThai(),
EHVietnamese(),
EHSpeechless(),
EHOther()
)

View File

@ -3,10 +3,19 @@ package eu.kanade.tachiyomi.extension.all.ehentai
import android.net.Uri
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.source.model.*
import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.*
import okhttp3.CacheControl
import okhttp3.CookieJar
import okhttp3.Headers
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Element
import rx.Observable
import java.net.URLEncoder
@ -314,7 +323,7 @@ open class EHentai(override val lang: String, private val ehLang: String) : Http
}
//Explicit type arg for listOf() to workaround this: KT-16570
class AdvancedGroup : UriGroup<Filter<*>>("Advanced Options", listOf<Filter<*>>(
class AdvancedGroup : UriGroup<Filter<*>>("Advanced Options", listOf(
AdvancedOption("Search Gallery Name", "f_sname", true),
AdvancedOption("Search Gallery Tags", "f_stags", true),
AdvancedOption("Search Gallery Description", "f_sdesc"),

View File

@ -2,7 +2,8 @@ package eu.kanade.tachiyomi.extension.all.ehentai
import eu.kanade.tachiyomi.source.model.SManga
import java.text.SimpleDateFormat
import java.util.*
import java.util.Date
import java.util.Locale
private const val EH_ARTIST_NAMESPACE = "artist"
private const val EH_AUTHOR_NAMESPACE = "author"

View File

@ -1,7 +1,6 @@
package eu.kanade.tachiyomi.extension.all.ehentai;
package eu.kanade.tachiyomi.extension.all.ehentai
/**
* Simple tag model
*/
data class Tag(val name: String, val light: Boolean)