en/AniPlay: added Timed out message
This commit is contained in:
parent
c70edd824c
commit
cfc4422280
1 changed files with 12 additions and 0 deletions
|
@ -208,10 +208,13 @@ class AniPlay : AniListAnimeHttpSource(), ConfigurableAnimeSource {
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val episodeDataList = extras.parallelFlatMapBlocking { extra ->
|
val episodeDataList = extras.parallelFlatMapBlocking { extra ->
|
||||||
|
var timeouts: Int = 0
|
||||||
|
var maxTimeout: Int = 0
|
||||||
val languages = mutableListOf("sub").apply {
|
val languages = mutableListOf("sub").apply {
|
||||||
if (extra.hasDub) add("dub")
|
if (extra.hasDub) add("dub")
|
||||||
}
|
}
|
||||||
languages.map { language ->
|
languages.map { language ->
|
||||||
|
maxTimeout += 1
|
||||||
val epNum = if (extra.episodeNum == extra.episodeNum.toInt().toFloat()) {
|
val epNum = if (extra.episodeNum == extra.episodeNum.toInt().toFloat()) {
|
||||||
extra.episodeNum.toInt().toString() // If it has no fractional part, convert it to an integer
|
extra.episodeNum.toInt().toString() // If it has no fractional part, convert it to an integer
|
||||||
} else {
|
} else {
|
||||||
|
@ -242,16 +245,25 @@ class AniPlay : AniListAnimeHttpSource(), ConfigurableAnimeSource {
|
||||||
language = language,
|
language = language,
|
||||||
response = data,
|
response = data,
|
||||||
)
|
)
|
||||||
|
} catch (e: java.net.SocketTimeoutException) {
|
||||||
|
timeouts += 1
|
||||||
|
null
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
Log.w("AniPlay", "VideoList $url IOException", e)
|
Log.w("AniPlay", "VideoList $url IOException", e)
|
||||||
|
timeouts = -999
|
||||||
null // Return null to be filtered out
|
null // Return null to be filtered out
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.w("AniPlay", "VideoList $url Exception", e)
|
Log.w("AniPlay", "VideoList $url Exception", e)
|
||||||
|
timeouts = -999
|
||||||
null // Return null to be filtered out
|
null // Return null to be filtered out
|
||||||
}
|
}
|
||||||
}.filterNotNull() // Filter out null values due to errors
|
}.filterNotNull() // Filter out null values due to errors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (maxTimeout == timeouts && timeouts != 0) {
|
||||||
|
throw Exception("Timed out")
|
||||||
|
}
|
||||||
|
|
||||||
val videos = episodeDataList.flatMap { episodeData ->
|
val videos = episodeDataList.flatMap { episodeData ->
|
||||||
val defaultSource = episodeData.response.sources?.firstOrNull {
|
val defaultSource = episodeData.response.sources?.firstOrNull {
|
||||||
it.quality in listOf("default", "auto")
|
it.quality in listOf("default", "auto")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue