anitubeinua: fix episode number

This commit is contained in:
CakesTwix 2023-03-11 19:47:40 +02:00
parent 518abe596f
commit d01fdd2af1
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825

View file

@ -102,8 +102,8 @@ class AnitubeinuaProvider : MainAPI() {
// Return to app // Return to app
// Players, Episodes, Number of episodes // Players, Episodes, Number of episodes
var subEpisodes = mutableListOf<Episode>() val subEpisodes = mutableListOf<Episode>()
var dubEpisodes = mutableListOf<Episode>() val dubEpisodes = mutableListOf<Episode>()
val id = url.split("/").last().split("-").first() val id = url.split("/").last().split("-").first()
val ajax = fromPlaylistAjax("$mainUrl/engine/ajax/playlists.php?news_id=$id&xfield=playlist&time=${Date().time}") val ajax = fromPlaylistAjax("$mainUrl/engine/ajax/playlists.php?news_id=$id&xfield=playlist&time=${Date().time}")
@ -413,13 +413,13 @@ class AnitubeinuaProvider : MainAPI() {
} }
private fun extractIntFromString(string: String): Int? { private fun extractIntFromString(string: String): Int? {
val value = Regex("(\\d+)").find(string)?.value val value = Regex("(\\d+)").find(string)?.value
if(value!![0].toString() == "0"){ if(value?.get(0).toString() == "0"){
return value.drop(1).toIntOrNull() if (value != null) {
return value.drop(1).toIntOrNull()
}
} }
return value.toIntOrNull() return value?.toIntOrNull()
} }
} }