diff --git a/src/en/dynasty/build.gradle b/src/en/dynasty/build.gradle index d4593a447..8bf84f7cb 100644 --- a/src/en/dynasty/build.gradle +++ b/src/en/dynasty/build.gradle @@ -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' } diff --git a/src/en/dynasty/res/mipmap-hdpi/ic_launcher.png b/src/en/dynasty/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..5ad6b13ad Binary files /dev/null and b/src/en/dynasty/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/en/dynasty/res/mipmap-mdpi/ic_launcher.png b/src/en/dynasty/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..819dad633 Binary files /dev/null and b/src/en/dynasty/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/en/dynasty/res/mipmap-xhdpi/ic_launcher.png b/src/en/dynasty/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..aea7c7268 Binary files /dev/null and b/src/en/dynasty/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/en/dynasty/res/mipmap-xxhdpi/ic_launcher.png b/src/en/dynasty/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..6fd0e0f0e Binary files /dev/null and b/src/en/dynasty/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/en/dynasty/res/mipmap-xxxhdpi/ic_launcher.png b/src/en/dynasty/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..b0226c380 Binary files /dev/null and b/src/en/dynasty/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/en/dynasty/res/web_hi_res_512.png b/src/en/dynasty/res/web_hi_res_512.png new file mode 100644 index 000000000..560554c52 Binary files /dev/null and b/src/en/dynasty/res/web_hi_res_512.png differ diff --git a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyAnthologies.kt b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyAnthologies.kt index 3708dd9a2..cd6ed351f 100644 --- a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyAnthologies.kt +++ b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyAnthologies.kt @@ -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) diff --git a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyDoujins.kt b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyDoujins.kt index 3e86bbcd1..071921d6a 100644 --- a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyDoujins.kt +++ b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyDoujins.kt @@ -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 { diff --git a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyFactory.kt b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyFactory.kt new file mode 100644 index 000000000..d75ec1789 --- /dev/null +++ b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyFactory.kt @@ -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 = getAllDynasty() +} + +fun getAllDynasty() = + listOf( + DynastyAnthologies(), + DynastyOneshots(), + DynastyDoujins(), + DynastyIssues(), + DynastySeries()) diff --git a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyIssues.kt b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyIssues.kt index d86986a77..799a9f7f6 100644 --- a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyIssues.kt +++ b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyIssues.kt @@ -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 { diff --git a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyOneshots.kt b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyOneshots.kt new file mode 100644 index 000000000..eddbb6eb4 --- /dev/null +++ b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyOneshots.kt @@ -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 { + 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) + +} \ No newline at end of file diff --git a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt index 9c5040b11..9a50f846d 100644 --- a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt +++ b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt @@ -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() + 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() } diff --git a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastySeries.kt b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastySeries.kt index fab5f9bf3..637a14f5f 100644 --- a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastySeries.kt +++ b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastySeries.kt @@ -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 {