feat(stations): локальные обложки Comedy FM/Spa/StandUp/Женский StandUp
вшиты в ресурсы (res/drawable), привязаны по имени станции (приоритет над логотипом по домену). Загрузка через android.resource:// в Coil.
This commit is contained in:
@@ -37,7 +37,7 @@ class LocalStationDataSource @Inject constructor(
|
|||||||
name = dto.name,
|
name = dto.name,
|
||||||
prefix = prefix,
|
prefix = prefix,
|
||||||
streamUrl = dto.stream!!,
|
streamUrl = dto.stream!!,
|
||||||
coverUrl = StationLogos.forSite(dto.site) ?: "",
|
coverUrl = StationLogos.forName(dto.name) ?: StationLogos.forSite(dto.site) ?: "",
|
||||||
genre = group?.name ?: "",
|
genre = group?.name ?: "",
|
||||||
tags = listOfNotNull(group?.name?.takeIf { it.isNotBlank() }),
|
tags = listOfNotNull(group?.name?.takeIf { it.isNotBlank() }),
|
||||||
sortOrder = dto.id,
|
sortOrder = dto.id,
|
||||||
|
|||||||
@@ -7,11 +7,25 @@ package com.radiola.data.local
|
|||||||
*/
|
*/
|
||||||
object StationLogos {
|
object StationLogos {
|
||||||
|
|
||||||
|
// Локальные обложки в ресурсах (res/drawable) — ключ: имя станции в нижнем регистре.
|
||||||
|
private fun res(name: String) = "android.resource://com.radiola/drawable/$name"
|
||||||
|
|
||||||
|
private val byName: Map<String, String> = mapOf(
|
||||||
|
"comedy fm" to res("cover_comedy_fm"),
|
||||||
|
"comedy spa" to res("cover_comedy_spa"),
|
||||||
|
"standup" to res("cover_standup"),
|
||||||
|
"женский standup" to res("cover_standup_women"),
|
||||||
|
)
|
||||||
|
|
||||||
private val byDomain: Map<String, String> = mapOf(
|
private val byDomain: Map<String, String> = mapOf(
|
||||||
// Comedy Radio (Comedy FM / Comedy Club / Comedy Spa) — платформа 101.ru
|
// Comedy Radio (Comedy Club и пр.) — платформа 101.ru
|
||||||
"comedy-radio.ru" to "https://comedy-radio.ru/design/images/logo/apple-touch-icon-180.png?v=2",
|
"comedy-radio.ru" to "https://comedy-radio.ru/design/images/logo/apple-touch-icon-180.png?v=2",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/** Обложка по точному имени станции, либо null. */
|
||||||
|
fun forName(name: String?): String? =
|
||||||
|
name?.trim()?.lowercase()?.let { byName[it] }
|
||||||
|
|
||||||
/** Логотип станции по её сайту, либо null. */
|
/** Логотип станции по её сайту, либо null. */
|
||||||
fun forSite(site: String?): String? {
|
fun forSite(site: String?): String? {
|
||||||
val host = site
|
val host = site
|
||||||
|
|||||||
BIN
app/src/main/res/drawable/cover_comedy_fm.jpg
Normal file
BIN
app/src/main/res/drawable/cover_comedy_fm.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 91 KiB |
BIN
app/src/main/res/drawable/cover_comedy_spa.jpg
Normal file
BIN
app/src/main/res/drawable/cover_comedy_spa.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
BIN
app/src/main/res/drawable/cover_standup.jpg
Normal file
BIN
app/src/main/res/drawable/cover_standup.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
BIN
app/src/main/res/drawable/cover_standup_women.jpg
Normal file
BIN
app/src/main/res/drawable/cover_standup_women.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
Reference in New Issue
Block a user