diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/Util.kt b/touch/src/main/java/de/nicidienase/chaosflix/touch/Util.kt new file mode 100644 index 00000000..3b022e04 --- /dev/null +++ b/touch/src/main/java/de/nicidienase/chaosflix/touch/Util.kt @@ -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 { + val result = ArrayList() + + 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 = Arrays.asList( + "congress", "sendezentrum", "camp", + "gpn", "mrmcd", "broadcast/chaosradio", + "eh", "froscon", "sigint", + "datenspuren", "fiffkon", "cryptocon") +} \ No newline at end of file