Corrected a bunch of lints in "all" (#3035)
This commit is contained in:
parent
028ba2e084
commit
d418ae93b2
|
@ -23,9 +23,10 @@ class ManManga : BoomManga("ManManga", "https://m.manmanga.com", "en") {
|
|||
override fun nameselector(element: Element) = element.select("a").attr("alt")
|
||||
override fun authorget(document: Document) = document.select(".author").text().substringAfter(":").trim()
|
||||
override fun thumbnailget(document: Document) = document.select(".bg-box .bg").attr("style").substringAfter("'").substringBefore("'")
|
||||
override fun genreget(document: Document) = document.select(".tags span").map {
|
||||
override fun genreget(document: Document) = document.select(".tags span").joinToString(", ") {
|
||||
it.text().trim()
|
||||
}.joinToString(", ")
|
||||
}
|
||||
|
||||
override fun statusget(document: Document) = when (document.select(".type").text().substringAfter(":").trim()) {
|
||||
"Ongoing" -> SManga.ONGOING
|
||||
"Completed" -> SManga.COMPLETED
|
||||
|
@ -36,9 +37,10 @@ class TwinsComics : BoomManga("TwinsComics", "https://m.twinscomics.com", "en")
|
|||
override fun nameselector(element: Element) = element.select("a").attr("alt")
|
||||
override fun authorget(document: Document) = document.select(".author").text().substringAfter(":").trim()
|
||||
override fun thumbnailget(document: Document) = document.select(".bg-box .bg").attr("style").substringAfter("'").substringBefore("'")
|
||||
override fun genreget(document: Document) = document.select(".tags span").map {
|
||||
override fun genreget(document: Document) = document.select(".tags span").joinToString(", ") {
|
||||
it.text().trim()
|
||||
}.joinToString(", ")
|
||||
}
|
||||
|
||||
override fun statusget(document: Document) = when (document.select(".type").text().substringAfter(":").trim()) {
|
||||
"Ongoing" -> SManga.ONGOING
|
||||
"Completed" -> SManga.COMPLETED
|
||||
|
@ -52,9 +54,10 @@ class ManMangazh : BoomManga("ManManga", "https://m.manmanga.com/cn", "zh") {
|
|||
override fun nameselector(element: Element) = element.select("a").attr("alt")
|
||||
override fun authorget(document: Document) = document.select(".author").text().substringAfter(":").trim()
|
||||
override fun thumbnailget(document: Document) = document.select(".bg-box .bg").attr("style").substringAfter("'").substringBefore("'")
|
||||
override fun genreget(document: Document) = document.select(".tags span").map {
|
||||
override fun genreget(document: Document) = document.select(".tags span").joinToString(", ") {
|
||||
it.text().trim()
|
||||
}.joinToString(", ")
|
||||
}
|
||||
|
||||
override fun statusget(document: Document) = when (document.select(".type").text().substringAfter(":").trim()) {
|
||||
"连载中" -> SManga.ONGOING
|
||||
// "Completed" -> SManga.COMPLETED
|
||||
|
@ -66,9 +69,10 @@ class TwinsComicszh : BoomManga("TwinsComics", "https://m.twinscomics.com/cn", "
|
|||
override fun nameselector(element: Element) = element.select("a").attr("alt")
|
||||
override fun authorget(document: Document) = document.select(".author").text().substringAfter(":").trim()
|
||||
override fun thumbnailget(document: Document) = document.select(".bg-box .bg").attr("style").substringAfter("'").substringBefore("'")
|
||||
override fun genreget(document: Document) = document.select(".tags span").map {
|
||||
override fun genreget(document: Document) = document.select(".tags span").joinToString(", ") {
|
||||
it.text().trim()
|
||||
}.joinToString(", ")
|
||||
}
|
||||
|
||||
override fun statusget(document: Document) = when (document.select(".type").text().substringAfter(":").trim()) {
|
||||
"连载中" -> SManga.ONGOING
|
||||
// "Completed" -> SManga.COMPLETED
|
||||
|
|
|
@ -75,8 +75,8 @@ open class EHentai(override val lang: String, private val ehLang: String) : Http
|
|||
return chapterPageCall(np).flatMap {
|
||||
val jsoup = it.asJsoup()
|
||||
urls += parseChapterPage(jsoup)
|
||||
nextPageUrl(jsoup)?.let {
|
||||
fetchChapterPage(chapter, it, urls)
|
||||
nextPageUrl(jsoup)?.let { string ->
|
||||
fetchChapterPage(chapter, string, urls)
|
||||
} ?: Observable.just(urls)
|
||||
}
|
||||
}
|
||||
|
@ -119,8 +119,8 @@ open class EHentai(override val lang: String, private val ehLang: String) : Http
|
|||
} ?: url, additionalHeaders?.let {
|
||||
val headers = headers.newBuilder()
|
||||
it.toMultimap().forEach { (t, u) ->
|
||||
u.forEach {
|
||||
headers.add(t, it)
|
||||
u.forEach { string ->
|
||||
headers.add(t, string)
|
||||
}
|
||||
}
|
||||
headers.build()
|
||||
|
@ -198,9 +198,9 @@ open class EHentai(override val lang: String, private val ehLang: String) : Http
|
|||
tags.clear()
|
||||
select("#taglist tr").forEach {
|
||||
val namespace = it.select(".tc").text().removeSuffix(":")
|
||||
val currentTags = it.select("div").map {
|
||||
Tag(it.text().trim(),
|
||||
it.hasClass("gtl"))
|
||||
val currentTags = it.select("div").map { element ->
|
||||
Tag(element.text().trim(),
|
||||
element.hasClass("gtl"))
|
||||
}
|
||||
tags[namespace] = currentTags
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ fun ExGalleryMetadata.copyTo(manga: SManga) {
|
|||
favorites?.let { detailsDesc += "Favorited: $it times\n" }
|
||||
averageRating?.let {
|
||||
detailsDesc += "Rating: $it"
|
||||
ratingCount?.let { detailsDesc += " ($it)" }
|
||||
ratingCount?.let { count -> detailsDesc += " ($count)" }
|
||||
detailsDesc += "\n"
|
||||
}
|
||||
|
||||
|
|
|
@ -169,26 +169,31 @@ abstract class FoolSlide(
|
|||
|
||||
// Handle 'yesterday' and 'today', using midnight
|
||||
var relativeDate: Calendar? = null
|
||||
if (lcDate.startsWith("yesterday")) {
|
||||
relativeDate = Calendar.getInstance()
|
||||
relativeDate.add(Calendar.DAY_OF_MONTH, -1) // yesterday
|
||||
relativeDate.set(Calendar.HOUR_OF_DAY, 0)
|
||||
relativeDate.set(Calendar.MINUTE, 0)
|
||||
relativeDate.set(Calendar.SECOND, 0)
|
||||
relativeDate.set(Calendar.MILLISECOND, 0)
|
||||
} else if (lcDate.startsWith("today")) {
|
||||
relativeDate = Calendar.getInstance()
|
||||
relativeDate.set(Calendar.HOUR_OF_DAY, 0)
|
||||
relativeDate.set(Calendar.MINUTE, 0)
|
||||
relativeDate.set(Calendar.SECOND, 0)
|
||||
relativeDate.set(Calendar.MILLISECOND, 0)
|
||||
} else if (lcDate.startsWith("tomorrow")) {
|
||||
relativeDate = Calendar.getInstance()
|
||||
relativeDate.add(Calendar.DAY_OF_MONTH, +1) // tomorrow
|
||||
relativeDate.set(Calendar.HOUR_OF_DAY, 0)
|
||||
relativeDate.set(Calendar.MINUTE, 0)
|
||||
relativeDate.set(Calendar.SECOND, 0)
|
||||
relativeDate.set(Calendar.MILLISECOND, 0)
|
||||
// Result parsed but no year, copy current year over
|
||||
when {
|
||||
lcDate.startsWith("yesterday") -> {
|
||||
relativeDate = Calendar.getInstance()
|
||||
relativeDate.add(Calendar.DAY_OF_MONTH, -1) // yesterday
|
||||
relativeDate.set(Calendar.HOUR_OF_DAY, 0)
|
||||
relativeDate.set(Calendar.MINUTE, 0)
|
||||
relativeDate.set(Calendar.SECOND, 0)
|
||||
relativeDate.set(Calendar.MILLISECOND, 0)
|
||||
}
|
||||
lcDate.startsWith("today") -> {
|
||||
relativeDate = Calendar.getInstance()
|
||||
relativeDate.set(Calendar.HOUR_OF_DAY, 0)
|
||||
relativeDate.set(Calendar.MINUTE, 0)
|
||||
relativeDate.set(Calendar.SECOND, 0)
|
||||
relativeDate.set(Calendar.MILLISECOND, 0)
|
||||
}
|
||||
lcDate.startsWith("tomorrow") -> {
|
||||
relativeDate = Calendar.getInstance()
|
||||
relativeDate.add(Calendar.DAY_OF_MONTH, +1) // tomorrow
|
||||
relativeDate.set(Calendar.HOUR_OF_DAY, 0)
|
||||
relativeDate.set(Calendar.MINUTE, 0)
|
||||
relativeDate.set(Calendar.SECOND, 0)
|
||||
relativeDate.set(Calendar.MILLISECOND, 0)
|
||||
}
|
||||
}
|
||||
|
||||
relativeDate?.timeInMillis?.let {
|
||||
|
|
|
@ -26,7 +26,7 @@ import uy.kohesive.injekt.api.get
|
|||
|
||||
class FoolSlideFactory : SourceFactory {
|
||||
override fun createSources(): List<Source> = listOf(
|
||||
JaminisBox(),
|
||||
JaiminisBox(),
|
||||
SenseScans(),
|
||||
KireiCake(),
|
||||
SilentSky(),
|
||||
|
@ -64,10 +64,10 @@ class FoolSlideFactory : SourceFactory {
|
|||
)
|
||||
}
|
||||
|
||||
class JaminisBox : FoolSlide("Jaimini's Box", "https://jaiminisbox.com", "en", "/reader") {
|
||||
val SLUG_REGEX = "(?:/read/)([\\w\\d-]+?)(?:/)".toRegex()
|
||||
class JaiminisBox : FoolSlide("Jaimini's Box", "https://jaiminisbox.com", "en", "/reader") {
|
||||
private val slugRegex = "(?:/read/)([\\w\\d-]+?)(?:/)".toRegex()
|
||||
override fun pageListRequest(chapter: SChapter): Request {
|
||||
val (slug) = SLUG_REGEX.find(chapter.url)!!.destructured
|
||||
val (slug) = slugRegex.find(chapter.url)!!.destructured
|
||||
var (major, minor) = chapter.chapter_number.toString().split(".")
|
||||
if (major == "-1") major = "0" // Some oneshots don't have a chapter
|
||||
return GET("$baseUrl$urlModifier/api/reader/chapter?comic_stub=$slug&chapter=$major&subchapter=$minor")
|
||||
|
|
|
@ -180,7 +180,7 @@ open class Komga(suffix: String = "") : ConfigurableSource, HttpSource() {
|
|||
|
||||
private class LibraryFilter(val id: Long, name: String) : Filter.CheckBox(name, false)
|
||||
private class LibraryGroup(libraries: List<LibraryFilter>) : Filter.Group<LibraryFilter>("Libraries", libraries)
|
||||
private class SeriesSort : Filter.Sort("Sort", arrayOf("Alphabetically", "Date added", "Date updated"), Filter.Sort.Selection(0, true))
|
||||
private class SeriesSort : Filter.Sort("Sort", arrayOf("Alphabetically", "Date added", "Date updated"), Selection(0, true))
|
||||
private class StatusFilter(name: String) : Filter.CheckBox(name, false)
|
||||
private class StatusGroup(filters: List<StatusFilter>) : Filter.Group<StatusFilter>("Status", filters)
|
||||
|
||||
|
|
|
@ -50,9 +50,6 @@ abstract class Mangadex(
|
|||
private val internalLang: String
|
||||
) : ConfigurableSource, ParsedHttpSource() {
|
||||
|
||||
init {
|
||||
}
|
||||
|
||||
override val name = "MangaDex"
|
||||
|
||||
override val baseUrl = "https://www.mangadex.org"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package eu.kanade.tachiyomi.extension.all.mangadex
|
||||
|
||||
class MangadexDescription(private val internalLang: String) {
|
||||
class MangadexDescription(internalLang: String) {
|
||||
|
||||
private val listOfLangs = when (internalLang) {
|
||||
"ru" -> RUSSIAN
|
||||
|
@ -20,13 +20,13 @@ class MangadexDescription(private val internalLang: String) {
|
|||
// remove any languages before the ones provided in the langTextToCheck, if no matches or empty
|
||||
// just uses the original description, also removes the potential lang from all lang list
|
||||
var newDescription = description
|
||||
listOfLangs.forEach { it ->
|
||||
listOfLangs.forEach {
|
||||
newDescription = newDescription.substringAfter(it)
|
||||
langList.remove(it)
|
||||
}
|
||||
|
||||
// remove any possible languages that remain to get the new description
|
||||
langList.forEach { it -> newDescription = newDescription.substringBefore(it) }
|
||||
langList.forEach { newDescription = newDescription.substringBefore(it) }
|
||||
return newDescription
|
||||
}
|
||||
|
||||
|
|
|
@ -394,7 +394,7 @@ open class Mangatensei(override val lang: String, private val Mtlang: String) :
|
|||
private class Tag(name: String) : Filter.CheckBox(name)
|
||||
}
|
||||
|
||||
abstract class OtherSite(private val sourceName: String, private val sourceBaseUrl: String, private val tachiLang: String, private val sourceLang: String) : Mangatensei(tachiLang, sourceLang) {
|
||||
abstract class OtherSite(sourceName: String, sourceBaseUrl: String, tachiLang: String, sourceLang: String) : Mangatensei(tachiLang, sourceLang) {
|
||||
override val name = sourceName
|
||||
|
||||
override val baseUrl = sourceBaseUrl
|
||||
|
|
|
@ -98,15 +98,9 @@ class Generator {
|
|||
}
|
||||
}
|
||||
println("Number of sources successfully generated: ${number - 1}")
|
||||
if (!DRY_RUN) {
|
||||
val writer = PrintWriter(relativePath)
|
||||
writer.write(buffer.toString())
|
||||
writer.close()
|
||||
} else {
|
||||
val writer = PrintWriter(relativePathTest)
|
||||
writer.write(buffer.toString())
|
||||
writer.close()
|
||||
}
|
||||
val writer = PrintWriter(relativePath)
|
||||
writer.write(buffer.toString())
|
||||
writer.close()
|
||||
}
|
||||
|
||||
private fun getDocument(url: String, printStackTrace: Boolean = true): Document? {
|
||||
|
@ -223,7 +217,6 @@ class Generator {
|
|||
}
|
||||
|
||||
companion object {
|
||||
const val DRY_RUN = false
|
||||
val sources = listOf(
|
||||
Triple("ar", "مانجا اون لاين", "https://onma.me"),
|
||||
Triple("en", "Read Comics Online", "https://readcomicsonline.ru"),
|
||||
|
@ -311,7 +304,6 @@ class Generator {
|
|||
// Triple("tr", "ManhuaTR", "http://www.manhua-tr.com"),
|
||||
|
||||
val relativePath = System.getProperty("user.dir") + "/src/all/mmrcms/src/eu/kanade/tachiyomi/extension/all/mmrcms/GeneratedSources.kt"
|
||||
val relativePathTest = System.getProperty("user.dir") + "/src/all/mmrcms/TestGeneratedSources.kt"
|
||||
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
|
|
|
@ -55,7 +55,7 @@ class MyMangaReaderCMSSources : SourceFactory {
|
|||
val categories = mapToPairs(jsonObject["categories"].array)
|
||||
var tags = emptyList<Pair<String, String>>()
|
||||
if (jsonObject["tags"].isJsonArray) {
|
||||
tags = jsonObject["tags"].asJsonArray.let { mapToPairs(it) }
|
||||
tags = mapToPairs(jsonObject["tags"].asJsonArray)
|
||||
}
|
||||
|
||||
MyMangaReaderCMSSource(
|
||||
|
|
|
@ -186,7 +186,7 @@ open class MyReadingManga(override val lang: String) : ParsedHttpSource() {
|
|||
manga.artist = cleanAuthor(document.select("h1").text())
|
||||
val glist = document.select(".entry-header p a[href*=genre]").map { it.text() }
|
||||
manga.genre = glist.joinToString(", ")
|
||||
val extendedDescription = document.select(".entry-content p:not(p:containsOwn(|)):not(.chapter-class + p)")?.map { it.text() }?.joinToString("\n")
|
||||
val extendedDescription = document.select(".entry-content p:not(p:containsOwn(|)):not(.chapter-class + p)")?.joinToString("\n") { it.text() }
|
||||
manga.description = document.select("h1").text() + if (extendedDescription.isNullOrEmpty()) "" else "\n\n$extendedDescription"
|
||||
manga.status = when (document.select("a[href*=status]")?.first()?.text()) {
|
||||
"Ongoing" -> SManga.ONGOING
|
||||
|
@ -292,7 +292,7 @@ open class MyReadingManga(override val lang: String) : ParsedHttpSource() {
|
|||
|
||||
// Generates the filter lists for app
|
||||
override fun getFilterList(): FilterList {
|
||||
val filterList = FilterList(
|
||||
return FilterList(
|
||||
// MRM does not support genre filtering and text search at the same time
|
||||
Filter.Header("NOTE: Filters are ignored if using text search."),
|
||||
Filter.Header("Only one filter can be used at a time."),
|
||||
|
@ -302,7 +302,6 @@ open class MyReadingManga(override val lang: String) : ParsedHttpSource() {
|
|||
PairingFilter(returnFilter(getCache("$baseUrl/pairing/"), ".links a", "abs:href")),
|
||||
ScanGroupFilter(returnFilter(getCache("$baseUrl/group/"), ".links a", "abs:href"))
|
||||
)
|
||||
return filterList
|
||||
}
|
||||
|
||||
private class GenreFilter(GENRES: Array<Pair<String, String>>) : UriSelectFilterPath("Genre", "genre", arrayOf(Pair("", "Any"), *GENRES))
|
||||
|
|
|
@ -174,7 +174,7 @@ open class NineHentai : ParsedHttpSource() {
|
|||
|
||||
private class Sorting : Filter.Sort("Sorting",
|
||||
arrayOf("Newest", "Popular Right now", "Most Fapped", "Most Viewed", "By Title"),
|
||||
Filter.Sort.Selection(1, false))
|
||||
Selection(1, false))
|
||||
|
||||
override fun getFilterList() = FilterList(
|
||||
Sorting(),
|
||||
|
|
|
@ -93,7 +93,7 @@ abstract class ToomicsGlobal(
|
|||
val toonId = element.select("a").attr("onclick")
|
||||
.substringAfter("Base.setDisplay('A', '")
|
||||
.substringBefore("'")
|
||||
.let { URLDecoder.decode(it, "UTF-8") }
|
||||
.let { url -> URLDecoder.decode(url, "UTF-8") }
|
||||
.substringAfter("?toon=")
|
||||
.substringBefore("&")
|
||||
url = "/$siteLang/webtoon/episode/toon/$toonId"
|
||||
|
|
|
@ -56,13 +56,13 @@ class WebtoonsIndonesian : WebtoonsDefault("in", "id") {
|
|||
|
||||
// Android seems to be unable to parse Indonesian dates; we'll use a short hard-coded table
|
||||
// instead.
|
||||
private val DATE_MAP: Array<String> = arrayOf(
|
||||
private val dateMap: Array<String> = arrayOf(
|
||||
"Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des")
|
||||
|
||||
override fun chapterParseDate(date: String): Long {
|
||||
val expr = Regex("""(\d{4}) ([A-Z][a-z]{2}) (\d{1,})""").find(date) ?: return 0
|
||||
val expr = Regex("""(\d{4}) ([A-Z][a-z]{2}) (\d+)""").find(date) ?: return 0
|
||||
val (_, year, monthString, day) = expr.groupValues
|
||||
val monthIndex = DATE_MAP.indexOf(monthString)
|
||||
val monthIndex = dateMap.indexOf(monthString)
|
||||
return GregorianCalendar(year.toInt(), monthIndex, day.toInt()).time.time
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue