From 81742de4ef0acc5329f714b567890c41bd056a46 Mon Sep 17 00:00:00 2001 From: darkdemon Date: Fri, 2 Dec 2022 18:09:28 +0530 Subject: [PATCH] fix(subtitle): subtitle name feat(subtitle): add hearing impaired option --- .../syncproviders/providers/Addic7ed.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/Addic7ed.kt b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/Addic7ed.kt index 46467671..507c5e2a 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/Addic7ed.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/Addic7ed.kt @@ -41,7 +41,8 @@ class Addic7ed : AbstractSubApi { results: MutableList, name: String, link: String, - headers: Map + headers: Map, + isHearingImpaired: Boolean ) { results.add( AbstractSubtitleEntities.SubtitleEntity( @@ -54,7 +55,8 @@ class Addic7ed : AbstractSubApi { epNumber = epNum, seasonNumber = seasonNum, year = yearNum, - headers = headers + headers = headers, + isHearingImpaired = isHearingImpaired ) ) } @@ -89,11 +91,13 @@ class Addic7ed : AbstractSubApi { ).document document.select(".tabel95 .tabel95 tr:contains($queryLang)").mapNotNull { node -> - val name = if (seasonNum > 0) "S${seasonNum}E$epNum${ + val name = if (seasonNum > 0) "${document.select(".titulo").text().replace("Subtitle","").trim()}${ node.parent()!!.select(".NewsTitle").text().substringAfter("Version").substringBefore(", Duration") - }" else node.parent()!!.select(".NewsTitle").text() + }" else "${document.select(".titulo").text().replace("Subtitle","").trim()}${node.parent()!!.select(".NewsTitle").text().substringAfter("Version").substringBefore(", Duration")}" val link = fixUrl(node.select("a.buttonDownload").attr("href")) - cleanResources(results, name, link, mapOf("referer" to "$host/")) + val isHearingImpaired = + !node.parent()!!.select("tr:last-child [title=\"Hearing Impaired\"]").isNullOrEmpty() + cleanResources(results, name, link, mapOf("referer" to "$host/"), isHearingImpaired) } return results }