feat(domain): add Station, Track, PlayerState, DeeplinkService models

This commit is contained in:
nk
2026-06-01 12:05:13 +03:00
parent 7b1aa0c073
commit d345cd40b8
4 changed files with 49 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
package com.radiola.domain.model
enum class DeeplinkService(
val serviceId: String,
val displayName: String,
val searchUrlTemplate: String
) {
YANDEX("yandex", "Яндекс Музыка", "https://music.yandex.ru/search?text=%s"),
VK("vk", "ВК Музыка", "https://vk.com/audio?q=%s"),
BOOM("boom", "BOOM", "https://boom.ru/search?query=%s"),
SPOTIFY("spotify", "Spotify", "https://open.spotify.com/search/%s"),
APPLE_MUSIC("apple", "Apple Music", "https://music.apple.com/search?term=%s"),
YOUTUBE_MUSIC("youtube", "YouTube Music", "https://music.youtube.com/search?q=%s"),
TIDAL("tidal", "Tidal", "https://listen.tidal.com/search?q=%s"),
DEEZER("deezer", "Deezer", "https://www.deezer.com/search/%s");
fun buildSearchUrl(artist: String, song: String): String {
val query = java.net.URLEncoder.encode("$artist $song", "UTF-8")
return searchUrlTemplate.format(query)
}
}

View File

@@ -0,0 +1,8 @@
package com.radiola.domain.model
sealed class PlayerState {
data object Idle : PlayerState()
data class Playing(val station: Station, val track: Track?) : PlayerState()
data class Buffering(val station: Station) : PlayerState()
data class Error(val message: String) : PlayerState()
}

View File

@@ -0,0 +1,12 @@
package com.radiola.domain.model
data class Station(
val id: Int,
val name: String,
val prefix: String,
val streamUrl: String,
val coverUrl: String,
val genre: String,
val tags: List<String>,
val sortOrder: Int
)

View File

@@ -0,0 +1,8 @@
package com.radiola.domain.model
data class Track(
val artist: String,
val song: String,
val coverUrl: String?,
val stationName: String
)