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 episodes = ArrayList(episodeNodes.map {
|
||||||
|
val title = it.selectFirst(".episode-title")?.text()?.trim()
|
||||||
AnimeEpisode(
|
AnimeEpisode(
|
||||||
it.attr("href"),
|
it.attr("href"),
|
||||||
it.selectFirst(".episode-title")?.text()?.trim(),
|
if(title == "No Title") null else title,
|
||||||
it.selectFirst("img")?.attr("src"),
|
it.selectFirst("img")?.attr("src"),
|
||||||
dateParser(it?.selectFirst(".episode-date")?.text()?.trim()),
|
dateParser(it?.selectFirst(".episode-date")?.text()?.trim()),
|
||||||
null,
|
null,
|
||||||
|
@ -342,7 +343,7 @@ class TenshiProvider : MainAPI() {
|
||||||
headers = getHeaders(
|
headers = getHeaders(
|
||||||
mapOf(),
|
mapOf(),
|
||||||
null,
|
null,
|
||||||
ddosGuardKiller?.savedCookiesMap?.get(URI(this.mainUrl).host) ?: mapOf()
|
ddosGuardKiller.savedCookiesMap.get(URI(this.mainUrl).host) ?: mapOf()
|
||||||
).toMap()
|
).toMap()
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -44,7 +44,6 @@ class DownloadFileWorkManager(val context: Context, private val workerParams: Wo
|
||||||
::handleNotification
|
::handleNotification
|
||||||
)
|
)
|
||||||
awaitDownload(info.ep.id)
|
awaitDownload(info.ep.id)
|
||||||
|
|
||||||
} else if (pkg != null) {
|
} else if (pkg != null) {
|
||||||
downloadFromResume(applicationContext, pkg, ::handleNotification)
|
downloadFromResume(applicationContext, pkg, ::handleNotification)
|
||||||
awaitDownload(pkg.item.ep.id)
|
awaitDownload(pkg.item.ep.id)
|
||||||
|
@ -68,9 +67,9 @@ class DownloadFileWorkManager(val context: Context, private val workerParams: Wo
|
||||||
|
|
||||||
private suspend fun awaitDownload(id: Int) {
|
private suspend fun awaitDownload(id: Int) {
|
||||||
var isDone = false
|
var isDone = false
|
||||||
val listener = { data: Pair<Int, VideoDownloadManager.DownloadType> ->
|
val listener = { (localId, localType): Pair<Int, VideoDownloadManager.DownloadType> ->
|
||||||
if (id == data.first) {
|
if (id == localId) {
|
||||||
when (data.second) {
|
when (localType) {
|
||||||
VideoDownloadManager.DownloadType.IsDone, VideoDownloadManager.DownloadType.IsFailed, VideoDownloadManager.DownloadType.IsStopped -> {
|
VideoDownloadManager.DownloadType.IsDone, VideoDownloadManager.DownloadType.IsFailed, VideoDownloadManager.DownloadType.IsStopped -> {
|
||||||
isDone = true
|
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.DataStore.removeKey
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
|
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import okhttp3.internal.closeQuietly
|
import okhttp3.internal.closeQuietly
|
||||||
|
@ -1346,7 +1345,18 @@ object VideoDownloadManager {
|
||||||
tryResume: Boolean = false,
|
tryResume: Boolean = false,
|
||||||
): Int {
|
): Int {
|
||||||
val name =
|
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.
|
// Make sure this is cancelled when download is done or cancelled.
|
||||||
val extractorJob = ioSafe {
|
val extractorJob = ioSafe {
|
||||||
|
|
Loading…
Reference in a new issue