NineManga: use SourceFactory
This commit is contained in:
parent
b81d7ad2aa
commit
c547da3714
@ -4,8 +4,8 @@ apply plugin: 'kotlin-android'
|
|||||||
ext {
|
ext {
|
||||||
appName = 'Tachiyomi: NineManga'
|
appName = 'Tachiyomi: NineManga'
|
||||||
pkgNameSuffix = "all.ninemanga"
|
pkgNameSuffix = "all.ninemanga"
|
||||||
extClass = '.NineMangaEs; .NineMangaBr; .NineMangaEn; .NineMangaRu; .NineMangaDe; .NineMangaIt; .NineMangaFr'
|
extClass = '.NineMangaFactory'
|
||||||
extVersionCode = 6
|
extVersionCode = 7
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
package eu.kanade.tachiyomi.extension.all.ninemanga
|
package eu.kanade.tachiyomi.extension.all.ninemanga
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.source.model.*
|
|
||||||
import okhttp3.Request
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.source.model.Filter
|
||||||
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
import okhttp3.HttpUrl
|
import okhttp3.HttpUrl
|
||||||
|
import okhttp3.Request
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import java.text.ParseException
|
import java.text.ParseException
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.Calendar
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
open class NineManga(override val name: String, override val baseUrl: String, override val lang: String) : ParsedHttpSource() {
|
open class NineManga(override val name: String, override val baseUrl: String, override val lang: String) : ParsedHttpSource() {
|
||||||
|
|
||||||
@ -81,10 +86,10 @@ open class NineManga(override val name: String, override val baseUrl: String, ov
|
|||||||
|
|
||||||
if (dateWords.size == 3) {
|
if (dateWords.size == 3) {
|
||||||
if (dateWords[1].contains(",")) {
|
if (dateWords[1].contains(",")) {
|
||||||
try {
|
return try {
|
||||||
return SimpleDateFormat("MMM d, yyyy", Locale.ENGLISH).parse(date).time
|
SimpleDateFormat("MMM d, yyyy", Locale.ENGLISH).parse(date).time
|
||||||
} catch (e: ParseException) {
|
} catch (e: ParseException) {
|
||||||
return 0L
|
0L
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val timeAgo = Integer.parseInt(dateWords[0])
|
val timeAgo = Integer.parseInt(dateWords[0])
|
||||||
|
@ -7,14 +7,11 @@ import eu.kanade.tachiyomi.source.model.SManga
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import java.text.ParseException
|
import java.text.ParseException
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.Calendar
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
class NineMangaFactory : SourceFactory {
|
class NineMangaFactory : SourceFactory {
|
||||||
override fun createSources(): List<Source> = getAllNineManga()
|
override fun createSources(): List<Source> = listOf(
|
||||||
}
|
|
||||||
|
|
||||||
fun getAllNineManga(): List<Source> {
|
|
||||||
return listOf(
|
|
||||||
NineMangaEn(),
|
NineMangaEn(),
|
||||||
NineMangaEs(),
|
NineMangaEs(),
|
||||||
NineMangaBr(),
|
NineMangaBr(),
|
||||||
@ -744,16 +741,15 @@ class NineMangaFr : NineManga("NineMangaFr", "http://fr.ninemanga.com", "fr") {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun parseChapterDateByLang(date: String): Long {
|
fun parseChapterDateByLang(date: String): Long {
|
||||||
val dateWords = date.split(" ")
|
val dateWords = date.split(" ")
|
||||||
|
|
||||||
if (dateWords.size == 3) {
|
if (dateWords.size == 3) {
|
||||||
if (dateWords[1].contains(",")) {
|
if (dateWords[1].contains(",")) {
|
||||||
try {
|
return try {
|
||||||
return SimpleDateFormat("MMM d, yyyy", Locale.ENGLISH).parse(date).time
|
SimpleDateFormat("MMM d, yyyy", Locale.ENGLISH).parse(date).time
|
||||||
} catch (e: ParseException) {
|
} catch (e: ParseException) {
|
||||||
return 0L
|
0L
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val timeAgo = Integer.parseInt(dateWords[0])
|
val timeAgo = Integer.parseInt(dateWords[0])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user