fixed sub again

This commit is contained in:
hexated 2022-10-09 22:40:51 +07:00
parent cf25b6fd64
commit 593d9484c3

View file

@ -157,28 +157,6 @@ class Hdfilmcehennemi : MainAPI() {
} }
} }
private fun fixSubUrl(url: String): String {
if (url.startsWith("http") ||
// Do not fix JSON objects when passed as urls.
url.startsWith("{\"")
) {
return url
}
if (url.isEmpty()) {
return ""
}
val startsWithNoHttp = url.startsWith("//")
if (startsWithNoHttp) {
return "https:$url"
} else {
if (url.startsWith('/')) {
return vidmolyServer + url
}
return "$vidmolyServer/$url"
}
}
private fun String.addMarks(str: String): String { private fun String.addMarks(str: String): String {
return this.replace(Regex("\"?$str\"?"), "\"$str\"") return this.replace(Regex("\"?$str\"?"), "\"$str\"")
} }
@ -212,7 +190,7 @@ class Hdfilmcehennemi : MainAPI() {
subtitleCallback.invoke( subtitleCallback.invoke(
SubtitleFile( SubtitleFile(
it.label.toString(), it.label.toString(),
fixSubUrl(it.file.toString()) "$vidmolyServer${it.file}"
) )
) )
} }