Updated
This commit is contained in:
parent
c78c48e6eb
commit
a502232e9c
@ -38,8 +38,11 @@ dependencies {
|
|||||||
implementation("org.springframework.kafka:spring-kafka:2.8.5")
|
implementation("org.springframework.kafka:spring-kafka:2.8.5")
|
||||||
|
|
||||||
|
|
||||||
testImplementation(platform("org.junit:junit-bom:5.9.1"))
|
testImplementation("junit:junit:4.13.2")
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||||
|
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
|
||||||
|
testImplementation("org.junit.jupiter:junit-jupiter-params:5.8.1")
|
||||||
|
testImplementation("org.assertj:assertj-core:3.4.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.test {
|
tasks.test {
|
||||||
|
|||||||
@ -7,7 +7,7 @@ class ProgressDecoder {
|
|||||||
val metadataMap = mutableMapOf<String, String>()
|
val metadataMap = mutableMapOf<String, String>()
|
||||||
|
|
||||||
for (line in lines) {
|
for (line in lines) {
|
||||||
val keyValuePairs = line.split(" ")
|
val keyValuePairs = Regex("=\\s*").replace(line, "=").split(" ").filter { it.isNotBlank() }
|
||||||
for (keyValuePair in keyValuePairs) {
|
for (keyValuePair in keyValuePairs) {
|
||||||
val (key, value) = keyValuePair.split("=")
|
val (key, value) = keyValuePair.split("=")
|
||||||
metadataMap[key] = value
|
metadataMap[key] = value
|
||||||
|
|||||||
@ -1,10 +1,28 @@
|
|||||||
package no.iktdev.streamit.content.encode.progress
|
package no.iktdev.streamit.content.encode.progress
|
||||||
|
|
||||||
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
import org.junit.jupiter.api.assertDoesNotThrow
|
||||||
|
|
||||||
class ProgressDecoderTest {
|
class ProgressDecoderTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun test() {
|
||||||
|
val progress = ProgressDecoder()
|
||||||
|
val lines = text.split("\n")
|
||||||
|
val cache: MutableList<String> = mutableListOf()
|
||||||
|
lines.forEach {
|
||||||
|
cache.add(it)
|
||||||
|
assertDoesNotThrow {
|
||||||
|
val progressItem = progress.parseVideoProgress(cache)
|
||||||
|
progressItem?.progress
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertThat(lines).isNotEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
val text = """
|
val text = """
|
||||||
frame=16811 fps= 88 q=40.0 size= 9984kB time=00:01:10.79 bitrate=1155.3kbits/s speed=3.71x
|
frame=16811 fps= 88 q=40.0 size= 9984kB time=00:x01:10.79 bitrate=1155.3kbits/s speed=3.71x
|
||||||
fps=88.03
|
fps=88.03
|
||||||
stream_0_0_q=40.0
|
stream_0_0_q=40.0
|
||||||
bitrate=1155.3kbits/s
|
bitrate=1155.3kbits/s
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user