From f84834770d979acf435907b0bee49ad6224b485b Mon Sep 17 00:00:00 2001 From: Ghost <> Date: Thu, 19 Jun 2025 19:08:09 -0500 Subject: [PATCH] [animeowl] fix: Quality preference match (#880) Checklist: - [x] Updated `extVersionCode` value in `build.gradle` for individual extensions - [ ] Updated `overrideVersionCode` or `baseVersionCode` as needed for all multisrc extensions - [ ] Referenced all related issues in the PR body (e.g. "Closes #xyz") - [ ] Added the `isNsfw = true` flag in `build.gradle` when appropriate - [x] Have not changed source names - [ ] Have explicitly kept the `id` if a source's name or language were changed - [x] Have tested the modifications by compiling and running the extension through Android Studio - [ ] Have removed `web_hi_res_512.png` when adding a new extension - [ ] Have made sure all the icons are in png format Co-authored-by: Khaled Reviewed-on: https://kohiden.xyz/Kohi-den/extensions-source/pulls/880 Co-authored-by: Ghost <> Co-committed-by: Ghost <> --- .../tachiyomi/animeextension/en/animeowl/AnimeOwl.kt | 6 +++--- .../en/animeowl/extractors/OwlExtractor.kt | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/en/animeowl/src/eu/kanade/tachiyomi/animeextension/en/animeowl/AnimeOwl.kt b/src/en/animeowl/src/eu/kanade/tachiyomi/animeextension/en/animeowl/AnimeOwl.kt index 3b061288..2f1f3d17 100644 --- a/src/en/animeowl/src/eu/kanade/tachiyomi/animeextension/en/animeowl/AnimeOwl.kt +++ b/src/en/animeowl/src/eu/kanade/tachiyomi/animeextension/en/animeowl/AnimeOwl.kt @@ -129,7 +129,7 @@ class AnimeOwl : ConfigurableAnimeSource, ParsedAnimeHttpSource() { val document = response.asJsoup() val sub = document.select("#anime-cover-sub-content .episode-node").mapIndexed { idx, it -> EpisodeResponse.Episode( - id = it.attr("title").toDoubleOrNull(), + id = idx.toDouble(), episodeIndex = idx.toString(), name = it.attr("title"), lang = "Sub", @@ -138,7 +138,7 @@ class AnimeOwl : ConfigurableAnimeSource, ParsedAnimeHttpSource() { } val dub = document.select("#anime-cover-dub-content .episode-node").mapIndexed { idx, it -> EpisodeResponse.Episode( - id = it.attr("title").toDoubleOrNull(), + id = idx.toDouble(), episodeIndex = idx.toString(), name = it.attr("title"), lang = "Dub", @@ -301,6 +301,6 @@ class AnimeOwl : ConfigurableAnimeSource, ParsedAnimeHttpSource() { private const val PREF_QUALITY_KEY = "preferred_quality" private const val PREF_QUALITY_TITLE = "Preferred quality" private const val PREF_QUALITY_DEFAULT = "1080p" - private val PREF_QUALITY_LIST = arrayOf("1080p", "720p", "480p", "360p") + private val PREF_QUALITY_LIST = arrayOf("2K", "1080p", "720p", "480p", "360p") } } diff --git a/src/en/animeowl/src/eu/kanade/tachiyomi/animeextension/en/animeowl/extractors/OwlExtractor.kt b/src/en/animeowl/src/eu/kanade/tachiyomi/animeextension/en/animeowl/extractors/OwlExtractor.kt index 3d4c22a9..d768aa1c 100644 --- a/src/en/animeowl/src/eu/kanade/tachiyomi/animeextension/en/animeowl/extractors/OwlExtractor.kt +++ b/src/en/animeowl/src/eu/kanade/tachiyomi/animeextension/en/animeowl/extractors/OwlExtractor.kt @@ -48,8 +48,13 @@ class OwlExtractor(private val client: OkHttpClient, private val baseUrl: String luffy.forEach { stream -> noRedirectClient.newCall(GET("${stream.url}$jwt")).execute() .use { it.headers["Location"] }?.let { + val resolution = when { + stream.resolution?.endsWith("0") == true -> "${stream.resolution}p" + else -> stream.resolution + } + videoList.add( - Video(it, "${link.lang} Luffy:${stream.resolution}", it), + Video(it, "${link.lang} Luffy:${resolution ?: "Unknown"}", it), ) } } @@ -83,7 +88,10 @@ class OwlExtractor(private val client: OkHttpClient, private val baseUrl: String return client.newCall(GET(url)).execute().let { it -> if (it.isSuccessful) { it.parseAs().url.let { - playlistUtils.extractFromHls(it, videoNameGen = { qty -> "$lang $server:$qty" }) + playlistUtils.extractFromHls( + it, + videoNameGen = { qty -> "$lang $server:$qty" }, + ) } } else { emptyList()