From 7dd62737e64714b2b8876051e83cd2c542b054b1 Mon Sep 17 00:00:00 2001 From: LagradOst Date: Sat, 4 Sep 2021 15:24:37 +0200 Subject: [PATCH] resume fix? + bump --- app/build.gradle | 4 ++-- .../java/com/lagradost/cloudstream3/utils/M3u8Helper.kt | 6 +++--- .../lagradost/cloudstream3/utils/VideoDownloadManager.kt | 3 ++- app/src/main/res/values-sv/strings.xml | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 67c7b7f0..44091bcd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,8 +31,8 @@ android { applicationId "com.lagradost.cloudstream3" minSdkVersion 21 targetSdkVersion 30 - versionCode 18 - versionName "1.5.2" + versionCode 19 + versionName "1.7.5" resValue "string", "app_version", "${defaultConfig.versionName}${versionNameSuffix ?: ""}" diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/M3u8Helper.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/M3u8Helper.kt index cc97fa07..36b22cd3 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/M3u8Helper.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/M3u8Helper.kt @@ -62,7 +62,7 @@ class M3u8Helper { if (it.quality != null && it.quality <= 1080) it.quality else 0 }.reversed().filter { it.streamUrl.contains(".m3u8") - // listOf("m3u", "m3u8").contains(absoluteExtensionDetermination(it.streamUrl)) + // listOf("m3u", "m3u8").contains(absoluteExtensionDetermination(it.streamUrl)) } return result.getOrNull(0) } @@ -118,7 +118,7 @@ class M3u8Helper { ) fun hlsYield(qualities: List, startIndex: Int = 0): Iterator { - if (qualities.isEmpty()) return listOf(HlsDownloadData(byteArrayOf(), 0, 0, true)).iterator() + if (qualities.isEmpty()) return listOf(HlsDownloadData(byteArrayOf(), 0, 0, true)).iterator() var selected = selectBest(qualities) if (selected == null) { @@ -156,7 +156,7 @@ class M3u8Helper { val allTs = TS_EXTENSION_REGEX.findAll(m3u8Data) val allTsList = allTs.toList() - val totalTs =allTsList .size + val totalTs = allTsList.size if (totalTs == 0) { return listOf(HlsDownloadData(byteArrayOf(), 0, 0, true)).iterator() } diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt index b350ba78..1c54d1c0 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt @@ -1076,6 +1076,7 @@ object VideoDownloadManager { if (stream.errorCode != SUCCESS_STREAM) return stream.errorCode if (!stream.resume!!) realIndex = 0 + val fileLengthAdd = stream.fileLength!! val tsIterator = m3u8Helper.hlsYield(listOf(m3u8), realIndex) val relativePath = getRelativePath(folder) @@ -1088,7 +1089,7 @@ object VideoDownloadManager { var isDone = false var isFailed = false var isPaused = false - var bytesDownloaded = firstTs.bytes.size.toLong() + var bytesDownloaded = firstTs.bytes.size.toLong() + fileLengthAdd var tsProgress = 1L + realIndex val totalTs = firstTs.totalTs.toLong() diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index cffc56b6..f11b74be 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -143,7 +143,7 @@ Ta bort nerladdad fil Ta bort - Denna fil kommer att raderas permanent %s\nÄr du helt säker? + %s kommer att raderas permanent\nÄr du helt säker? Pågående Färdig