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