Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Novelfull #6823

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/all/novelfull/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ext {
extName = 'NovelFull'
extClass = '.NovelFullFactory'
extVersionCode = 1
isNsfw = true
}

apply from: "$rootDir/common.gradle"
Binary file added src/all/novelfull/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/all/novelfull/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package eu.kanade.tachiyomi.extension.all.novelfull

import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory

class NovelFullFactory : SourceFactory {
/**
* Create a new copy of the sources
* @return The created sources
*/
override fun createSources(): List<Source> {
return listOf(
NovelFull(),
NovelFullId(),
NovelFullZh(),
)
}
}

class NovelFull : NovelFullGlobal("en")
class NovelFullId : NovelFullGlobal("id", supportsSearch = false)
class NovelFullZh : NovelFullGlobal("zh", supportsSearch = false)
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
package eu.kanade.tachiyomi.extension.all.novelfull

import eu.kanade.tachiyomi.source.model.Filter

object Note : Filter.Header("NOTE: Ignored if using text search!")

class SelectFilterOption(val name: String, val value: String)

abstract class SelectFilter(name: String, private val options: List<SelectFilterOption>, default: Int = 0) : Filter.Select<String>(name, options.map { it.name }.toTypedArray(), default) {
val selected: String
get() = options[state].value
}

class GenreFilter(
options: List<SelectFilterOption>,
default: Int,
) : SelectFilter("Genre", options, default)

fun getGenreFilter(lang: String): List<SelectFilterOption> {
val allGenres: Map<String, List<SelectFilterOption>> = mapOf(
"en" to listOf(
SelectFilterOption("All", ""),
SelectFilterOption("Romance", "169"),
SelectFilterOption("Fantasy", "168"),
SelectFilterOption("Modern", "185"),
SelectFilterOption("Adventure", "164"),
SelectFilterOption("Harem", "174"),
SelectFilterOption("Sci-Fi", "189"),
SelectFilterOption("Action", "202"),
SelectFilterOption("Historical", "175"),
SelectFilterOption("Xuanhuan", "201"),
SelectFilterOption("Urban", "203"),
SelectFilterOption("Mystery", "163"),
SelectFilterOption("LGBT+", "195"),
SelectFilterOption("Magic", "345"),
SelectFilterOption("Comedy", "211"),
SelectFilterOption("School Life", "196"),
SelectFilterOption("Drama", "224"),
SelectFilterOption("Adult", "302"),
SelectFilterOption("Time Travel", "284"),
SelectFilterOption("Psychological", "293"),
SelectFilterOption("Violence", "362"),
SelectFilterOption("History", "225"),
SelectFilterOption("Virtual Reality", "524"),
SelectFilterOption("Full Color", "260"),
SelectFilterOption("Smut", "272"),
SelectFilterOption("Shounen ai", "289"),
SelectFilterOption("Vampires", "298"),
SelectFilterOption("Seinen(M)", "350"),
SelectFilterOption("Magical Girls", "521"),
SelectFilterOption("Webtoon", "256"),
SelectFilterOption("Josei(W)", "265"),
SelectFilterOption("Mature", "282"),
SelectFilterOption("Shounen(B)", "294"),
SelectFilterOption("Manhua", "312"),
SelectFilterOption("Gore", "364"),
SelectFilterOption("Shoujo(G)", "252"),
SelectFilterOption("Isekai", "262"),
SelectFilterOption("Demons", "274"),
SelectFilterOption("Supernatural", "291"),
SelectFilterOption("Gender Bender", "300"),
SelectFilterOption("Sports", "352"),
SelectFilterOption("Reverse Isekai ", "523"),
SelectFilterOption("Adaptation", "258"),
SelectFilterOption("Slice of Life", "270"),
SelectFilterOption("Ecchi", "295"),
SelectFilterOption("parody", "520"),
SelectFilterOption("Manhwa", "254"),
SelectFilterOption("Medical", "264"),
SelectFilterOption("Yaoi(BL)", "278"),
),
"id" to listOf(
SelectFilterOption("Semua", ""),
SelectFilterOption("Percintaan", "173"),
SelectFilterOption("Fantasi", "176"),
SelectFilterOption("Sejarah", "182"),
SelectFilterOption("Tindakan", "205"),
SelectFilterOption("Harem", "177"),
SelectFilterOption("Sci-Fi", "178"),
SelectFilterOption("Xuanhuan", "209"),
SelectFilterOption("Perkotaan", "181"),
SelectFilterOption("Kampus", "180"),
SelectFilterOption("Petualangan", "206"),
SelectFilterOption("Misteri", "208"),
SelectFilterOption("Sihir", "235"),
SelectFilterOption("Komedi", "232"),
SelectFilterOption("Drama", "218"),
SelectFilterOption("Isekai", "241"),
SelectFilterOption("Perjalanan waktu", "222"),
SelectFilterOption("Dewasa", "212"),
SelectFilterOption("LGBT+", "250"),
SelectFilterOption("School Life", "316"),
SelectFilterOption("Yaoi(BL)", "324"),
SelectFilterOption("Fantasi Timur", "536"),
SelectFilterOption("Adult", "223"),
SelectFilterOption("Slice of Life", "233"),
SelectFilterOption("Tragedy", "320"),
SelectFilterOption("Manhwa", "215"),
SelectFilterOption("Magic", "454"),
SelectFilterOption("Romance", "221"),
SelectFilterOption("Webtoon", "231"),
SelectFilterOption("Historical", "239"),
SelectFilterOption("Psychological", "247"),
SelectFilterOption("Medical", "317"),
SelectFilterOption("Smut", "213"),
SelectFilterOption("Shounen ai", "325"),
SelectFilterOption("Fantasy", "219"),
SelectFilterOption("Umum", "537"),
SelectFilterOption("Demons", "228"),
SelectFilterOption("Office Workers", "242"),
SelectFilterOption("Action", "251"),
SelectFilterOption("Shounen(B)", "321"),
SelectFilterOption("Adaptation", "216"),
SelectFilterOption("Yuri(GL)", "522"),
SelectFilterOption("Adventure", "240"),
SelectFilterOption("Manhua", "249"),
SelectFilterOption("Mystery", "319"),
SelectFilterOption("Josei(W)", "214"),
SelectFilterOption("Martial Arts", "347"),
SelectFilterOption("Full Color", "220"),
SelectFilterOption("Supernatural", "229"),
SelectFilterOption("Shoujo(G)", "237"),
SelectFilterOption("Reincarnation", "244"),

),
"zh" to listOf(
SelectFilterOption("全部", ""),
SelectFilterOption("热血恋爱", "127"),
SelectFilterOption("热血玄幻古风", "130"),
SelectFilterOption("彩虹都市", "121"),
SelectFilterOption("热血冒险", "131"),
SelectFilterOption("治愈", "108"),
SelectFilterOption("搞笑", "101"),
SelectFilterOption("古风", "115"),
SelectFilterOption("校园", "106"),
SelectFilterOption("猎奇", "114"),
SelectFilterOption("日常", "105"),
SelectFilterOption("同人", "116"),
SelectFilterOption("恋爱都市", "123"),
SelectFilterOption("纯爱", "535"),
SelectFilterOption("恋爱后宫搞笑", "128"),
SelectFilterOption("其它", "542"),
SelectFilterOption("生活", "135"),
SelectFilterOption("修真", "513"),
SelectFilterOption("恐怖", "111"),
SelectFilterOption("百合", "518"),
SelectFilterOption("奇幻冒险", "528"),
SelectFilterOption("耽美", "533"),
SelectFilterOption("恋爱古风", "126"),
SelectFilterOption("灵异", "540"),
SelectFilterOption("总裁", "545"),
SelectFilterOption("恋爱", "104"),
SelectFilterOption("后宫", "498"),
SelectFilterOption("玄幻", "109"),
SelectFilterOption("霸总", "516"),
SelectFilterOption("剧情", "526"),
SelectFilterOption("恋爱校园都市", "119"),
SelectFilterOption("少年", "531"),
SelectFilterOption("恋爱搞笑治愈", "124"),
SelectFilterOption("战争", "538"),
SelectFilterOption("校园日常", "129"),
SelectFilterOption("大女主", "543"),
SelectFilterOption("热血", "102"),
SelectFilterOption("架空", "496"),
SelectFilterOption("日漫", "107"),
SelectFilterOption("动作", "514"),
SelectFilterOption("悬疑", "112"),
SelectFilterOption("四格", "519"),
SelectFilterOption("热血悬疑都市", "117"),
SelectFilterOption("系统", "529"),
SelectFilterOption("校园搞笑", "122"),
SelectFilterOption("魔法", "534"),
SelectFilterOption("推理", "541"),
SelectFilterOption("热恋", "134"),
SelectFilterOption("真人", "546"),
SelectFilterOption("科幻", "499"),
SelectFilterOption("奇幻", "110"),
SelectFilterOption("欢乐向", "517"),
SelectFilterOption("励志", "527"),
SelectFilterOption("恋爱奇幻", "120"),
SelectFilterOption("少女", "532"),
SelectFilterOption("热血悬疑", "125"),
SelectFilterOption("竞技", "539"),
SelectFilterOption("格斗", "544"),
SelectFilterOption("冒险", "103"),
SelectFilterOption("穿越", "497"),
SelectFilterOption("[empty]", "515"),
SelectFilterOption("都市", "113"),
SelectFilterOption("武侠", "525"),
SelectFilterOption("玄幻都市", "118"),
SelectFilterOption("爱情", "530"),
),
)
// TODO: Automate this
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need help here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could maybe have a list of tripple and build the list based on language/index.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure for multiple languages, but you can use the selector: ul.nav > li:has(> a:containsOwn(Genre)) ul > li
with that you can get id and name kinda like this:

allGenres["en"] = document.select("ul.nav > li:has(> a:containsOwn(Genre)) ul > li > a").mapNotNull { element ->
    val url = element.absUrl("href").toHttpUrlOrNull()
    val id = url?.queryParameter("id")
    id?.let { SelectFilterOption(element.ownText(), it) }
}

(code can be considered pseudo code)

Copy link
Contributor Author

@FunnyTiming FunnyTiming Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something called when the settings are called for the first time ? I remember to see a message like "Click on [Reset] to load genres" but I have no memories of this source, nor the function who is called.
OK I will check Mihon sources

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many sources with that wording. Search for reset.*genre in the codebase (enable regex searching)

When first loading the extensions the genres are not fetched yet, so resetting it will rerun getFilterList() and add them to the filters.

return allGenres[lang] ?: emptyList()
}
Loading
Loading