debugging

This commit is contained in:
Blatzar 2021-11-04 17:07:29 +01:00
parent 8d772b8ad0
commit a941f71e90
3 changed files with 12 additions and 4 deletions

View file

@ -17,6 +17,7 @@ import com.lagradost.cloudstream3.isMovieType
import com.lagradost.cloudstream3.mvvm.observe import com.lagradost.cloudstream3.mvvm.observe
import com.lagradost.cloudstream3.ui.download.DownloadButtonSetup.handleDownloadClick import com.lagradost.cloudstream3.ui.download.DownloadButtonSetup.handleDownloadClick
import com.lagradost.cloudstream3.utils.AppUtils.loadResult import com.lagradost.cloudstream3.utils.AppUtils.loadResult
import com.lagradost.cloudstream3.utils.Coroutines.main
import com.lagradost.cloudstream3.utils.DOWNLOAD_EPISODE_CACHE import com.lagradost.cloudstream3.utils.DOWNLOAD_EPISODE_CACHE
import com.lagradost.cloudstream3.utils.DataStore import com.lagradost.cloudstream3.utils.DataStore
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
@ -44,8 +45,10 @@ class DownloadFragment : Fragment() {
} }
private fun setList(list: List<VisualDownloadHeaderCached>) { private fun setList(list: List<VisualDownloadHeaderCached>) {
(download_list?.adapter as DownloadHeaderAdapter?)?.cardList = list main {
download_list?.adapter?.notifyDataSetChanged() (download_list?.adapter as DownloadHeaderAdapter?)?.cardList = list
download_list?.adapter?.notifyDataSetChanged()
}
} }
override fun onDestroyView() { override fun onDestroyView() {

View file

@ -34,7 +34,6 @@ class DownloadFileWorkManager(val context: Context, private val workerParams: Wo
val info = applicationContext.getKey<VideoDownloadManager.DownloadInfo>(WORK_KEY_INFO, key) val info = applicationContext.getKey<VideoDownloadManager.DownloadInfo>(WORK_KEY_INFO, key)
val pkg = val pkg =
applicationContext.getKey<VideoDownloadManager.DownloadResumePackage>(WORK_KEY_PACKAGE, key) applicationContext.getKey<VideoDownloadManager.DownloadResumePackage>(WORK_KEY_PACKAGE, key)
println("INFO $info PKG ::: $pkg")
if (info != null) { if (info != null) {
downloadEpisode( downloadEpisode(
applicationContext, applicationContext,

View file

@ -1365,6 +1365,8 @@ object VideoDownloadManager {
val info = context.getKey<DownloadedFileInfo>(KEY_DOWNLOAD_INFO, id.toString()) ?: return null val info = context.getKey<DownloadedFileInfo>(KEY_DOWNLOAD_INFO, id.toString()) ?: return null
val base = basePathToFile(context, info.basePath) val base = basePathToFile(context, info.basePath)
println("INFFOFOFOF $info ${base?.filePath} ")
if (isScopedStorage && base.isDownloadDir()) { if (isScopedStorage && base.isDownloadDir()) {
val cr = context.contentResolver ?: return null val cr = context.contentResolver ?: return null
val fileUri = val fileUri =
@ -1373,7 +1375,11 @@ object VideoDownloadManager {
if (fileLength == 0L) return null if (fileLength == 0L) return null
return DownloadedFileInfoResult(fileLength, info.totalBytes, fileUri) return DownloadedFileInfoResult(fileLength, info.totalBytes, fileUri)
} else { } else {
val file = base?.gotoDir(info.relativePath, false)?.findFile(info.displayName) val file = base?.gotoDir(info.relativePath, false)?.findFile(info.displayName)
println("ffffffile ${file?.filePath} ${file?.uri} $file ")
// val normalPath = context.getNormalPath(getFile(info.relativePath), info.displayName) // val normalPath = context.getNormalPath(getFile(info.relativePath), info.displayName)
// val dFile = File(normalPath) // val dFile = File(normalPath)
@ -1409,7 +1415,7 @@ object VideoDownloadManager {
downloadStatusEvent.invoke(Pair(id, DownloadType.IsStopped)) downloadStatusEvent.invoke(Pair(id, DownloadType.IsStopped))
downloadDeleteEvent.invoke(id) downloadDeleteEvent.invoke(id)
val base = basePathToFile(context, info.basePath) val base = basePathToFile(context, info.basePath)
println("DOWNLOAD DIRRRR ----- ${base?.filePath} -------- ${info.relativePath} --------- ${info.displayName} -------- ${info.basePath} $")
if (isScopedStorage && base.isDownloadDir()) { if (isScopedStorage && base.isDownloadDir()) {
val cr = context.contentResolver ?: return false val cr = context.contentResolver ?: return false
val fileUri = val fileUri =