mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Add Uri.EMPTY check
This commit is contained in:
parent
4a8a5835ef
commit
147447bed4
1 changed files with 12 additions and 9 deletions
|
@ -1,5 +1,6 @@
|
||||||
package com.lagradost.cloudstream3.ui.player
|
package com.lagradost.cloudstream3.ui.player
|
||||||
|
|
||||||
|
import android.net.Uri
|
||||||
import com.lagradost.cloudstream3.AcraApplication.Companion.context
|
import com.lagradost.cloudstream3.AcraApplication.Companion.context
|
||||||
import com.lagradost.cloudstream3.CommonActivity.activity
|
import com.lagradost.cloudstream3.CommonActivity.activity
|
||||||
import com.lagradost.cloudstream3.R
|
import com.lagradost.cloudstream3.R
|
||||||
|
@ -63,17 +64,19 @@ class DownloadFileGenerator(
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val meta = episodes[currentIndex + offset]
|
val meta = episodes[currentIndex + offset]
|
||||||
|
|
||||||
// We do this here so that we only load it when
|
if (meta.uri == Uri.EMPTY) {
|
||||||
// we actually need it as it can be more expensive.
|
// We do this here so that we only load it when
|
||||||
val info = meta.id?.let { id ->
|
// we actually need it as it can be more expensive.
|
||||||
activity?.let { act ->
|
val info = meta.id?.let { id ->
|
||||||
getDownloadFileInfoAndUpdateSettings(act, id)
|
activity?.let { act ->
|
||||||
|
getDownloadFileInfoAndUpdateSettings(act, id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
val newMeta = meta.copy(uri = info.path)
|
val newMeta = meta.copy(uri = info.path)
|
||||||
callback(null to newMeta)
|
callback(null to newMeta)
|
||||||
|
} else callback(null to meta)
|
||||||
} else callback(null to meta)
|
} else callback(null to meta)
|
||||||
|
|
||||||
val ctx = context ?: return true
|
val ctx = context ?: return true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue