mirror of
https://github.com/NiciDieNase/chaosflix
synced 2024-11-23 12:53:08 +00:00
add new functions to utility-object
This commit is contained in:
parent
be74287daf
commit
56a4addc14
1 changed files with 51 additions and 0 deletions
51
touch/src/main/java/de/nicidienase/chaosflix/touch/Util.kt
Normal file
51
touch/src/main/java/de/nicidienase/chaosflix/touch/Util.kt
Normal file
|
@ -0,0 +1,51 @@
|
|||
package de.nicidienase.chaosflix.touch
|
||||
|
||||
import de.nicidienase.chaosflix.common.entities.recording.persistence.PersistentRecording
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
object Util {
|
||||
fun getOptimalStream(recordings: List<PersistentRecording>): PersistentRecording {
|
||||
val result = ArrayList<PersistentRecording>()
|
||||
|
||||
result.addAll(recordings.filter { it.isHighQuality && it.mimeType == "video/mp4" }.sortedBy { it.language.length })
|
||||
result.addAll(recordings.filter { it.mimeType == "video/mp4" }.sortedBy { it.language.length })
|
||||
result.addAll(recordings.filter { it.mimeType.startsWith("video/") }.sortedBy { it.language.length })
|
||||
|
||||
when {
|
||||
result.size > 0 -> return result[0]
|
||||
else -> return recordings.get(0)
|
||||
}
|
||||
}
|
||||
|
||||
fun getStringForTag(tag: String): String {
|
||||
when (tag) {
|
||||
"congress" -> return "Congress"
|
||||
"sendezentrum" -> return "Sendezentrum"
|
||||
"camp" -> return "Camp"
|
||||
"broadcast/chaosradio" -> return "Chaosradio"
|
||||
"eh" -> return "Easterhegg"
|
||||
"gpn" -> return "GPN"
|
||||
"froscon" -> return "FrOSCon"
|
||||
"mrmcd" -> return "MRMCD"
|
||||
"sigint" -> return "SIGINT"
|
||||
"datenspuren" -> return "Datenspuren"
|
||||
"fiffkon" -> return "FifFKon"
|
||||
"blinkenlights" -> return "Blinkenlights"
|
||||
"chaoscologne" -> return "1c2 Chaos Cologne"
|
||||
"cryptocon" -> return "CryptoCon"
|
||||
"other conferences" -> return "Other Conferences"
|
||||
"denog" -> return "DENOG"
|
||||
"vcfb" -> return "Vintage Computing Festival Berlin"
|
||||
"hackover" -> return "Hackover"
|
||||
"netzpolitik" -> return "Das ist Netzpolitik!"
|
||||
else -> return tag
|
||||
}
|
||||
}
|
||||
|
||||
val orderedConferencesList: List<String> = Arrays.asList(
|
||||
"congress", "sendezentrum", "camp",
|
||||
"gpn", "mrmcd", "broadcast/chaosradio",
|
||||
"eh", "froscon", "sigint",
|
||||
"datenspuren", "fiffkon", "cryptocon")
|
||||
}
|
Loading…
Reference in a new issue