package win.taptap.musicmanager.source /** * The two supported download sources. `externalId` is namespaced by the source: * a YouTube video id or a Deezer track id. */ object MusicSource { const val YOUTUBE = "youtube" const val DEEZER = "deezer" val ALL = setOf(YOUTUBE, DEEZER) /** Returns the normalized source, or null when it is not supported. */ fun normalizeOrNull(value: String?): String? = value?.trim()?.lowercase()?.takeIf { it in ALL } fun isKnown(value: String?): Boolean = normalizeOrNull(value) != null }