From 623ecd97e9a5ed4ef208c28fbb37423054e4dacc Mon Sep 17 00:00:00 2001 From: Claudemirovsky <63046606+Claudemirovsky@users.noreply.github.com> Date: Mon, 9 Oct 2023 09:32:02 -0300 Subject: [PATCH 01/10] chore: Create HDFilmCehennemi base --- src/tr/hdfilmcehennemi/AndroidManifest.xml | 22 +++ src/tr/hdfilmcehennemi/build.gradle | 15 ++ .../tr/hdfilmcehennemi/HDFilmCehennemi.kt | 129 ++++++++++++++++++ .../HDFilmCehennemiUrlActivity.kt | 41 ++++++ 4 files changed, 207 insertions(+) create mode 100644 src/tr/hdfilmcehennemi/AndroidManifest.xml create mode 100644 src/tr/hdfilmcehennemi/build.gradle create mode 100644 src/tr/hdfilmcehennemi/src/eu/kanade/tachiyomi/animeextension/tr/hdfilmcehennemi/HDFilmCehennemi.kt create mode 100644 src/tr/hdfilmcehennemi/src/eu/kanade/tachiyomi/animeextension/tr/hdfilmcehennemi/HDFilmCehennemiUrlActivity.kt diff --git a/src/tr/hdfilmcehennemi/AndroidManifest.xml b/src/tr/hdfilmcehennemi/AndroidManifest.xml new file mode 100644 index 0000000000..4f1a918e38 --- /dev/null +++ b/src/tr/hdfilmcehennemi/AndroidManifest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + diff --git a/src/tr/hdfilmcehennemi/build.gradle b/src/tr/hdfilmcehennemi/build.gradle new file mode 100644 index 0000000000..c110379b7f --- /dev/null +++ b/src/tr/hdfilmcehennemi/build.gradle @@ -0,0 +1,15 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + +} + +ext { + extName = 'HDFilmCehennemi' + pkgNameSuffix = 'tr.hdfilmcehennemi' + extClass = '.HDFilmCehennemi' + extVersionCode = 1 + libVersion = '13' +} + +apply from: "$rootDir/common.gradle" diff --git a/src/tr/hdfilmcehennemi/src/eu/kanade/tachiyomi/animeextension/tr/hdfilmcehennemi/HDFilmCehennemi.kt b/src/tr/hdfilmcehennemi/src/eu/kanade/tachiyomi/animeextension/tr/hdfilmcehennemi/HDFilmCehennemi.kt new file mode 100644 index 0000000000..e98eb31325 --- /dev/null +++ b/src/tr/hdfilmcehennemi/src/eu/kanade/tachiyomi/animeextension/tr/hdfilmcehennemi/HDFilmCehennemi.kt @@ -0,0 +1,129 @@ +package eu.kanade.tachiyomi.animeextension.tr.hdfilmcehennemi + +import eu.kanade.tachiyomi.animesource.model.AnimeFilterList +import eu.kanade.tachiyomi.animesource.model.AnimesPage +import eu.kanade.tachiyomi.animesource.model.SAnime +import eu.kanade.tachiyomi.animesource.model.SEpisode +import eu.kanade.tachiyomi.animesource.model.Video +import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.util.asJsoup +import okhttp3.Request +import okhttp3.Response +import org.jsoup.nodes.Document +import org.jsoup.nodes.Element +import rx.Observable + +class HDFilmCehennemi : ParsedAnimeHttpSource() { + + override val name = "HDFilmCehennemi" + + override val baseUrl = "https://www.hdfilmcehennemi.life" + + override val lang = "tr" + + override val supportsLatest = false + + // ============================== Popular =============================== + override fun popularAnimeRequest(page: Int): Request { + throw UnsupportedOperationException("Not used.") + } + + override fun popularAnimeSelector(): String { + throw UnsupportedOperationException("Not used.") + } + + override fun popularAnimeFromElement(element: Element): SAnime { + throw UnsupportedOperationException("Not used.") + } + + override fun popularAnimeNextPageSelector(): String? { + throw UnsupportedOperationException("Not used.") + } + + // =============================== Latest =============================== + override fun latestUpdatesRequest(page: Int): Request { + throw UnsupportedOperationException("Not used.") + } + + override fun latestUpdatesSelector(): String { + throw UnsupportedOperationException("Not used.") + } + + override fun latestUpdatesFromElement(element: Element): SAnime { + throw UnsupportedOperationException("Not used.") + } + + override fun latestUpdatesNextPageSelector(): String? { + throw UnsupportedOperationException("Not used.") + } + + // =============================== Search =============================== + override fun fetchSearchAnime(page: Int, query: String, filters: AnimeFilterList): Observable { + return if (query.startsWith(PREFIX_SEARCH)) { // URL intent handler + val id = query.removePrefix(PREFIX_SEARCH) + client.newCall(GET("$baseUrl/$id")) + .asObservableSuccess() + .map(::searchAnimeByIdParse) + } else { + super.fetchSearchAnime(page, query, filters) + } + } + + private fun searchAnimeByIdParse(response: Response): AnimesPage { + val details = animeDetailsParse(response.use { it.asJsoup() }) + return AnimesPage(listOf(details), false) + } + + override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request { + throw UnsupportedOperationException("Not used.") + } + + override fun searchAnimeSelector(): String { + throw UnsupportedOperationException("Not used.") + } + + override fun searchAnimeFromElement(element: Element): SAnime { + throw UnsupportedOperationException("Not used.") + } + + override fun searchAnimeNextPageSelector(): String? { + throw UnsupportedOperationException("Not used.") + } + + // =========================== Anime Details ============================ + override fun animeDetailsParse(document: Document): SAnime { + throw UnsupportedOperationException("Not used.") + } + + // ============================== Episodes ============================== + override fun episodeListSelector(): String { + throw UnsupportedOperationException("Not used.") + } + + override fun episodeFromElement(element: Element): SEpisode { + throw UnsupportedOperationException("Not used.") + } + + // ============================ Video Links ============================= + override fun videoListParse(response: Response): List