Luscious some updates and fixes (#6824)
* Update LusciousGenerator.kt * Updated Overrides * Update Luscious.kt * Update Luscious.kt
This commit is contained in:
parent
b7110681db
commit
73d269fd24
|
@ -17,6 +17,7 @@ class LusciousFactory : SourceFactory {
|
||||||
LusciousOTHER(),
|
LusciousOTHER(),
|
||||||
LusciousPT(),
|
LusciousPT(),
|
||||||
LusciousTH(),
|
LusciousTH(),
|
||||||
|
LusciousALL(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
class LusciousEN : Luscious("Luscious", "https://www.luscious.net", "en")
|
class LusciousEN : Luscious("Luscious", "https://www.luscious.net", "en")
|
||||||
|
@ -30,3 +31,4 @@ class LusciousKO : Luscious("Luscious", "https://www.luscious.net", "ko")
|
||||||
class LusciousOTHER : Luscious("Luscious", "https://www.luscious.net", "other")
|
class LusciousOTHER : Luscious("Luscious", "https://www.luscious.net", "other")
|
||||||
class LusciousPT : Luscious("Luscious", "https://www.luscious.net", "pt")
|
class LusciousPT : Luscious("Luscious", "https://www.luscious.net", "pt")
|
||||||
class LusciousTH : Luscious("Luscious", "https://www.luscious.net", "th")
|
class LusciousTH : Luscious("Luscious", "https://www.luscious.net", "th")
|
||||||
|
class LusciousALL : Luscious("Luscious", "https://www.luscious.net", "all")
|
||||||
|
|
|
@ -17,6 +17,7 @@ class LusciousAPIFactory : SourceFactory {
|
||||||
LusciousAPIOTHER(),
|
LusciousAPIOTHER(),
|
||||||
LusciousAPIPT(),
|
LusciousAPIPT(),
|
||||||
LusciousAPITH(),
|
LusciousAPITH(),
|
||||||
|
LusciousAPIALL(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
class LusciousAPIEN : Luscious("Luscious (API)", "https://api.luscious.net", "en")
|
class LusciousAPIEN : Luscious("Luscious (API)", "https://api.luscious.net", "en")
|
||||||
|
@ -30,3 +31,4 @@ class LusciousAPIKO : Luscious("Luscious (API)", "https://api.luscious.net", "ko
|
||||||
class LusciousAPIOTHER : Luscious("Luscious (API)", "https://api.luscious.net", "other")
|
class LusciousAPIOTHER : Luscious("Luscious (API)", "https://api.luscious.net", "other")
|
||||||
class LusciousAPIPT : Luscious("Luscious (API)", "https://api.luscious.net", "pt")
|
class LusciousAPIPT : Luscious("Luscious (API)", "https://api.luscious.net", "pt")
|
||||||
class LusciousAPITH : Luscious("Luscious (API)", "https://api.luscious.net", "th")
|
class LusciousAPITH : Luscious("Luscious (API)", "https://api.luscious.net", "th")
|
||||||
|
class LusciousAPIALL : Luscious("Luscious (API)", "https://api.luscious.net", "all")
|
||||||
|
|
|
@ -17,6 +17,7 @@ class LusciousMembersFactory : SourceFactory {
|
||||||
LusciousMembersOTHER(),
|
LusciousMembersOTHER(),
|
||||||
LusciousMembersPT(),
|
LusciousMembersPT(),
|
||||||
LusciousMembersTH(),
|
LusciousMembersTH(),
|
||||||
|
LusciousMembersALL(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
class LusciousMembersEN : Luscious("Luscious (Members)", "https://members.luscious.net", "en")
|
class LusciousMembersEN : Luscious("Luscious (Members)", "https://members.luscious.net", "en")
|
||||||
|
@ -30,3 +31,4 @@ class LusciousMembersKO : Luscious("Luscious (Members)", "https://members.luscio
|
||||||
class LusciousMembersOTHER : Luscious("Luscious (Members)", "https://members.luscious.net", "other")
|
class LusciousMembersOTHER : Luscious("Luscious (Members)", "https://members.luscious.net", "other")
|
||||||
class LusciousMembersPT : Luscious("Luscious (Members)", "https://members.luscious.net", "pt")
|
class LusciousMembersPT : Luscious("Luscious (Members)", "https://members.luscious.net", "pt")
|
||||||
class LusciousMembersTH : Luscious("Luscious (Members)", "https://members.luscious.net", "th")
|
class LusciousMembersTH : Luscious("Luscious (Members)", "https://members.luscious.net", "th")
|
||||||
|
class LusciousMembersALL : Luscious("Luscious (Members)", "https://members.luscious.net", "all")
|
||||||
|
|
|
@ -29,6 +29,8 @@ import okhttp3.Response
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
abstract class Luscious(
|
abstract class Luscious(
|
||||||
override val name: String,
|
override val name: String,
|
||||||
|
@ -42,18 +44,22 @@ abstract class Luscious(
|
||||||
private val apiBaseUrl: String = "$baseUrl/graphql/nobatch/"
|
private val apiBaseUrl: String = "$baseUrl/graphql/nobatch/"
|
||||||
private val gson = Gson()
|
private val gson = Gson()
|
||||||
override val client: OkHttpClient = network.cloudflareClient
|
override val client: OkHttpClient = network.cloudflareClient
|
||||||
private val lusLang: String = when (lang) {
|
private val lusLang: String = toLusLang(lang)
|
||||||
"en" -> "1"
|
private fun toLusLang (lang: String): String {
|
||||||
"ja" -> "2"
|
return when (lang) {
|
||||||
"es" -> "3"
|
"all" -> FILTER_VALUE_IGNORE
|
||||||
"it" -> "4"
|
"en" -> "1"
|
||||||
"de" -> "5"
|
"ja" -> "2"
|
||||||
"fr" -> "6"
|
"es" -> "3"
|
||||||
"zh" -> "8"
|
"it" -> "4"
|
||||||
"ko" -> "9"
|
"de" -> "5"
|
||||||
"pt" -> "100"
|
"fr" -> "6"
|
||||||
"th" -> "101"
|
"zh" -> "8"
|
||||||
else -> "99"
|
"ko" -> "9"
|
||||||
|
"pt" -> "100"
|
||||||
|
"th" -> "101"
|
||||||
|
else -> "99"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val preferences: SharedPreferences by lazy {
|
private val preferences: SharedPreferences by lazy {
|
||||||
|
@ -68,7 +74,7 @@ abstract class Luscious(
|
||||||
val albumTypeFilter = filters.findInstance<AlbumTypeSelectFilter>()!!
|
val albumTypeFilter = filters.findInstance<AlbumTypeSelectFilter>()!!
|
||||||
val interestsFilter = filters.findInstance<InterestGroupFilter>()!!
|
val interestsFilter = filters.findInstance<InterestGroupFilter>()!!
|
||||||
val languagesFilter = filters.findInstance<LanguageGroupFilter>()!!
|
val languagesFilter = filters.findInstance<LanguageGroupFilter>()!!
|
||||||
val tagsFilter = filters.findInstance<TagGroupFilter>()!!
|
val tagsFilter = filters.findInstance<TagTextFilters>()!!
|
||||||
val genreFilter = filters.findInstance<GenreGroupFilter>()!!
|
val genreFilter = filters.findInstance<GenreGroupFilter>()!!
|
||||||
val contentTypeFilter = filters.findInstance<ContentTypeSelectFilter>()!!
|
val contentTypeFilter = filters.findInstance<ContentTypeSelectFilter>()!!
|
||||||
val albumSizeFilter = filters.findInstance<AlbumSizeSelectFilter>()!!
|
val albumSizeFilter = filters.findInstance<AlbumSizeSelectFilter>()!!
|
||||||
|
@ -103,14 +109,22 @@ abstract class Luscious(
|
||||||
add(this.toJsonObject("audience_ids"))
|
add(this.toJsonObject("audience_ids"))
|
||||||
}
|
}
|
||||||
|
|
||||||
add(
|
if (lusLang != FILTER_VALUE_IGNORE){
|
||||||
languagesFilter.toJsonObject("language_ids").apply {
|
add(
|
||||||
set("value", "+$lusLang${get("value").asString}")
|
languagesFilter.toJsonObject("language_ids").apply {
|
||||||
}
|
set("value", "+$lusLang${get("value").asString}")
|
||||||
)
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (tagsFilter.anyNotIgnored()) {
|
if (tagsFilter.state.isNotEmpty()) {
|
||||||
add(tagsFilter.toJsonObject("tagged"))
|
val tags = "+${tagsFilter.state.toLowerCase()}".replace(" ", "_").replace("_,", "+").replace(",_", "+").replace(",", "+").replace("+-", "-").replace("-_", "-").trim()
|
||||||
|
add(
|
||||||
|
JsonObject().apply {
|
||||||
|
addProperty("name", "tagged")
|
||||||
|
addProperty("value", tags)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (genreFilter.anyNotIgnored()) {
|
if (genreFilter.anyNotIgnored()) {
|
||||||
|
@ -185,12 +199,12 @@ abstract class Luscious(
|
||||||
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
||||||
val id = manga.url.substringAfterLast("_").removeSuffix("/")
|
val id = manga.url.substringAfterLast("_").removeSuffix("/")
|
||||||
|
|
||||||
return client.newCall(GET(buildAlbumPicturesPageUrl(id, 1, "position")))
|
return client.newCall(GET(buildAlbumPicturesPageUrl(id, 1)))
|
||||||
.asObservableSuccess()
|
.asObservableSuccess()
|
||||||
.map { parseAlbumPicturesResponse(it, "position", manga.url) }
|
.map { parseAlbumPicturesResponse(it, manga.url) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parseAlbumPicturesResponse(response: Response, sortPagesByOption: String, mangaUrl: String): List<SChapter> {
|
private fun parseAlbumPicturesResponse(response: Response, mangaUrl: String): List<SChapter> {
|
||||||
val chapters = mutableListOf<SChapter>()
|
val chapters = mutableListOf<SChapter>()
|
||||||
when (getMergeChapterPref()){
|
when (getMergeChapterPref()){
|
||||||
true -> {
|
true -> {
|
||||||
|
@ -226,7 +240,7 @@ abstract class Luscious(
|
||||||
chapters.add(chapter)
|
chapters.add(chapter)
|
||||||
}
|
}
|
||||||
if (nextPage) {
|
if (nextPage) {
|
||||||
val newPage = client.newCall(GET(buildAlbumPicturesPageUrl(id, page, sortPagesByOption))).execute()
|
val newPage = client.newCall(GET(buildAlbumPicturesPageUrl(id, page))).execute()
|
||||||
data = gson.fromJson<JsonObject>(newPage.body!!.string())
|
data = gson.fromJson<JsonObject>(newPage.body!!.string())
|
||||||
.let { it["data"]["picture"]["list"].asJsonObject }
|
.let { it["data"]["picture"]["list"].asJsonObject }
|
||||||
}
|
}
|
||||||
|
@ -243,7 +257,7 @@ abstract class Luscious(
|
||||||
|
|
||||||
// Pages
|
// Pages
|
||||||
|
|
||||||
private fun buildAlbumPicturesRequestInput(id: String, page: Int, sortPagesByOption: String): JsonObject {
|
private fun buildAlbumPicturesRequestInput(id: String, page: Int): JsonObject {
|
||||||
return JsonObject().apply {
|
return JsonObject().apply {
|
||||||
addProperty(
|
addProperty(
|
||||||
"input",
|
"input",
|
||||||
|
@ -259,15 +273,15 @@ abstract class Luscious(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
addProperty("display", sortPagesByOption)
|
addProperty("display", getSortPref())
|
||||||
addProperty("page", page)
|
addProperty("page", page)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildAlbumPicturesPageUrl(id: String, page: Int, sortPagesByOption: String): String {
|
private fun buildAlbumPicturesPageUrl(id: String, page: Int): String {
|
||||||
val input = buildAlbumPicturesRequestInput(id, page, sortPagesByOption)
|
val input = buildAlbumPicturesRequestInput(id, page)
|
||||||
return apiBaseUrl.toHttpUrlOrNull()!!.newBuilder()
|
return apiBaseUrl.toHttpUrlOrNull()!!.newBuilder()
|
||||||
.addQueryParameter("operationName", "AlbumListOwnPictures")
|
.addQueryParameter("operationName", "AlbumListOwnPictures")
|
||||||
.addQueryParameter("query", ALBUM_PICTURES_REQUEST_GQL)
|
.addQueryParameter("query", ALBUM_PICTURES_REQUEST_GQL)
|
||||||
|
@ -275,7 +289,7 @@ abstract class Luscious(
|
||||||
.toString()
|
.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parseAlbumPicturesResponseMergeChapter(response: Response, sortPagesByOption: String): List<Page> {
|
private fun parseAlbumPicturesResponseMergeChapter(response: Response): List<Page> {
|
||||||
val pages = mutableListOf<Page>()
|
val pages = mutableListOf<Page>()
|
||||||
var nextPage = true
|
var nextPage = true
|
||||||
var page = 2
|
var page = 2
|
||||||
|
@ -300,7 +314,7 @@ abstract class Luscious(
|
||||||
pages.add(Page(index, url, url))
|
pages.add(Page(index, url, url))
|
||||||
}
|
}
|
||||||
if (nextPage) {
|
if (nextPage) {
|
||||||
val newPage = client.newCall(GET(buildAlbumPicturesPageUrl(id, page, sortPagesByOption))).execute()
|
val newPage = client.newCall(GET(buildAlbumPicturesPageUrl(id, page))).execute()
|
||||||
data = gson.fromJson<JsonObject>(newPage.body!!.string())
|
data = gson.fromJson<JsonObject>(newPage.body!!.string())
|
||||||
.let { it["data"]["picture"]["list"].asJsonObject }
|
.let { it["data"]["picture"]["list"].asJsonObject }
|
||||||
}
|
}
|
||||||
|
@ -314,9 +328,9 @@ abstract class Luscious(
|
||||||
true -> {
|
true -> {
|
||||||
val id = chapter.url.substringAfterLast("_").removeSuffix("/")
|
val id = chapter.url.substringAfterLast("_").removeSuffix("/")
|
||||||
|
|
||||||
client.newCall(GET(buildAlbumPicturesPageUrl(id, 1, "position")))
|
client.newCall(GET(buildAlbumPicturesPageUrl(id, 1)))
|
||||||
.asObservableSuccess()
|
.asObservableSuccess()
|
||||||
.map { parseAlbumPicturesResponseMergeChapter(it, "position") }
|
.map { parseAlbumPicturesResponseMergeChapter(it) }
|
||||||
}
|
}
|
||||||
false -> {
|
false -> {
|
||||||
Observable.just(listOf(Page(0, chapter.url, chapter.url)))
|
Observable.just(listOf(Page(0, chapter.url, chapter.url)))
|
||||||
|
@ -428,7 +442,8 @@ abstract class Luscious(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TagGroupFilter(filters: List<TriStateFilterOption>) : TriStateGroupFilter("Tags", filters)
|
open class TextFilter(name: String) : Filter.Text(name)
|
||||||
|
|
||||||
private class GenreGroupFilter(filters: List<TriStateFilterOption>) : TriStateGroupFilter("Genres", filters)
|
private class GenreGroupFilter(filters: List<TriStateFilterOption>) : TriStateGroupFilter("Genres", filters)
|
||||||
|
|
||||||
class CheckboxFilterOption(name: String, val value: String, default: Boolean = true) : Filter.CheckBox(name, default)
|
class CheckboxFilterOption(name: String, val value: String, default: Boolean = true) : Filter.CheckBox(name, default)
|
||||||
|
@ -455,7 +470,7 @@ abstract class Luscious(
|
||||||
class ContentTypeSelectFilter(options: List<SelectFilterOption>) : SelectFilter("Content Type", options)
|
class ContentTypeSelectFilter(options: List<SelectFilterOption>) : SelectFilter("Content Type", options)
|
||||||
class RestrictGenresSelectFilter(options: List<SelectFilterOption>) : SelectFilter("Restrict Genres", options)
|
class RestrictGenresSelectFilter(options: List<SelectFilterOption>) : SelectFilter("Restrict Genres", options)
|
||||||
class AlbumSizeSelectFilter(options: List<SelectFilterOption>) : SelectFilter("Album Size", options)
|
class AlbumSizeSelectFilter(options: List<SelectFilterOption>) : SelectFilter("Album Size", options)
|
||||||
|
class TagTextFilters : TextFilter("Tags")
|
||||||
override fun getFilterList(): FilterList = getSortFilters(POPULAR_DEFAULT_SORT_STATE)
|
override fun getFilterList(): FilterList = getSortFilters(POPULAR_DEFAULT_SORT_STATE)
|
||||||
|
|
||||||
private fun getSortFilters(sortState: Int) = FilterList(
|
private fun getSortFilters(sortState: Int) = FilterList(
|
||||||
|
@ -466,69 +481,71 @@ abstract class Luscious(
|
||||||
RestrictGenresSelectFilter(getRestrictGenresFilters()),
|
RestrictGenresSelectFilter(getRestrictGenresFilters()),
|
||||||
InterestGroupFilter(getInterestFilters()),
|
InterestGroupFilter(getInterestFilters()),
|
||||||
LanguageGroupFilter(getLanguageFilters()),
|
LanguageGroupFilter(getLanguageFilters()),
|
||||||
TagGroupFilter(getTagFilters()),
|
GenreGroupFilter(getGenreFilters()),
|
||||||
GenreGroupFilter(getGenreFilters())
|
Filter.Header("Separate tags with commas (,)"),
|
||||||
|
Filter.Header("Prepend with dash (-) to exclude"),
|
||||||
|
TagTextFilters(),
|
||||||
)
|
)
|
||||||
|
|
||||||
fun getSortFilters() = listOf(
|
|
||||||
SelectFilterOption("Rating - All Time", "rating_all_time"),
|
|
||||||
SelectFilterOption("Rating - Last 7 Days", "rating_7_days"),
|
|
||||||
SelectFilterOption("Rating - Last 14 Days", "rating_14_days"),
|
|
||||||
SelectFilterOption("Rating - Last 30 Days", "rating_30_days"),
|
|
||||||
SelectFilterOption("Rating - Last 90 Days", "rating_90_days"),
|
|
||||||
SelectFilterOption("Rating - Last Year", "rating_1_year"),
|
|
||||||
SelectFilterOption("Date - Newest First", "date_newest"),
|
|
||||||
SelectFilterOption("Date - 2020", "date_2021"),
|
|
||||||
SelectFilterOption("Date - 2020", "date_2020"),
|
|
||||||
SelectFilterOption("Date - 2019", "date_2019"),
|
|
||||||
SelectFilterOption("Date - 2018", "date_2018"),
|
|
||||||
SelectFilterOption("Date - 2017", "date_2017"),
|
|
||||||
SelectFilterOption("Date - 2016", "date_2016"),
|
|
||||||
SelectFilterOption("Date - 2015", "date_2015"),
|
|
||||||
SelectFilterOption("Date - 2014", "date_2014"),
|
|
||||||
SelectFilterOption("Date - 2013", "date_2013"),
|
|
||||||
SelectFilterOption("Date - Oldest First", "date_oldest"),
|
|
||||||
SelectFilterOption("Date - Upcoming", "date_upcoming"),
|
|
||||||
SelectFilterOption("Date - Trending", "date_trending"),
|
|
||||||
SelectFilterOption("Date - Featured", "date_featured"),
|
|
||||||
SelectFilterOption("Date - Last Viewed", "date_last_interaction"),
|
|
||||||
SelectFilterOption("First Letter - Any", "alpha_any"),
|
|
||||||
SelectFilterOption("First Letter - A", "alpha_a"),
|
|
||||||
SelectFilterOption("First Letter - B", "alpha_b"),
|
|
||||||
SelectFilterOption("First Letter - C", "alpha_c"),
|
|
||||||
SelectFilterOption("First Letter - D", "alpha_d"),
|
|
||||||
SelectFilterOption("First Letter - Any", "alpha_any"),
|
|
||||||
SelectFilterOption("First Letter - A", "alpha_a"),
|
|
||||||
SelectFilterOption("First Letter - B", "alpha_b"),
|
|
||||||
SelectFilterOption("First Letter - C", "alpha_c"),
|
|
||||||
SelectFilterOption("First Letter - D", "alpha_d"),
|
|
||||||
SelectFilterOption("First Letter - E", "alpha_e"),
|
|
||||||
SelectFilterOption("First Letter - F", "alpha_f"),
|
|
||||||
SelectFilterOption("First Letter - G", "alpha_g"),
|
|
||||||
SelectFilterOption("First Letter - H", "alpha_h"),
|
|
||||||
SelectFilterOption("First Letter - I", "alpha_i"),
|
|
||||||
SelectFilterOption("First Letter - J", "alpha_j"),
|
|
||||||
SelectFilterOption("First Letter - K", "alpha_k"),
|
|
||||||
SelectFilterOption("First Letter - L", "alpha_l"),
|
|
||||||
SelectFilterOption("First Letter - M", "alpha_m"),
|
|
||||||
SelectFilterOption("First Letter - N", "alpha_n"),
|
|
||||||
SelectFilterOption("First Letter - O", "alpha_o"),
|
|
||||||
SelectFilterOption("First Letter - P", "alpha_p"),
|
|
||||||
SelectFilterOption("First Letter - Q", "alpha_q"),
|
|
||||||
SelectFilterOption("First Letter - R", "alpha_r"),
|
|
||||||
SelectFilterOption("First Letter - S", "alpha_s"),
|
|
||||||
SelectFilterOption("First Letter - T", "alpha_t"),
|
|
||||||
SelectFilterOption("First Letter - U", "alpha_u"),
|
|
||||||
SelectFilterOption("First Letter - V", "alpha_v"),
|
|
||||||
SelectFilterOption("First Letter - W", "alpha_w"),
|
|
||||||
SelectFilterOption("First Letter - X", "alpha_x"),
|
|
||||||
SelectFilterOption("First Letter - Y", "alpha_y"),
|
|
||||||
SelectFilterOption("First Letter - Z", "alpha_z"),
|
|
||||||
)
|
|
||||||
|
|
||||||
fun getAlbumTypeFilters() = listOf(
|
private fun getSortFilters(): List<SelectFilterOption> {
|
||||||
SelectFilterOption("Manga", "manga"),
|
val sortOptions = mutableListOf<SelectFilterOption>()
|
||||||
|
listOf(
|
||||||
|
SelectFilterOption("Rating - All Time", "rating_all_time"),
|
||||||
|
SelectFilterOption("Rating - Last 7 Days", "rating_7_days"),
|
||||||
|
SelectFilterOption("Rating - Last 14 Days", "rating_14_days"),
|
||||||
|
SelectFilterOption("Rating - Last 30 Days", "rating_30_days"),
|
||||||
|
SelectFilterOption("Rating - Last 90 Days", "rating_90_days"),
|
||||||
|
SelectFilterOption("Rating - Last Year", "rating_1_year"),
|
||||||
|
SelectFilterOption("Date - Newest First", "date_newest"),
|
||||||
|
SelectFilterOption("Date - Oldest First", "date_oldest"),
|
||||||
|
SelectFilterOption("Date - Upcoming", "date_upcoming"),
|
||||||
|
SelectFilterOption("Date - Trending", "date_trending"),
|
||||||
|
SelectFilterOption("Date - Featured", "date_featured"),
|
||||||
|
SelectFilterOption("Date - Last Viewed", "date_last_interaction"),
|
||||||
|
).forEach {
|
||||||
|
sortOptions.add(it)
|
||||||
|
}
|
||||||
|
validYears().map {
|
||||||
|
sortOptions.add(SelectFilterOption("Date - $it", "date_$it"))
|
||||||
|
}
|
||||||
|
listOf(
|
||||||
|
SelectFilterOption("First Letter - Any", "alpha_any"),
|
||||||
|
SelectFilterOption("First Letter - A", "alpha_a"),
|
||||||
|
SelectFilterOption("First Letter - B", "alpha_b"),
|
||||||
|
SelectFilterOption("First Letter - C", "alpha_c"),
|
||||||
|
SelectFilterOption("First Letter - D", "alpha_d"),
|
||||||
|
SelectFilterOption("First Letter - E", "alpha_e"),
|
||||||
|
SelectFilterOption("First Letter - F", "alpha_f"),
|
||||||
|
SelectFilterOption("First Letter - G", "alpha_g"),
|
||||||
|
SelectFilterOption("First Letter - H", "alpha_h"),
|
||||||
|
SelectFilterOption("First Letter - I", "alpha_i"),
|
||||||
|
SelectFilterOption("First Letter - J", "alpha_j"),
|
||||||
|
SelectFilterOption("First Letter - K", "alpha_k"),
|
||||||
|
SelectFilterOption("First Letter - L", "alpha_l"),
|
||||||
|
SelectFilterOption("First Letter - M", "alpha_m"),
|
||||||
|
SelectFilterOption("First Letter - N", "alpha_n"),
|
||||||
|
SelectFilterOption("First Letter - O", "alpha_o"),
|
||||||
|
SelectFilterOption("First Letter - P", "alpha_p"),
|
||||||
|
SelectFilterOption("First Letter - Q", "alpha_q"),
|
||||||
|
SelectFilterOption("First Letter - R", "alpha_r"),
|
||||||
|
SelectFilterOption("First Letter - S", "alpha_s"),
|
||||||
|
SelectFilterOption("First Letter - T", "alpha_t"),
|
||||||
|
SelectFilterOption("First Letter - U", "alpha_u"),
|
||||||
|
SelectFilterOption("First Letter - V", "alpha_v"),
|
||||||
|
SelectFilterOption("First Letter - W", "alpha_w"),
|
||||||
|
SelectFilterOption("First Letter - X", "alpha_x"),
|
||||||
|
SelectFilterOption("First Letter - Y", "alpha_y"),
|
||||||
|
SelectFilterOption("First Letter - Z", "alpha_z"),
|
||||||
|
).forEach {
|
||||||
|
sortOptions.add(it)
|
||||||
|
}
|
||||||
|
return sortOptions
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getAlbumTypeFilters() = listOf(
|
||||||
SelectFilterOption("All", FILTER_VALUE_IGNORE),
|
SelectFilterOption("All", FILTER_VALUE_IGNORE),
|
||||||
|
SelectFilterOption("Manga", "manga"),
|
||||||
SelectFilterOption("Pictures", "pictures")
|
SelectFilterOption("Pictures", "pictures")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -538,7 +555,7 @@ abstract class Luscious(
|
||||||
SelectFilterOption("Strict", "strict")
|
SelectFilterOption("Strict", "strict")
|
||||||
)
|
)
|
||||||
|
|
||||||
fun getContentTypeFilters() = listOf(
|
private fun getContentTypeFilters() = listOf(
|
||||||
SelectFilterOption("All", FILTER_VALUE_IGNORE),
|
SelectFilterOption("All", FILTER_VALUE_IGNORE),
|
||||||
SelectFilterOption("Hentai", "0"),
|
SelectFilterOption("Hentai", "0"),
|
||||||
SelectFilterOption("Non-Erotic", "5"),
|
SelectFilterOption("Non-Erotic", "5"),
|
||||||
|
@ -556,9 +573,9 @@ abstract class Luscious(
|
||||||
SelectFilterOption("3200-12800", "6"),
|
SelectFilterOption("3200-12800", "6"),
|
||||||
)
|
)
|
||||||
|
|
||||||
fun getInterestFilters() = listOf(
|
private fun getInterestFilters() = listOf(
|
||||||
CheckboxFilterOption("Straight Sex", "1"),
|
CheckboxFilterOption("Straight Sex", "1"),
|
||||||
CheckboxFilterOption("Trans x Girl", "10", false),
|
CheckboxFilterOption("Trans x Girl", "10"),
|
||||||
CheckboxFilterOption("Gay / Yaoi", "2"),
|
CheckboxFilterOption("Gay / Yaoi", "2"),
|
||||||
CheckboxFilterOption("Lesbian / Yuri", "3"),
|
CheckboxFilterOption("Lesbian / Yuri", "3"),
|
||||||
CheckboxFilterOption("Trans", "5"),
|
CheckboxFilterOption("Trans", "5"),
|
||||||
|
@ -567,63 +584,26 @@ abstract class Luscious(
|
||||||
CheckboxFilterOption("Trans x Guy", "9")
|
CheckboxFilterOption("Trans x Guy", "9")
|
||||||
)
|
)
|
||||||
|
|
||||||
fun getLanguageFilters() = listOf(
|
private fun getLanguageFilters() = listOf(
|
||||||
CheckboxFilterOption("English", ENGLISH_LUS_LANG_VAL, false),
|
CheckboxFilterOption("English", toLusLang("en"), false),
|
||||||
CheckboxFilterOption("Japanese", JAPANESE_LUS_LANG_VAL, false),
|
CheckboxFilterOption("Japanese", toLusLang("ja"), false),
|
||||||
CheckboxFilterOption("Spanish", SPANISH_LUS_LANG_VAL, false),
|
CheckboxFilterOption("Spanish", toLusLang("es"), false),
|
||||||
CheckboxFilterOption("Italian", ITALIAN_LUS_LANG_VAL, false),
|
CheckboxFilterOption("Italian", toLusLang("it"), false),
|
||||||
CheckboxFilterOption("German", GERMAN_LUS_LANG_VAL, false),
|
CheckboxFilterOption("German", toLusLang("de"), false),
|
||||||
CheckboxFilterOption("French", FRENCH_LUS_LANG_VAL, false),
|
CheckboxFilterOption("French", toLusLang("fr"), false),
|
||||||
CheckboxFilterOption("Chinese", CHINESE_LUS_LANG_VAL, false),
|
CheckboxFilterOption("Chinese", toLusLang("zh"), false),
|
||||||
CheckboxFilterOption("Korean", KOREAN_LUS_LANG_VAL, false),
|
CheckboxFilterOption("Korean", toLusLang("ko"), false),
|
||||||
CheckboxFilterOption("Others", OTHERS_LUS_LANG_VAL, false),
|
CheckboxFilterOption("Others", toLusLang("other"), false),
|
||||||
CheckboxFilterOption("Portugese", PORTUGESE_LUS_LANG_VAL, false),
|
CheckboxFilterOption("Portugese", toLusLang("pt"), false),
|
||||||
CheckboxFilterOption("Thai", THAI_LUS_LANG_VAL, false)
|
CheckboxFilterOption("Thai", toLusLang("th"), false)
|
||||||
).filterNot { it.value == lusLang }
|
).filterNot { it.value == lusLang }
|
||||||
|
|
||||||
fun getTagFilters() = listOf(
|
|
||||||
TriStateFilterOption("Big Breasts", "big_breasts"),
|
|
||||||
TriStateFilterOption("Blowjob", "blowjob"),
|
|
||||||
TriStateFilterOption("Anal", "anal"),
|
|
||||||
TriStateFilterOption("Group", "group"),
|
|
||||||
TriStateFilterOption("Big Ass", "big_ass"),
|
|
||||||
TriStateFilterOption("Full Color", "full_color"),
|
|
||||||
TriStateFilterOption("Schoolgirl", "schoolgirl"),
|
|
||||||
TriStateFilterOption("Rape", "rape"),
|
|
||||||
TriStateFilterOption("Glasses", "glasses"),
|
|
||||||
TriStateFilterOption("Nakadashi", "nakadashi"),
|
|
||||||
TriStateFilterOption("Yuri", "yuri"),
|
|
||||||
TriStateFilterOption("Paizuri", "paizuri"),
|
|
||||||
TriStateFilterOption("Ahegao", "ahegao"),
|
|
||||||
TriStateFilterOption("Group: metart", "group%3A_metart"),
|
|
||||||
TriStateFilterOption("Brunette", "brunette"),
|
|
||||||
TriStateFilterOption("Solo", "solo"),
|
|
||||||
TriStateFilterOption("Blonde", "blonde"),
|
|
||||||
TriStateFilterOption("Shaved Pussy", "shaved_pussy"),
|
|
||||||
TriStateFilterOption("Small Breasts", "small_breasts"),
|
|
||||||
TriStateFilterOption("Cum", "cum"),
|
|
||||||
TriStateFilterOption("Stockings", "stockings"),
|
|
||||||
TriStateFilterOption("Yuri", "yuri"),
|
|
||||||
TriStateFilterOption("Ass", "ass"),
|
|
||||||
TriStateFilterOption("Creampie", "creampie"),
|
|
||||||
TriStateFilterOption("Rape", "rape"),
|
|
||||||
TriStateFilterOption("Oral Sex", "oral_sex"),
|
|
||||||
TriStateFilterOption("Bondage", "bondage"),
|
|
||||||
TriStateFilterOption("Futanari", "futanari"),
|
|
||||||
TriStateFilterOption("Double Penetration", "double_penetration"),
|
|
||||||
TriStateFilterOption("Threesome", "threesome"),
|
|
||||||
TriStateFilterOption("Anal Sex", "anal_sex"),
|
|
||||||
TriStateFilterOption("Big Cock", "big_cock"),
|
|
||||||
TriStateFilterOption("Straight Sex", "straight_sex"),
|
|
||||||
TriStateFilterOption("Yaoi", "yaoi")
|
|
||||||
)
|
|
||||||
|
|
||||||
fun getGenreFilters() = listOf(
|
private fun getGenreFilters() = listOf(
|
||||||
TriStateFilterOption("3D / Digital Art", "25"),
|
TriStateFilterOption("3D / Digital Art", "25"),
|
||||||
TriStateFilterOption("Amateurs", "20"),
|
TriStateFilterOption("Amateurs", "20"),
|
||||||
TriStateFilterOption("Artist Collection", "19"),
|
TriStateFilterOption("Artist Collection", "19"),
|
||||||
TriStateFilterOption("Asian Girls", "12"),
|
TriStateFilterOption("Asian Girls", "12"),
|
||||||
TriStateFilterOption("Cosplay", "22"),
|
|
||||||
TriStateFilterOption("BDSM", "27"),
|
TriStateFilterOption("BDSM", "27"),
|
||||||
TriStateFilterOption("Cross-Dressing", "30"),
|
TriStateFilterOption("Cross-Dressing", "30"),
|
||||||
TriStateFilterOption("Defloration / First Time", "59"),
|
TriStateFilterOption("Defloration / First Time", "59"),
|
||||||
|
@ -655,8 +635,8 @@ abstract class Luscious(
|
||||||
TriStateFilterOption("Sex Workers", "47"),
|
TriStateFilterOption("Sex Workers", "47"),
|
||||||
TriStateFilterOption("Softcore / Ecchi", "9"),
|
TriStateFilterOption("Softcore / Ecchi", "9"),
|
||||||
TriStateFilterOption("Superheroes", "17"),
|
TriStateFilterOption("Superheroes", "17"),
|
||||||
TriStateFilterOption("Tankobon", "45"),
|
|
||||||
TriStateFilterOption("TV / Movies", "51"),
|
TriStateFilterOption("TV / Movies", "51"),
|
||||||
|
TriStateFilterOption("Tankōbon", "45"),
|
||||||
TriStateFilterOption("Trans", "14"),
|
TriStateFilterOption("Trans", "14"),
|
||||||
TriStateFilterOption("Video Games", "15"),
|
TriStateFilterOption("Video Games", "15"),
|
||||||
TriStateFilterOption("Vintage", "58"),
|
TriStateFilterOption("Vintage", "58"),
|
||||||
|
@ -666,19 +646,21 @@ abstract class Luscious(
|
||||||
|
|
||||||
private inline fun <reified T> Iterable<*>.findInstance() = find { it is T } as? T
|
private inline fun <reified T> Iterable<*>.findInstance() = find { it is T } as? T
|
||||||
|
|
||||||
companion object {
|
private fun validYears(): List<Int>{
|
||||||
|
val years = mutableListOf<Int>()
|
||||||
|
val current = LocalDateTime.now()
|
||||||
|
val formatter = DateTimeFormatter.ofPattern("yyyy")
|
||||||
|
val formatted = current.format(formatter)
|
||||||
|
val currentYear = formatted.toInt()
|
||||||
|
var firstYear = 2013
|
||||||
|
while (currentYear != firstYear -1) {
|
||||||
|
years.add(firstYear)
|
||||||
|
firstYear++
|
||||||
|
}
|
||||||
|
return years.reversed()
|
||||||
|
}
|
||||||
|
|
||||||
const val ENGLISH_LUS_LANG_VAL = "1"
|
companion object {
|
||||||
const val JAPANESE_LUS_LANG_VAL = "2"
|
|
||||||
const val SPANISH_LUS_LANG_VAL = "3"
|
|
||||||
const val ITALIAN_LUS_LANG_VAL = "4"
|
|
||||||
const val GERMAN_LUS_LANG_VAL = "5"
|
|
||||||
const val FRENCH_LUS_LANG_VAL = "6"
|
|
||||||
const val CHINESE_LUS_LANG_VAL = "8"
|
|
||||||
const val KOREAN_LUS_LANG_VAL = "9"
|
|
||||||
const val OTHERS_LUS_LANG_VAL = "99"
|
|
||||||
const val PORTUGESE_LUS_LANG_VAL = "100"
|
|
||||||
const val THAI_LUS_LANG_VAL = "101"
|
|
||||||
|
|
||||||
private const val POPULAR_DEFAULT_SORT_STATE = 0
|
private const val POPULAR_DEFAULT_SORT_STATE = 0
|
||||||
private const val LATEST_DEFAULT_SORT_STATE = 7
|
private const val LATEST_DEFAULT_SORT_STATE = 7
|
||||||
|
@ -752,7 +734,13 @@ abstract class Luscious(
|
||||||
private const val RESOLUTION_PREF_TITLE = "Image resolution"
|
private const val RESOLUTION_PREF_TITLE = "Image resolution"
|
||||||
private val RESOLUTION_PREF_ENTRIES = arrayOf("Low", "Medium", "High", "Original")
|
private val RESOLUTION_PREF_ENTRIES = arrayOf("Low", "Medium", "High", "Original")
|
||||||
private val RESOLUTION_PREF_ENTRY_VALUES = arrayOf("2", "1", "0", "-1")
|
private val RESOLUTION_PREF_ENTRY_VALUES = arrayOf("2", "1", "0", "-1")
|
||||||
private val RESOLUTION_PREF_DEFAULT_VALUE = RESOLUTION_PREF_ENTRY_VALUES[3]
|
private val RESOLUTION_PREF_DEFAULT_VALUE = RESOLUTION_PREF_ENTRY_VALUES[2]
|
||||||
|
|
||||||
|
private const val SORT_PREF_KEY = "SORT"
|
||||||
|
private const val SORT_PREF_TITLE = "Page Sort"
|
||||||
|
private val SORT_PREF_ENTRIES = arrayOf("Position", "Date", "Rating")
|
||||||
|
private val SORT_PREF_ENTRY_VALUES = arrayOf("position", "date_newest", "rating_all_time")
|
||||||
|
private val SORT_PREF_DEFAULT_VALUE = SORT_PREF_ENTRY_VALUES[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
|
@ -771,6 +759,21 @@ abstract class Luscious(
|
||||||
preferences.edit().putString("${RESOLUTION_PREF_KEY}_$lang", entry).commit()
|
preferences.edit().putString("${RESOLUTION_PREF_KEY}_$lang", entry).commit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val sortPref = ListPreference(screen.context).apply {
|
||||||
|
key = "${SORT_PREF_KEY}_$lang"
|
||||||
|
title = SORT_PREF_TITLE
|
||||||
|
entries = SORT_PREF_ENTRIES
|
||||||
|
entryValues = SORT_PREF_ENTRY_VALUES
|
||||||
|
setDefaultValue(SORT_PREF_DEFAULT_VALUE)
|
||||||
|
summary = "%s"
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
val selected = newValue as String
|
||||||
|
val index = findIndexOfValue(selected)
|
||||||
|
val entry = entryValues[index] as String
|
||||||
|
preferences.edit().putString("${SORT_PREF_KEY}_$lang", entry).commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
val mergeChapterPref = CheckBoxPreference(screen.context).apply {
|
val mergeChapterPref = CheckBoxPreference(screen.context).apply {
|
||||||
key = "${MERGE_CHAPTER_PREF_KEY}_$lang"
|
key = "${MERGE_CHAPTER_PREF_KEY}_$lang"
|
||||||
title = MERGE_CHAPTER_PREF_TITLE
|
title = MERGE_CHAPTER_PREF_TITLE
|
||||||
|
@ -783,9 +786,11 @@ abstract class Luscious(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
screen.addPreference(resolutionPref)
|
screen.addPreference(resolutionPref)
|
||||||
|
screen.addPreference(sortPref)
|
||||||
screen.addPreference(mergeChapterPref)
|
screen.addPreference(mergeChapterPref)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getMergeChapterPref(): Boolean = preferences.getBoolean("${MERGE_CHAPTER_PREF_KEY}_$lang", MERGE_CHAPTER_PREF_DEFAULT_VALUE)
|
private fun getMergeChapterPref(): Boolean = preferences.getBoolean("${MERGE_CHAPTER_PREF_KEY}_$lang", MERGE_CHAPTER_PREF_DEFAULT_VALUE)
|
||||||
private fun getResolutionPref(): String? = preferences.getString("${RESOLUTION_PREF_KEY}_$lang", RESOLUTION_PREF_DEFAULT_VALUE)
|
private fun getResolutionPref(): String? = preferences.getString("${RESOLUTION_PREF_KEY}_$lang", RESOLUTION_PREF_DEFAULT_VALUE)
|
||||||
|
private fun getSortPref(): String? = preferences.getString("${SORT_PREF_KEY}_$lang", SORT_PREF_DEFAULT_VALUE)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,12 @@ class LusciousGenerator : ThemeSourceGenerator {
|
||||||
|
|
||||||
override val themeClass = "Luscious"
|
override val themeClass = "Luscious"
|
||||||
|
|
||||||
override val baseVersionCode: Int = 4
|
override val baseVersionCode: Int = 5
|
||||||
|
|
||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
MultiLang("Luscious", "https://www.luscious.net", listOf("en","ja", "es", "it", "de", "fr", "zh", "ko", "other", "pt", "th"), isNsfw = true, className = "LusciousFactory", overrideVersionCode = 2),
|
MultiLang("Luscious", "https://www.luscious.net", listOf("en","ja", "es", "it", "de", "fr", "zh", "ko", "other", "pt", "th", "all"), isNsfw = true, className = "LusciousFactory", overrideVersionCode = 2),
|
||||||
MultiLang("Luscious (Members)", "https://members.luscious.net", listOf("en","ja", "es", "it", "de", "fr", "zh", "ko", "other", "pt", "th"), isNsfw = true, className = "LusciousMembersFactory", pkgName = "lusciousmembers"),//Requires Account
|
MultiLang("Luscious (Members)", "https://members.luscious.net", listOf("en","ja", "es", "it", "de", "fr", "zh", "ko", "other", "pt", "th", "all"), isNsfw = true, className = "LusciousMembersFactory", pkgName = "lusciousmembers"),//Requires Account
|
||||||
MultiLang("Luscious (API)", "https://api.luscious.net", listOf("en","ja", "es", "it", "de", "fr", "zh", "ko", "other", "pt", "th"), isNsfw = true, className = "LusciousAPIFactory", pkgName = "lusciousapi")
|
MultiLang("Luscious (API)", "https://api.luscious.net", listOf("en","ja", "es", "it", "de", "fr", "zh", "ko", "other", "pt", "th", "all"), isNsfw = true, className = "LusciousAPIFactory", pkgName = "lusciousapi")
|
||||||
)
|
)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
Loading…
Reference in New Issue