diff --git a/components/music/MusicAlbumDetails.brs b/components/music/MusicAlbumDetails.brs
index 33c53d63..1c39b7e0 100644
--- a/components/music/MusicAlbumDetails.brs
+++ b/components/music/MusicAlbumDetails.brs
@@ -3,6 +3,7 @@ sub init()
setupMainNode()
m.playAlbum = m.top.findNode("playAlbum")
+ m.instantMix = m.top.findNode("instantMix")
m.albumCover = m.top.findNode("albumCover")
m.songList = m.top.findNode("songList")
m.infoGroup = m.top.FindNode("infoGroup")
@@ -99,11 +100,6 @@ function onKeyEvent(key as string, press as boolean) as boolean
if m.spinner.visible then return false
- ' Play Album is hidden, so there are no navigation needs here
- if m.top.pageContent.json.ChildCount = 1
- return false
- end if
-
if key = "options"
if m.dscr.isTextEllipsized
createFullDscrDlg()
@@ -112,10 +108,24 @@ function onKeyEvent(key as string, press as boolean) as boolean
return false
end if
- if key = "right" and m.playAlbum.hasFocus()
- m.songList.setFocus(true)
- return true
+ if key = "right"
+ if m.playAlbum.hasFocus() or m.instantMix.hasFocus()
+ m.songList.setFocus(true)
+ return true
+ end if
else if key = "left" and m.songList.hasFocus()
+ if m.playAlbum.visible
+ m.playAlbum.setFocus(true)
+ else if m.instantMix.visible
+ m.instantMix.setFocus(true)
+ else
+ return false
+ end if
+ return true
+ else if key = "down" and m.playAlbum.hasFocus()
+ m.instantMix.setFocus(true)
+ return true
+ else if key = "up" and m.instantMix.hasFocus()
m.playAlbum.setFocus(true)
return true
end if
diff --git a/components/music/MusicAlbumDetails.xml b/components/music/MusicAlbumDetails.xml
index 5703dee9..d2ad590a 100644
--- a/components/music/MusicAlbumDetails.xml
+++ b/components/music/MusicAlbumDetails.xml
@@ -10,6 +10,7 @@
+
@@ -26,6 +27,7 @@
+
diff --git a/source/Main.brs b/source/Main.brs
index 377ed1cc..4edc58a6 100644
--- a/source/Main.brs
+++ b/source/Main.brs
@@ -201,6 +201,13 @@ sub Main (args as dynamic) as void
m.spinner = screenContent.findNode("spinner")
m.spinner.visible = true
group = CreateAudioPlayerGroup(screenContent.albumData.items)
+ else if isNodeEvent(msg, "instantMixSelected")
+ ' User has selected instant mix
+ ' User has selected playlist of of audio they want us to play
+ screenContent = msg.getRoSGNode()
+ m.spinner = screenContent.findNode("spinner")
+ m.spinner.visible = true
+ group = CreateInstantMixGroup(screenContent.albumData.items)
else if isNodeEvent(msg, "episodeSelected")
' If you select a TV Episode from ANYWHERE, follow this flow
node = getMsgPicker(msg, "picker")
diff --git a/source/ShowScenes.brs b/source/ShowScenes.brs
index 9f715552..8ef79a07 100644
--- a/source/ShowScenes.brs
+++ b/source/ShowScenes.brs
@@ -380,6 +380,7 @@ function CreateMusicArtistDetailsGroup(musicartist)
group.albumData = MusicSongList(musicartist.id)
group.observeField("playSong", m.port)
group.observeField("playAllSelected", m.port)
+ group.observeField("instantMixSelected", m.port)
else
' User has albums under artists
group = CreateObject("roSGNode", "MusicArtistDetails")
@@ -407,6 +408,9 @@ function CreateMusicAlbumDetailsGroup(album)
' Watch for user click on Play button on album
group.observeField("playAllSelected", m.port)
+ ' Watch for user click on Instant Mix button on album
+ group.observeField("instantMixSelected", m.port)
+
return group
end function
@@ -481,6 +485,30 @@ function CreateAudioPlayerGroup(audiodata)
return group
end function
+' Play Instant Mix
+function CreateInstantMixGroup(audiodata)
+
+ songList = CreateInstantMix(audiodata[0].id)
+
+ group = CreateObject("roSGNode", "NowPlaying")
+ group.observeField("state", m.port)
+ songIDArray = CreateObject("roArray", 0, true)
+
+ ' All we need is an array of Song IDs the user selected to play.
+ for each song in songList.items
+ songIDArray.push(song.id)
+ end for
+
+ songIDArray.shift()
+
+ group.pageContent = songIDArray
+ group.musicArtistAlbumData = songList.items
+
+ m.global.sceneManager.callFunc("pushScene", group)
+
+ return group
+end function
+
function CreatePersonView(personData as object) as object
person = CreateObject("roSGNode", "PersonDetails")
m.global.SceneManager.callFunc("pushScene", person)
diff --git a/source/api/Items.brs b/source/api/Items.brs
index 9359c335..2d0bd418 100644
--- a/source/api/Items.brs
+++ b/source/api/Items.brs
@@ -209,6 +209,17 @@ function AudioItem(id as string)
return getJson(resp)
end function
+' Get Instant Mix based on item
+function CreateInstantMix(id as string)
+ url = Substitute("/Items/{0}/InstantMix", id)
+ resp = APIRequest(url, {
+ "UserId": get_setting("active_user"),
+ "Limit": 201
+ })
+
+ return getJson(resp)
+end function
+
function AudioStream(id as string)
songData = AudioItem(id)