From f0caf41d3236822dd183ef4a1bdd0b194d90c9e0 Mon Sep 17 00:00:00 2001 From: Johannes Joens <34899572+jopejoe1@users.noreply.github.com> Date: Fri, 21 May 2021 22:13:21 +1200 Subject: [PATCH] Luscious: Added date and filter (#7146) * Update Luscious.kt * Update LusciousGenerator.kt --- .../tachiyomi/multisrc/luscious/Luscious.kt | 31 +++++++++++++++++-- .../multisrc/luscious/LusciousGenerator.kt | 2 +- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/luscious/Luscious.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/luscious/Luscious.kt index ced405811..a2bd6bce6 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/luscious/Luscious.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/luscious/Luscious.kt @@ -71,6 +71,7 @@ abstract class Luscious( private fun buildAlbumListRequestInput(page: Int, filters: FilterList, query: String = ""): JsonObject { val sortByFilter = filters.findInstance()!! val albumTypeFilter = filters.findInstance()!! + val selectionFilter = filters.findInstance()!! val interestsFilter = filters.findInstance()!! val languagesFilter = filters.findInstance()!! val tagsFilter = filters.findInstance()!! @@ -80,7 +81,6 @@ abstract class Luscious( val contentTypeFilter = filters.findInstance()!! val albumSizeFilter = filters.findInstance()!! val restrictGenresFilter = filters.findInstance()!! - return JsonObject().apply { add( "input", @@ -97,6 +97,9 @@ abstract class Luscious( if (albumTypeFilter.selected != FILTER_VALUE_IGNORE) add(albumTypeFilter.toJsonObject("album_type")) + if (selectionFilter.selected != FILTER_VALUE_IGNORE) + add(selectionFilter.toJsonObject("selection")) + if (albumSizeFilter.selected != FILTER_VALUE_IGNORE) add(albumSizeFilter.toJsonObject("picture_count_rank")) @@ -254,7 +257,7 @@ abstract class Luscious( else -> it["thumbnails"][getResolutionPref()?.toInt()!!]["url"].asString } chapter.name = it["title"].asString - //chapter.date_upload = it["created"].asLong // not parsing correctly for some reason + chapter.date_upload = "${it["created"].asLong}000".toLong() chapter.chapter_number = it["position"].asInt.toFloat() chapters.add(chapter) } @@ -447,6 +450,17 @@ abstract class Luscious( query ) + override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable { + return if (query.startsWith("ID:")){ + val id = query.substringAfterLast("ID:") + client.newCall(buildAlbumInfoRequest(id)) + .asObservableSuccess() + .map { MangasPage(listOf(detailsParse(it)), false) } + } else { + super.fetchSearchManga(page, query, filters) + } + } + class TriStateFilterOption(name: String, val value: String) : Filter.TriState(name) abstract class TriStateGroupFilter(name: String, options: List) : Filter.Group(name, options) { val included: List @@ -495,6 +509,7 @@ abstract class Luscious( class AlbumTypeSelectFilter(options: List) : SelectFilter("Album Type", options) class ContentTypeSelectFilter(options: List) : SelectFilter("Content Type", options) class RestrictGenresSelectFilter(options: List) : SelectFilter("Restrict Genres", options) + class SelectionSelectFilter(options: List) : SelectFilter("Selection", options) class AlbumSizeSelectFilter(options: List) : SelectFilter("Album Size", options) class TagTextFilters : TextFilter("Tags") class CreatorTextFilters : TextFilter("Uploader") @@ -506,6 +521,7 @@ abstract class Luscious( AlbumTypeSelectFilter(getAlbumTypeFilters()), ContentTypeSelectFilter(getContentTypeFilters()), AlbumSizeSelectFilter(getAlbumSizeFilters()), + SelectionSelectFilter(getSelectionFilters()), RestrictGenresSelectFilter(getRestrictGenresFilters()), InterestGroupFilter(getInterestFilters()), LanguageGroupFilter(getLanguageFilters()), @@ -586,6 +602,17 @@ abstract class Luscious( SelectFilterOption("Strict", "strict") ) + private fun getSelectionFilters() = listOf( + SelectFilterOption("All", "all"), + SelectFilterOption("No Votes", "not_voted"), + SelectFilterOption("Downvoted", "downvoted"), + SelectFilterOption("Animated", "animated"), + SelectFilterOption("Banned", "banned"), + SelectFilterOption("Made by People You Follow", "made_by_following"), + SelectFilterOption("Faved by People You Follow", "faved_by_following"), + + ) + private fun getContentTypeFilters() = listOf( SelectFilterOption("All", FILTER_VALUE_IGNORE), SelectFilterOption("Hentai", "0"), diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/luscious/LusciousGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/luscious/LusciousGenerator.kt index d797f99ca..aec0bbee2 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/luscious/LusciousGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/luscious/LusciousGenerator.kt @@ -10,7 +10,7 @@ class LusciousGenerator : ThemeSourceGenerator { override val themeClass = "Luscious" - override val baseVersionCode: Int = 9 + override val baseVersionCode: Int = 10 override val sources = listOf( 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),