feat(domain): add Station, Track, PlayerState, DeeplinkService models
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
12
app/src/main/java/com/radiola/domain/model/Station.kt
Normal file
12
app/src/main/java/com/radiola/domain/model/Station.kt
Normal 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
|
||||
)
|
||||
8
app/src/main/java/com/radiola/domain/model/Track.kt
Normal file
8
app/src/main/java/com/radiola/domain/model/Track.kt
Normal 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
|
||||
)
|
||||
Reference in New Issue
Block a user