EARHORNMUSIC UPnP · Android TV · Phones · Android Auto · GNU/Linux
Release 0.5.0

Destinations.kt

Each line, with the release that last changed it.

0.5.01package dev.stave.ui.nav
2
3import android.net.Uri
4
5object Destinations {
6 const val SERVERS = "servers"
7 const val WELCOME = "welcome"
8 const val BROWSE = "browse/{udn}/{containerId}"
9 const val DETAIL = "detail/{udn}/{containerId}"
10 const val NOW_PLAYING = "now_playing"
11 const val QUEUE = "queue"
12 const val MORE = "more/{udn}/{mode}/{query}?highlight={highlight}"
13 const val SEARCH = "search"
14 const val RANDOM_PICKER = "random_picker"
15 const val ABOUT = "about"
16 const val GUIDE = "guide"
17 const val METADATA = "metadata"
18 const val LYRICS = "lyrics"
19 const val PLAYLISTS = "playlists"
20 const val PLAYLIST_SAVE = "playlist_save"
21 const val SETTINGS = "settings"
22 const val PLAYBACK_SETTINGS = "playback_settings"
23
24 /** Local music (on-device files) routes. Sit alongside UPnP rather than
25 * pretending to BE a UPnP server — a separate code path keeps both
26 * simpler. */
27 const val LOCAL_HUB = "local_hub"
28 const val LOCAL_ALBUMS = "local_albums"
29 const val LOCAL_ARTISTS = "local_artists"
30 const val LOCAL_SONGS = "local_songs"
31 const val LOCAL_GENRES = "local_genres"
32 /** Tracks matching a specific genre. */
33 const val LOCAL_GENRE_DETAIL = "local_genre/{genreName}"
34 /** Tracks within a single local album. */
35 const val LOCAL_ALBUM = "local_album/{albumId}"
36 /** Albums by a single local artist. */
37 const val LOCAL_ARTIST = "local_artist/{artistId}/{artistName}"
38
39 fun localAlbum(albumId: Long) = "local_album/$albumId"
40 fun localArtist(artistId: Long, artistName: String) =
41 "local_artist/$artistId/${Uri.encode(artistName)}"
42 fun localGenre(genreName: String) = "local_genre/${Uri.encode(genreName)}"
43
44 fun browse(udn: String, containerId: String) =
45 "browse/${Uri.encode(udn)}/${Uri.encode(containerId)}"
46
47 fun detail(udn: String, containerId: String) =
48 "detail/${Uri.encode(udn)}/${Uri.encode(containerId)}"
49
50 /** Build a "more" destination URL.
51 *
52 * [highlightContainerId] is optional. When provided, MoreScreen will
53 * scroll to and focus the row whose container ID matches, instead of
54 * defaulting to row 0. Used by NowPlayingScreen's "Albums by …" picker
55 * so the user lands on the album they're currently listening to,
56 * surrounded by the artist's other work, rather than on the alphabetical-
57 * first album in the list. */
58 fun more(udn: String, mode: String, query: String, highlightContainerId: String? = null): String {
59 val base = "more/${Uri.encode(udn)}/${Uri.encode(mode)}/${Uri.encode(query)}"
60 return if (highlightContainerId.isNullOrEmpty()) base
61 else "$base?highlight=${Uri.encode(highlightContainerId)}"
62 }
63
64 /** METADATA is parameterless — the track reference is stashed in MetadataHandoff.
65 * We include a separate fn for symmetry with the other routes. */
66 fun metadata(@Suppress("UNUSED_PARAMETER") trackId: String): String = METADATA
67}