Skip to content

Commit 562a5d8

Browse files
authored
Fix CustomSubripParser to match assertion usage upstream (#2612)
Also suppresses a deprecation to fix build warnings. Fixes all other warnings in assertions by changing them because that is what it uses upstream also.
1 parent ba9413e commit 562a5d8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

app/src/main/java/com/lagradost/cloudstream3/ui/player/CustomSubripParser.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ import androidx.media3.common.Format
2929
import androidx.media3.common.Format.CueReplacementBehavior
3030
import androidx.media3.common.text.Cue
3131
import androidx.media3.common.text.Cue.AnchorType
32-
import androidx.media3.common.util.Assertions
3332
import androidx.media3.common.util.Consumer
3433
import androidx.media3.common.util.Log
3534
import androidx.media3.common.util.ParsableByteArray
3635
import androidx.media3.common.util.UnstableApi
3736
import androidx.media3.extractor.text.CuesWithTiming
3837
import androidx.media3.extractor.text.SubtitleParser
3938
import androidx.media3.extractor.text.SubtitleParser.OutputOptions
39+
import com.google.common.base.Preconditions.checkNotNull
4040
import com.google.common.collect.ImmutableList
4141
import java.nio.charset.Charset
4242
import java.nio.charset.StandardCharsets
@@ -115,6 +115,7 @@ class CustomSubripParser : SubtitleParser {
115115
currentLine = parsableByteArray.readLine(charset)
116116
}
117117

118+
@Suppress("DEPRECATION")
118119
val text = Html.fromHtml(textBuilder.toString())
119120

120121
var alignmentTag: String? = null
@@ -259,10 +260,9 @@ class CustomSubripParser : SubtitleParser {
259260
private fun parseTimecode(matcher: Matcher, groupOffset: Int): Long {
260261
val hours = matcher.group(groupOffset + 1)
261262
var timestampMs = if (hours != null) hours.toLong() * 60 * 60 * 1000 else 0
262-
timestampMs +=
263-
Assertions.checkNotNull<String?>(matcher.group(groupOffset + 2))
264-
.toLong() * 60 * 1000
265-
timestampMs += Assertions.checkNotNull<String?>(matcher.group(groupOffset + 3))
263+
timestampMs += checkNotNull(matcher.group(groupOffset + 2))
264+
.toLong() * 60 * 1000
265+
timestampMs += checkNotNull(matcher.group(groupOffset + 3))
266266
.toLong() * 1000
267267
val millis = matcher.group(groupOffset + 4)
268268

0 commit comments

Comments
 (0)