mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	fixed #739
This commit is contained in:
		
							parent
							
								
									9232efd895
								
							
						
					
					
						commit
						5d20feb2ad
					
				
					 3 changed files with 18 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -245,9 +245,10 @@ class TenshiProvider : MainAPI() {
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        val episodes = ArrayList(episodeNodes.map {
 | 
			
		||||
            val title = it.selectFirst(".episode-title")?.text()?.trim()
 | 
			
		||||
            AnimeEpisode(
 | 
			
		||||
                it.attr("href"),
 | 
			
		||||
                it.selectFirst(".episode-title")?.text()?.trim(),
 | 
			
		||||
                if(title == "No Title") null else title,
 | 
			
		||||
                it.selectFirst("img")?.attr("src"),
 | 
			
		||||
                dateParser(it?.selectFirst(".episode-date")?.text()?.trim()),
 | 
			
		||||
                null,
 | 
			
		||||
| 
						 | 
				
			
			@ -342,7 +343,7 @@ class TenshiProvider : MainAPI() {
 | 
			
		|||
                        headers = getHeaders(
 | 
			
		||||
                            mapOf(),
 | 
			
		||||
                            null,
 | 
			
		||||
                            ddosGuardKiller?.savedCookiesMap?.get(URI(this.mainUrl).host) ?: mapOf()
 | 
			
		||||
                            ddosGuardKiller.savedCookiesMap.get(URI(this.mainUrl).host) ?: mapOf()
 | 
			
		||||
                        ).toMap()
 | 
			
		||||
                    )
 | 
			
		||||
                })
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,7 +44,6 @@ class DownloadFileWorkManager(val context: Context, private val workerParams: Wo
 | 
			
		|||
                        ::handleNotification
 | 
			
		||||
                    )
 | 
			
		||||
                    awaitDownload(info.ep.id)
 | 
			
		||||
 | 
			
		||||
                } else if (pkg != null) {
 | 
			
		||||
                    downloadFromResume(applicationContext, pkg, ::handleNotification)
 | 
			
		||||
                    awaitDownload(pkg.item.ep.id)
 | 
			
		||||
| 
						 | 
				
			
			@ -68,9 +67,9 @@ class DownloadFileWorkManager(val context: Context, private val workerParams: Wo
 | 
			
		|||
 | 
			
		||||
    private suspend fun awaitDownload(id: Int) {
 | 
			
		||||
        var isDone = false
 | 
			
		||||
        val listener = { data: Pair<Int, VideoDownloadManager.DownloadType> ->
 | 
			
		||||
            if (id == data.first) {
 | 
			
		||||
                when (data.second) {
 | 
			
		||||
        val listener = { (localId, localType): Pair<Int, VideoDownloadManager.DownloadType> ->
 | 
			
		||||
            if (id == localId) {
 | 
			
		||||
                when (localType) {
 | 
			
		||||
                    VideoDownloadManager.DownloadType.IsDone, VideoDownloadManager.DownloadType.IsFailed, VideoDownloadManager.DownloadType.IsStopped -> {
 | 
			
		||||
                        isDone = true
 | 
			
		||||
                    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,7 +36,6 @@ import com.lagradost.cloudstream3.utils.DataStore.getKey
 | 
			
		|||
import com.lagradost.cloudstream3.utils.DataStore.removeKey
 | 
			
		||||
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
 | 
			
		||||
import kotlinx.coroutines.Dispatchers
 | 
			
		||||
import kotlinx.coroutines.Job
 | 
			
		||||
import kotlinx.coroutines.delay
 | 
			
		||||
import kotlinx.coroutines.withContext
 | 
			
		||||
import okhttp3.internal.closeQuietly
 | 
			
		||||
| 
						 | 
				
			
			@ -1346,7 +1345,18 @@ object VideoDownloadManager {
 | 
			
		|||
        tryResume: Boolean = false,
 | 
			
		||||
    ): Int {
 | 
			
		||||
        val name =
 | 
			
		||||
            sanitizeFilename(ep.name ?: "${context.getString(R.string.episode)} ${ep.episode}")
 | 
			
		||||
            // kinda ugly ik
 | 
			
		||||
            sanitizeFilename(
 | 
			
		||||
                if (ep.name == null) {
 | 
			
		||||
                    "${context.getString(R.string.episode)} ${ep.episode}"
 | 
			
		||||
                } else {
 | 
			
		||||
                    if (ep.episode != null) {
 | 
			
		||||
                        "${context.getString(R.string.episode)} ${ep.episode} - ${ep.name}"
 | 
			
		||||
                    } else {
 | 
			
		||||
                        ep.name
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
        // Make sure this is cancelled when download is done or cancelled.
 | 
			
		||||
        val extractorJob = ioSafe {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue