Skip to content

Commit

Permalink
fix(pl/ogladajanime): Correct names of episodes and add fansub (#3268)
Browse files Browse the repository at this point in the history
Co-authored-by: Hayanek <[email protected]>
  • Loading branch information
Hayanek and Hayanek authored May 28, 2024
1 parent a56d5f4 commit d0b60af
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/pl/ogladajanime/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
extName = 'OgladajAnime'
extClass = '.OgladajAnime'
extVersionCode = 2
extVersionCode = 3
isNsfw = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,22 @@ class OgladajAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val episodeNumber = element.attr("value").toFloatOrNull() ?: 0f
val episodeText = element.select("div > div > p").text()

val episodeImg = element.select("div > img").attr("alt")
val episodeImg = element.select("div > img").attr("alt").uppercase()

episode.name = if (episodeText.isNotEmpty()) {
"[${episodeNumber.toInt()}] $episodeText ($episodeImg)"
if (episodeText.isNotEmpty()) {
episode.name = if (episodeImg == "PL") {
"${episodeNumber.toInt()} $episodeText"
} else {
"${episodeNumber.toInt()} [$episodeImg] $episodeText"
}
} else {
"Episode ${episodeNumber.toInt()} ($episodeImg)"
episode.name = if (episodeImg == "PL") {
"${episodeNumber.toInt()} Odcinek"
} else {
"${episodeNumber.toInt()} [$episodeImg] Odcinek"
}
}

episode.episode_number = episodeNumber
episode.url = element.attr("ep_id")

Expand Down Expand Up @@ -173,14 +182,29 @@ class OgladajAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val dataObject = json.decodeFromString<ApiData>(jsonResponse.data)
val serverList = dataObject.players.mapNotNull { player ->
var sub = player.sub.uppercase()
if (sub == "PL" && player.audio == "PL") {
sub = "DUB PL"
if (player.audio == "pl") {
sub = "Lektor"
} else if (player.sub.isEmpty() && sub != "Lektor") {
sub = "Dub " + player.sub.uppercase()
}

val subGroup = if (sub == player.sub_group?.uppercase()) "" else player.sub_group
val subGroupPart = if (subGroup?.isNotEmpty() == true) " $subGroup - " else " "

val prefix = if (player.ismy > 0) {
"[$sub/Odwrócone Kolory] "
if (player.sub == "pl" && player.sub_group?.isNotEmpty() == true) {
"[Odwrócone Kolory] $subGroup - "
} else {
"[$sub/Odwrócone Kolory]$subGroupPart"
}
} else {
"[$sub] "
if (player.sub == "pl" && player.sub_group?.isNotEmpty() == true) {
"$subGroup - "
} else {
"[$sub]$subGroupPart"
}
}

if (player.url !in listOf("vk", "cda", "mp4upload", "sibnet", "dailymotion")) {
return@mapNotNull null
}
Expand Down Expand Up @@ -224,6 +248,7 @@ class OgladajAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val audio: String? = null,
val sub: String,
val url: String,
val sub_group: String? = null,
val ismy: Int,
)

Expand Down

0 comments on commit d0b60af

Please sign in to comment.