diff --git a/src/en/patchfriday/build.gradle b/src/en/patchfriday/build.gradle new file mode 100644 index 000000000..90c8e8ad0 --- /dev/null +++ b/src/en/patchfriday/build.gradle @@ -0,0 +1,12 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' + +ext { + appName = 'Tachiyomi: Patch Friday' + pkgNameSuffix = 'en.patchfriday' + extClass = '.PatchFriday' + extVersionCode = 1 + libVersion = '1.2' +} + +apply from: "$rootDir/common.gradle" diff --git a/src/en/patchfriday/res/mipmap-hdpi/ic_launcher.png b/src/en/patchfriday/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..3826e1a84 Binary files /dev/null and b/src/en/patchfriday/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/en/patchfriday/res/mipmap-mdpi/ic_launcher.png b/src/en/patchfriday/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..eb1448a54 Binary files /dev/null and b/src/en/patchfriday/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/en/patchfriday/res/mipmap-xhdpi/ic_launcher.png b/src/en/patchfriday/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..a7bb8efad Binary files /dev/null and b/src/en/patchfriday/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/en/patchfriday/res/mipmap-xxhdpi/ic_launcher.png b/src/en/patchfriday/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..23e5cc74f Binary files /dev/null and b/src/en/patchfriday/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/en/patchfriday/res/mipmap-xxxhdpi/ic_launcher.png b/src/en/patchfriday/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..b1275000d Binary files /dev/null and b/src/en/patchfriday/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/en/patchfriday/res/web_hi_res_512.png b/src/en/patchfriday/res/web_hi_res_512.png new file mode 100644 index 000000000..5d99d4a6e Binary files /dev/null and b/src/en/patchfriday/res/web_hi_res_512.png differ diff --git a/src/en/patchfriday/src/eu/kanade/tachiyomi/extension/en/patchfriday/PatchFriday.kt b/src/en/patchfriday/src/eu/kanade/tachiyomi/extension/en/patchfriday/PatchFriday.kt new file mode 100644 index 000000000..434c42ca2 --- /dev/null +++ b/src/en/patchfriday/src/eu/kanade/tachiyomi/extension/en/patchfriday/PatchFriday.kt @@ -0,0 +1,99 @@ +package eu.kanade.tachiyomi.extension.en.patchfriday + +import eu.kanade.tachiyomi.network.GET +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 PatchFriday : HttpSource() { + + override val name = "Patch Friday" + + override val baseUrl = "https://patchfriday.com" + + override val lang = "en" + + override val supportsLatest = false + + override val client: OkHttpClient = network.cloudflareClient + + private fun createManga(): SManga { + return SManga.create().apply { + initialized = true + title = "Patch Friday" + url = "" + thumbnail_url = "https://patchfriday.com/patches/68.png" + description = "The IT security webcomic" + } + } + + // Popular + + override fun fetchPopularManga(page: Int): Observable { + return Observable.just(MangasPage(listOf(createManga()), false)) + } + + override fun popularMangaRequest(page: Int): Request = throw UnsupportedOperationException("Not used") + + 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 Observable.just(createManga()) + } + + override fun mangaDetailsParse(response: Response): SManga = throw UnsupportedOperationException("Not used") + + // Chapters + + override fun chapterListParse(response: Response): List { + val last = response.asJsoup().select("ul.strip_toolbar li a[rel=next]").attr("href") + .removeSurrounding("/").toInt() + + return listOf(1 .. last).flatten().reversed().map { + SChapter.create().apply { + name = "#$it - " + url = "/$it/" + } + } + } + + override fun prepareNewChapter(chapter: SChapter, manga: SManga) { + val cName = client.newCall(GET(baseUrl + chapter.url)).execute().asJsoup().select("div#strip_title").text() + + chapter.apply { name += cName } + } + + // Pages + + override fun fetchPageList(chapter: SChapter): Observable> { + return Observable.just(listOf(Page(0, baseUrl + chapter.url))) + } + + override fun pageListParse(response: Response): List = throw UnsupportedOperationException("Not used") + + override fun imageUrlParse(response: Response): String { + return response.asJsoup().select("div#strip_image img").attr("abs:src") + } + + override fun getFilterList() = FilterList() +}