diff --git a/src/en/latisbooks/build.gradle b/src/en/latisbooks/build.gradle new file mode 100644 index 000000000..a7231d9c8 --- /dev/null +++ b/src/en/latisbooks/build.gradle @@ -0,0 +1,12 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' + +ext { + appName = 'Tachiyomi: Latis Books' + pkgNameSuffix = 'en.latisbooks' + extClass = '.Latisbooks' + extVersionCode = 1 + libVersion = '1.2' +} + +apply from: "$rootDir/common.gradle" diff --git a/src/en/latisbooks/res/mipmap-hdpi/ic_launcher.png b/src/en/latisbooks/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..37d95aac4 Binary files /dev/null and b/src/en/latisbooks/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/en/latisbooks/res/mipmap-mdpi/ic_launcher.png b/src/en/latisbooks/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..edd1522b7 Binary files /dev/null and b/src/en/latisbooks/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/en/latisbooks/res/mipmap-xhdpi/ic_launcher.png b/src/en/latisbooks/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..a5d4f2602 Binary files /dev/null and b/src/en/latisbooks/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/en/latisbooks/res/mipmap-xxhdpi/ic_launcher.png b/src/en/latisbooks/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..66b559ff8 Binary files /dev/null and b/src/en/latisbooks/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/en/latisbooks/res/mipmap-xxxhdpi/ic_launcher.png b/src/en/latisbooks/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..13120621e Binary files /dev/null and b/src/en/latisbooks/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/en/latisbooks/src/eu/kanade/tachiyomi/extension/en/latisbooks/Latisbooks.kt b/src/en/latisbooks/src/eu/kanade/tachiyomi/extension/en/latisbooks/Latisbooks.kt new file mode 100644 index 000000000..4c0b457d8 --- /dev/null +++ b/src/en/latisbooks/src/eu/kanade/tachiyomi/extension/en/latisbooks/Latisbooks.kt @@ -0,0 +1,100 @@ +package eu.kanade.tachiyomi.extension.en.latisbooks + +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.source.model.* +import eu.kanade.tachiyomi.source.online.HttpSource +import eu.kanade.tachiyomi.util.asJsoup +import okhttp3.OkHttpClient +import okhttp3.Request +import okhttp3.Response +import rx.Observable + +class Latisbooks : HttpSource() { + + override val name = "Latis Books" + + override val baseUrl = "https://www.latisbooks.com" + + override val lang = "en" + + override val supportsLatest = false + + override val client: OkHttpClient = network.cloudflareClient + + private fun createManga(response: Response): SManga { + return SManga.create().apply { + initialized = true + title = "Bodysuit 23" + url = "/archive/" + thumbnail_url = response.asJsoup().select("img.thumb-image").firstOrNull()?.attr("abs:data-src") + } + } + + // Popular + + override fun fetchPopularManga(page: Int): Observable { + return client.newCall(popularMangaRequest(page)) + .asObservableSuccess() + .map { response -> + MangasPage(listOf(createManga(response)), false) + } + } + + override fun popularMangaRequest(page: Int): Request { + return (GET("$baseUrl/archive/", headers)) + } + + override fun popularMangaParse(response: Response): MangasPage = throw UnsupportedOperationException("Not used") + + // Latest + + override fun latestUpdatesRequest(page: Int): Request = throw UnsupportedOperationException("Not used") + + override fun latestUpdatesParse(response: Response): MangasPage = throw UnsupportedOperationException("Not used") + + // Search + + override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable = Observable.just(MangasPage(emptyList(), false)) + + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = throw UnsupportedOperationException("Not used") + + override fun searchMangaParse(response: Response): MangasPage = throw UnsupportedOperationException("Not used") + + // Details + + override fun fetchMangaDetails(manga: SManga): Observable { + return client.newCall(mangaDetailsRequest(manga)) + .asObservableSuccess() + .map { response -> + createManga(response) + } + } + + override fun mangaDetailsParse(response: Response): SManga = throw UnsupportedOperationException("Not used") + + // Chapters + + override fun chapterListParse(response: Response): List { + return response.asJsoup().select("ul.archive-item-list li a").map { + SChapter.create().apply { + name = it.text() + url = it.attr("abs:href") + } + } + } + + // Pages + + override fun fetchPageList(chapter: SChapter): Observable> { + return Observable.just(listOf(Page(0, chapter.url))) + } + + override fun pageListParse(response: Response): List = throw UnsupportedOperationException("Not used") + + override fun imageUrlParse(response: Response): String { + return response.asJsoup().select("div.content-wrapper img.thumb-image").attr("abs:data-src") + } + + override fun getFilterList() = FilterList() +} diff --git a/src/en/latisbooks/src/web_hi_res_512.png b/src/en/latisbooks/src/web_hi_res_512.png new file mode 100644 index 000000000..5c35d319f Binary files /dev/null and b/src/en/latisbooks/src/web_hi_res_512.png differ