This commit is contained in:
hexated 2023-09-21 14:43:38 +07:00
parent 7ebdfeb3e0
commit cdf15ff08a
11 changed files with 98 additions and 29 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 10
version = 11
cloudstream {

View file

@ -1,6 +1,7 @@
package com.hexated
import com.lagradost.cloudstream3.APIHolder
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.nicehttp.Requests.Companion.await
import okhttp3.OkHttpClient
import okhttp3.Request
@ -58,10 +59,15 @@ fun getEpisodeSlug(
}
fun isUpcoming(dateString: String?): Boolean {
if (dateString == null) return false
val format = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
val dateTime = format.parse(dateString)?.time ?: return false
return APIHolder.unixTimeMS < dateTime
return try {
val format = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
val dateTime = dateString?.let { format.parse(it)?.time } ?: return false
return APIHolder.unixTimeMS < dateTime
} catch (t: Throwable) {
logError(t)
false
}
}
fun fixUrl(url: String, domain: String): String {