Add filler markings (#1667)

This commit is contained in:
Secozzi
2023-06-01 11:31:49 +02:00
committed by GitHub
parent ff65c652d7
commit a8c1b9185c
6 changed files with 51 additions and 4 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'AnimeDao'
pkgNameSuffix = 'en.animedao'
extClass = '.AnimeDao'
extVersionCode = 9
extVersionCode = 10
libVersion = '13'
}

View File

@ -222,6 +222,9 @@ class AnimeDao : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
episode_number = if (episodeName.contains("Episode ", true)) {
episodeName.substringAfter("Episode ").substringBefore(" ").toFloatOrNull() ?: 0F
} else { 0F }
if (element.selectFirst("span.filler") != null && preferences.getBoolean("mark_fillers", true)) {
scanlator = "Filler Episode"
}
date_upload = element.selectFirst("span.date")?.let { parseDate(it.text()) } ?: 0L
setUrlWithoutDomain(element.selectFirst("a[href]")!!.attr("href"))
}
@ -403,10 +406,19 @@ class AnimeDao : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
preferences.edit().putBoolean(key, new).commit()
}
}
val markFillers = SwitchPreferenceCompat(screen.context).apply {
key = "mark_fillers"
title = "Mark filler episodes"
setDefaultValue(true)
setOnPreferenceChangeListener { _, newValue ->
preferences.edit().putBoolean(key, newValue as Boolean).commit()
}
}
screen.addPreference(domainPref)
screen.addPreference(videoQualityPref)
screen.addPreference(videoServerPref)
screen.addPreference(episodeSortPref)
screen.addPreference(markFillers)
}
}

View File

@ -6,7 +6,7 @@ ext {
extName = '9anime'
pkgNameSuffix = 'en.nineanime'
extClass = '.NineAnime'
extVersionCode = 41
extVersionCode = 42
libVersion = '13'
}

View File

@ -4,6 +4,7 @@ import android.app.Application
import android.content.SharedPreferences
import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen
import androidx.preference.SwitchPreferenceCompat
import eu.kanade.tachiyomi.animeextension.en.nineanime.extractors.Mp4uploadExtractor
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
@ -182,9 +183,14 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val ids = element.attr("data-ids")
val sub = element.attr("data-sub").toInt().toBoolean()
val dub = element.attr("data-dub").toInt().toBoolean()
val extraInfo = if (element.hasClass("filler") && preferences.getBoolean("mark_fillers", true)) {
" • Filler Episode"
} else {
""
}
episode.url = "$ids&epurl=$url/ep-$epNum"
episode.episode_number = epNum.toFloat()
episode.scanlator = (if (sub) "Sub" else "") + if (dub) ", Dub" else ""
episode.scanlator = ((if (sub) "Sub" else "") + if (dub) ", Dub" else "") + extraInfo
val name = element.parent()?.select("span.d-title")?.text().orEmpty()
val namePrefix = "Episode $epNum"
episode.name = "Episode $epNum" +
@ -429,9 +435,19 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
preferences.edit().putString(key, entry).commit()
}
}
val markFillers = SwitchPreferenceCompat(screen.context).apply {
key = "mark_fillers"
title = "Mark filler episodes"
setDefaultValue(true)
setOnPreferenceChangeListener { _, newValue ->
preferences.edit().putBoolean(key, newValue as Boolean).commit()
}
}
screen.addPreference(domainPref)
screen.addPreference(videoQualityPref)
screen.addPreference(videoLanguagePref)
screen.addPreference(markFillers)
}
private fun <A, B> Iterable<A>.parallelMap(f: suspend (A) -> B): List<B> = runBlocking {

View File

@ -5,7 +5,7 @@ ext {
extName = 'zoro.to (experimental)'
pkgNameSuffix = 'en.zoro'
extClass = '.Zoro'
extVersionCode = 27
extVersionCode = 28
libVersion = '13'
}

View File

@ -4,6 +4,7 @@ import android.app.Application
import android.content.SharedPreferences
import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen
import androidx.preference.SwitchPreferenceCompat
import eu.kanade.tachiyomi.animeextension.en.zoro.extractors.ZoroExtractor
import eu.kanade.tachiyomi.animeextension.en.zoro.utils.JSONUtil
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
@ -94,6 +95,9 @@ class Zoro : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
episode_number = it.attr("data-number").toFloat()
name = "Episode ${it.attr("data-number")}: ${it.attr("title")}"
url = it.attr("href")
if (it.hasClass("ssl-item-filler") && preferences.getBoolean(MARK_FILLERS_KEY, MARK_FILLERS_DEFAULT)) {
scanlator = "Filler Episode"
}
}
}
return episodeList.reversed()
@ -386,10 +390,21 @@ class Zoro : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
preferences.edit().putString(key, entry).commit()
}
}
val markFillers = SwitchPreferenceCompat(screen.context).apply {
key = MARK_FILLERS_KEY
title = MARK_FILLERS_TITLE
setDefaultValue(MARK_FILLERS_DEFAULT)
setOnPreferenceChangeListener { _, newValue ->
preferences.edit().putBoolean(key, newValue as Boolean).commit()
}
}
screen.addPreference(domainPref)
screen.addPreference(videoQualityPref)
screen.addPreference(epTypePref)
screen.addPreference(subLangPref)
screen.addPreference(markFillers)
}
// ============================= Utilities ==============================
@ -457,5 +472,9 @@ class Zoro : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
"Japanese",
"Russian",
)
private const val MARK_FILLERS_KEY = "mark_fillers"
private const val MARK_FILLERS_TITLE = "Mark filler episodes"
private const val MARK_FILLERS_DEFAULT = true
}
}