diff --git a/src/en/thepropertyofhate/build.gradle b/src/en/thepropertyofhate/build.gradle new file mode 100644 index 000000000..2706d9165 --- /dev/null +++ b/src/en/thepropertyofhate/build.gradle @@ -0,0 +1,12 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' + +ext { + extName = 'The Property of Hate' + pkgNameSuffix = 'en.thepropertyofhate' + extClass = '.ThePropertyOfHate' + extVersionCode = 1 + libVersion = '1.2' +} + +apply from: "$rootDir/common.gradle" diff --git a/src/en/thepropertyofhate/res/mipmap-hdpi/ic_launcher.png b/src/en/thepropertyofhate/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..82499db30 Binary files /dev/null and b/src/en/thepropertyofhate/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/en/thepropertyofhate/res/mipmap-mdpi/ic_launcher.png b/src/en/thepropertyofhate/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..c43314817 Binary files /dev/null and b/src/en/thepropertyofhate/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/en/thepropertyofhate/res/mipmap-xhdpi/ic_launcher.png b/src/en/thepropertyofhate/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..23bccac87 Binary files /dev/null and b/src/en/thepropertyofhate/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/en/thepropertyofhate/res/mipmap-xxhdpi/ic_launcher.png b/src/en/thepropertyofhate/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..72d0da8ed Binary files /dev/null and b/src/en/thepropertyofhate/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/en/thepropertyofhate/res/mipmap-xxxhdpi/ic_launcher.png b/src/en/thepropertyofhate/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..dcb9ab07a Binary files /dev/null and b/src/en/thepropertyofhate/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/en/thepropertyofhate/res/web_hi_res_512.png b/src/en/thepropertyofhate/res/web_hi_res_512.png new file mode 100644 index 000000000..412b9942f Binary files /dev/null and b/src/en/thepropertyofhate/res/web_hi_res_512.png differ diff --git a/src/en/thepropertyofhate/src/eu/kanade/tachiyomi/extension/en/thepropertyofhate/ThePropertyOfHate.kt b/src/en/thepropertyofhate/src/eu/kanade/tachiyomi/extension/en/thepropertyofhate/ThePropertyOfHate.kt new file mode 100644 index 000000000..60b56223a --- /dev/null +++ b/src/en/thepropertyofhate/src/eu/kanade/tachiyomi/extension/en/thepropertyofhate/ThePropertyOfHate.kt @@ -0,0 +1,115 @@ +package eu.kanade.tachiyomi.extension.en.thepropertyofhate + +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.model.MangasPage +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.HttpSource +import eu.kanade.tachiyomi.util.asJsoup +import okhttp3.Request +import okhttp3.Response +import rx.Observable + +/** + * @author Aria Moradi + */ + +class ThePropertyOfHate : HttpSource() { + + override val name = "The Property of Hate" + + override val baseUrl = "http://jolleycomics.com" + + val firstChapterUrl = "/TPoH/The Hook/" + + override val lang = "en" + + override val supportsLatest: Boolean = false + + // the one and only manga entry + fun manga(): SManga { + return SManga.create().apply { + title = "The Property of Hate" + thumbnail_url = "https://dummyimage.com/768x994/000/ffffff.jpg&text=$title" // the comic has no real cover + artist = "Sarah Jolley" + author = "Sarah Jolley" + status = SManga.UNKNOWN + url = baseUrl + } + } + + override fun fetchPopularManga(page: Int): Observable { + return Observable.just(MangasPage(listOf(manga()), false)) + } + + override fun popularMangaRequest(page: Int): Request = throw Exception("Not used") + + override fun popularMangaParse(response: Response): MangasPage = throw Exception("Not used") + + // latest Updates not used + + override fun latestUpdatesParse(response: Response): MangasPage = throw Exception("Not used") + + override fun latestUpdatesRequest(page: Int): Request = throw Exception("Not used") + + // the manga is one and only, but still write the data again to avoid bugs in backup restore + override fun fetchMangaDetails(manga: SManga): Observable { + return Observable.just(manga()) + } + + override fun mangaDetailsParse(response: Response): SManga = throw Exception("Not used") + + // chapter list + + override fun chapterListRequest(manga: SManga): Request { + return GET(baseUrl + firstChapterUrl, headers) // no real base url for this comic so must read the first chapter's link + } + + override fun chapterListParse(response: Response): List { + val document = response.asJsoup() + + val chapters = mutableListOf( + SChapter.create().apply() { // must hard code the first one + url = firstChapterUrl + name = "The Hook" + } + ) + + document.select("select > option").forEach { option -> + if (!option.text().startsWith("-")) // ignore "jump to entry" option + chapters.add( + SChapter.create().apply { + url = option.attr("value") + name = option.text() + } + ) + } + + return chapters + } + + override fun pageListParse(response: Response): List { + val document = response.asJsoup() + + // parse the options for this chapter to get page links + val pages = document.select("select > optgroup > option").mapIndexed { pageNum, option -> + Page(pageNum, baseUrl + option.attr("value")) + } + + return pages + } + + override fun imageUrlParse(response: Response): String { + val document = response.asJsoup() + + return baseUrl + document.select(".comic_comic > img").first().attr("src") + } + + override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable = throw Exception("Search functionality is not available.") + + override fun searchMangaParse(response: Response): MangasPage = throw Exception("Not used") + + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = throw Exception("Not used") +}