New source: The Property of Hate (#4834)

* initial commit

* finished the code and it works
This commit is contained in:
Aria Moradi 2020-11-10 21:44:06 +03:30 committed by GitHub
parent d4f818b7a8
commit b84b6dee2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 127 additions and 0 deletions

View File

@ -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"

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

View File

@ -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 <aria.moradi007@gmail.com>
*/
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<MangasPage> {
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<SManga> {
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<SChapter> {
val document = response.asJsoup()
val chapters = mutableListOf<SChapter>(
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<Page> {
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<MangasPage> = 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")
}