Dynasty fixes (#219)

* add icon
fix search
add licensed check

* fix search urls not being correct for each variation of dynasty

* added oneshots
switched to factory

* changed to plural
This commit is contained in:
Carlos 2018-02-26 14:25:38 -05:00 committed by GitHub
parent 45d86d4cd7
commit 8320d2b8a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 116 additions and 10 deletions

View File

@ -4,9 +4,9 @@ apply plugin: 'kotlin-android'
ext {
appName = 'Tachiyomi: Dynasty'
pkgNameSuffix = "en.dynasty"
extClass = '.DynastyAnthologies; .DynastyIssues; .DynastySeries; .DynastyDoujins'
extVersionCode = 2
extVersionSuffix = 2
extClass = '.DynastyFactory'
extVersionCode = 3
extVersionSuffix = 3
libVersion = '1.2'
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -13,10 +13,10 @@ class DynastyAnthologies : DynastyScans() {
override fun popularMangaInitialUrl() = "$baseUrl/anthologies?view=cover"
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return GET("$baseUrl/search?q=$query&classes[]=Series&sort=", headers)
return GET("$baseUrl/search?q=$query&classes%5B%5D=Anthology&sort=", headers)
}
override fun mangaDetailsParse(document: Document): SManga {
override fun mangaDetailsParse(document: Document): SManga {
val manga = SManga.create()
manga.thumbnail_url = baseUrl + document.select("div.span2 > img").attr("src")
parseHeader(document, manga)

View File

@ -13,7 +13,7 @@ class DynastyDoujins : DynastyScans() {
override fun popularMangaInitialUrl() = "$baseUrl/doujins?view=cover"
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return GET("$baseUrl/search?q=$query&classes[]=Series&sort=", headers)
return GET("$baseUrl/search?q=$query&classes%5B%5D=Doujin&sort=", headers)
}
override fun mangaDetailsParse(document: Document): SManga {

View File

@ -0,0 +1,19 @@
package eu.kanade.tachiyomi.extension.en.dynasty
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory
/**
* Created by Carlos on 2/8/2018.
*/
class DynastyFactory : SourceFactory {
override fun createSources(): List<Source> = getAllDynasty()
}
fun getAllDynasty() =
listOf(
DynastyAnthologies(),
DynastyOneshots(),
DynastyDoujins(),
DynastyIssues(),
DynastySeries())

View File

@ -13,7 +13,7 @@ class DynastyIssues : DynastyScans() {
override fun popularMangaInitialUrl() = "$baseUrl/issues?view=cover"
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return GET("$baseUrl/search?q=$query&classes[]=Series&sort=", headers)
return GET("$baseUrl/search?q=$query&classes%5B%5D=Issue&sort=", headers)
}
override fun mangaDetailsParse(document: Document): SManga {

View File

@ -0,0 +1,75 @@
package eu.kanade.tachiyomi.extension.en.dynasty
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat
import java.util.*
class DynastyOneshots : DynastyScans() {
override val name = "Dynasty- Oneshots"
override fun popularMangaInitialUrl() = "$baseUrl/search?q=&with%5B%5D=5102&sort="
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return GET("$baseUrl/search?q=$query&with%5B%5D=5102&sort=", headers)
}
override fun mangaDetailsParse(document: Document): SManga = SManga.create()
override fun searchMangaSelector() = "dd"
override fun searchMangaFromElement(element: Element): SManga {
val manga = SManga.create()
val titleSelect = element.select("a.name")
manga.setUrlWithoutDomain(titleSelect.attr("href"))
manga.title = titleSelect.text()
val artistAuthorElements = element.select("a")
if (!artistAuthorElements.isEmpty()) {
if (artistAuthorElements.lastIndex == 1) {
manga.author = artistAuthorElements[1].text()
} else {
manga.artist = artistAuthorElements[1].text()
manga.author = artistAuthorElements[2].text()
}
}
val genreElements = element.select("a.label")
parseGenres(genreElements, manga)
return manga
}
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
return document.select(chapterListSelector()).map {
chapterFromElement(it)
}
}
override fun chapterListSelector() = ".chapters.show#main"
override fun chapterFromElement(element: Element): SChapter {
val chapter = SChapter.create()
chapter.setUrlWithoutDomain(element.baseUri())
chapter.name = element.select("h3").text()
chapter.date_upload = element.select("span.released")?.first().let {
SimpleDateFormat("MMM dd, yy", Locale.ENGLISH).parse(it!!.text()).time
}
return chapter
}
override fun popularMangaSelector() = searchMangaSelector()
override fun popularMangaFromElement(element: Element) = searchMangaFromElement(element)
override fun popularMangaParse(response: Response) = searchMangaParse(response)
}

View File

@ -15,6 +15,7 @@ import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import org.jsoup.nodes.Node
import org.jsoup.nodes.TextNode
import org.jsoup.select.Elements
import java.text.SimpleDateFormat
import java.util.*
@ -92,15 +93,17 @@ abstract class DynastyScans : ParsedHttpSource() {
when {
it.contains("Ongoing") -> SManga.ONGOING
it.contains("Completed") -> SManga.COMPLETED
it.contains("Licensed") -> SManga.LICENSED
else -> SManga.UNKNOWN
}
}
return true
}
protected fun parseGenres(document: Document, manga: SManga) {
protected fun parseGenres(document: Document, manga: SManga, select: String = "div.tags > div.tag-tags") {
manga.genre = ""
val glist = document.select("div.tags > div.tag-tags").first().getElementsByTag("a")
val glist = document.select(select).first().getElementsByTag("a")
parseGenres(glist, manga)
if (!glist.isEmpty()) {
for (g in glist) {
val s = g.text()
@ -109,6 +112,15 @@ abstract class DynastyScans : ParsedHttpSource() {
}
}
protected fun parseGenres(elements: Elements, manga: SManga) {
if (!elements.isEmpty()) {
var genres = mutableListOf<String>()
elements?.forEach { genres.add(it.text()) }
manga.genre = genres.joinToString(", ")
}
}
protected fun parseDescription(document: Document, manga: SManga) {
manga.description = document.select("div.tags > div.row div.description").text()
}

View File

@ -13,7 +13,7 @@ class DynastySeries : DynastyScans() {
override fun popularMangaInitialUrl() = "$baseUrl/series?view=cover"
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return GET("$baseUrl/search?q=$query&classes[]=Series&sort=", headers)
return GET("$baseUrl/search?q=$query&classes%5B%5D=Series&sort=", headers)
}
override fun mangaDetailsParse(document: Document): SManga {