Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ open class Cda : ExtractorApi() {
override var name = "Cda"
override val requiresReferer = false


override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
val mediaId = url
.split("/").last()
Expand Down Expand Up @@ -68,7 +67,7 @@ open class Cda : ExtractorApi() {
a = URLDecoder.decode(a, "UTF-8")
a = a.map { char ->
if (char.code in 33..126) {
return@map String.format("%c", 33 + (char.code + 14) % 94)
return@map (33 + (char.code + 14) % 94).toChar().toString()
} else {
return@map char
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.ExtractorLinkType
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.utils.newExtractorLink
import kotlin.math.round

open class Gofile : ExtractorApi() {
override val name = "Gofile"
Expand Down Expand Up @@ -67,10 +68,19 @@ open class Gofile : ExtractorApi() {
?: Qualities.Unknown.value
}

private fun roundTo2Decimals(value: Double): String {
val rounded = round(value * 100) / 100.0
val intPart = rounded.toLong()
val decPart = round((rounded - intPart) * 100).toLong()
return "$intPart.${decPart.toString().padStart(2, '0')}"
}

private fun formatBytes(bytes: Long): String {
Comment thread
Luna712 marked this conversation as resolved.
val mb = 1024L * 1024
val gb = mb * 1024
return when {
bytes < 1024L * 1024 * 1024 -> "%.2f MB".format(bytes.toDouble() / (1024 * 1024))
else -> "%.2f GB".format(bytes.toDouble() / (1024 * 1024 * 1024))
bytes < gb -> "${roundTo2Decimals(bytes.toDouble() / mb)} MB"
else -> "${roundTo2Decimals(bytes.toDouble() / gb)} GB"
}
}

Expand Down