mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
added extra logging
This commit is contained in:
parent
3f5119525c
commit
177b1e47f3
2 changed files with 15 additions and 8 deletions
|
@ -81,6 +81,7 @@ class PreviewGenerator : IPreviewGenerator {
|
|||
}
|
||||
|
||||
else -> {
|
||||
Log.i("PreviewImg", "unsupported format for $link")
|
||||
currentGenerator.clear(keepCache)
|
||||
}
|
||||
}
|
||||
|
@ -193,6 +194,7 @@ class M3u8PreviewGenerator : IPreviewGenerator {
|
|||
|
||||
// no support for encryption atm
|
||||
if (hsl.isEncrypted) {
|
||||
Log.i(TAG, "m3u8 is encrypted")
|
||||
totalImages = 0
|
||||
return@withContext
|
||||
}
|
||||
|
@ -239,12 +241,13 @@ class M3u8PreviewGenerator : IPreviewGenerator {
|
|||
if (!isActive) {
|
||||
return@withContext
|
||||
}
|
||||
val frame = retriever.getFrameAtTime(0)
|
||||
val img = retriever.getFrameAtTime(0)
|
||||
if (!isActive) {
|
||||
return@withContext
|
||||
}
|
||||
if(img == null || img.width <= 1 || img.height <= 1) continue
|
||||
synchronized(images) {
|
||||
images[index] = frame
|
||||
images[index] = img
|
||||
loadedImages += 1
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
|
@ -302,6 +305,9 @@ class Mp4PreviewGenerator : IPreviewGenerator {
|
|||
if (idx > loadedImages) {
|
||||
break
|
||||
}
|
||||
if(images[idx] == null) {
|
||||
continue
|
||||
}
|
||||
val currentFraction =
|
||||
(1.0f.div((1 shl l).toFloat()) + i * 1.0f.div(items.toFloat()))
|
||||
val diff = currentFraction.minus(fraction).absoluteValue
|
||||
|
@ -382,6 +388,7 @@ class Mp4PreviewGenerator : IPreviewGenerator {
|
|||
MediaMetadataRetriever.OPTION_CLOSEST_SYNC
|
||||
)
|
||||
if (!scope.isActive) return
|
||||
if(img == null || img.width <= 1 || img.height <= 1) continue
|
||||
synchronized(images) {
|
||||
images[idx] = img
|
||||
loadedImages = maxOf(loadedImages, idx)
|
||||
|
|
|
@ -115,19 +115,19 @@ object M3u8Helper2 {
|
|||
|
||||
private fun selectBest(qualities: List<M3u8Helper.M3u8Stream>): M3u8Helper.M3u8Stream? {
|
||||
val result = qualities.sortedBy {
|
||||
if (it.quality != null && it.quality <= 1080) it.quality else 0
|
||||
}.filter {
|
||||
it.quality ?: Qualities.Unknown.value //if (it.quality != null && it.quality <= 1080) else 0
|
||||
}/*.filter {
|
||||
listOf("m3u", "m3u8").contains(absoluteExtensionDetermination(it.streamUrl))
|
||||
}
|
||||
}*/
|
||||
return result.lastOrNull()
|
||||
}
|
||||
|
||||
private fun selectWorst(qualities: List<M3u8Helper.M3u8Stream>): M3u8Helper.M3u8Stream? {
|
||||
val result = qualities.sortedBy {
|
||||
if (it.quality != null && it.quality <= 1080) it.quality else 0
|
||||
}.filter {
|
||||
it.quality ?: Qualities.Unknown.value //if (it.quality != null && it.quality <= 1080) else 0
|
||||
}/*.filter {
|
||||
listOf("m3u", "m3u8").contains(absoluteExtensionDetermination(it.streamUrl))
|
||||
}
|
||||
}*/
|
||||
return result.firstOrNull()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue