Display songs when album selected
This commit is contained in:
parent
8f516926ef
commit
6d61084823
|
@ -15,7 +15,7 @@
|
|||
<interface>
|
||||
<field id="itemContent" type="node" onChange="itemContentChanged" />
|
||||
<field id="musicArtistAlbumData" type="assocarray" alias="seasons.MusicArtistAlbumData" />
|
||||
<field id="seasonSelected" alias="seasons.rowItemSelected" />
|
||||
<field id="musicAlbumSelected" alias="seasons.rowItemSelected" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/misc.brs" />
|
||||
<script type="text/brightscript" uri="MusicArtistDetails.brs" />
|
||||
|
|
|
@ -175,6 +175,13 @@ sub Main (args as dynamic) as void
|
|||
series = msg.getRoSGNode()
|
||||
node = series.seasonData.items[ptr[1]]
|
||||
group = CreateSeasonDetailsGroup(series.itemContent, node)
|
||||
else if isNodeEvent(msg, "musicAlbumSelected")
|
||||
' If you select a Music Album from ANYWHERE, follow this flow
|
||||
ptr = msg.getData()
|
||||
' ptr is for [row, col] of selected item... but we only have 1 row
|
||||
albums = msg.getRoSGNode()
|
||||
node = albums.musicArtistAlbumData.items[ptr[1]]
|
||||
group = CreateMusicAlbumDetailsGroup(node)
|
||||
else if isNodeEvent(msg, "episodeSelected")
|
||||
' If you select a TV Episode from ANYWHERE, follow this flow
|
||||
node = getMsgPicker(msg, "picker")
|
||||
|
|
|
@ -328,7 +328,22 @@ function CreateMusicArtistDetailsGroup(musicartist)
|
|||
group.itemContent = ItemMetaData(musicartist.id)
|
||||
group.musicArtistAlbumData = MusicAlbums(musicartist.id)
|
||||
|
||||
group.observeField("seasonSelected", m.port)
|
||||
group.observeField("musicAlbumSelected", m.port)
|
||||
|
||||
extras = group.findNode("extrasGrid")
|
||||
extras.observeField("selectedItem", m.port)
|
||||
|
||||
return group
|
||||
end function
|
||||
|
||||
function CreateMusicAlbumDetailsGroup(album)
|
||||
group = CreateObject("roSGNode", "MusicArtistDetails")
|
||||
m.global.sceneManager.callFunc("pushScene", group)
|
||||
|
||||
group.itemContent = ItemMetaData(album.id)
|
||||
group.musicArtistAlbumData = MusicSongs(album.id)
|
||||
|
||||
group.observeField("musicAlbumSelected", m.port)
|
||||
|
||||
extras = group.findNode("extrasGrid")
|
||||
extras.observeField("selectedItem", m.port)
|
||||
|
|
|
@ -136,7 +136,30 @@ function MusicAlbums(id as string)
|
|||
resp = APIRequest(url, {
|
||||
"UserId": get_setting("active_user"),
|
||||
"parentId": id,
|
||||
"includeitemtypes": "MusicAlbum"
|
||||
"includeitemtypes": "MusicAlbum",
|
||||
"sortBy": "SortName"
|
||||
})
|
||||
|
||||
data = getJson(resp)
|
||||
results = []
|
||||
for each item in data.Items
|
||||
tmp = CreateObject("roSGNode", "TVEpisodeData")
|
||||
tmp.image = PosterImage(item.id)
|
||||
tmp.json = item
|
||||
results.push(tmp)
|
||||
end for
|
||||
data.Items = results
|
||||
return data
|
||||
end function
|
||||
|
||||
' Music Songs on a Specified Album
|
||||
function MusicSongs(id as string)
|
||||
url = Substitute("Users/{0}/Items", get_setting("active_user"), id)
|
||||
resp = APIRequest(url, {
|
||||
"UserId": get_setting("active_user"),
|
||||
"parentId": id,
|
||||
"includeitemtypes": "Audio"
|
||||
"sortBy": "SortName"
|
||||
})
|
||||
|
||||
data = getJson(resp)
|
||||
|
|
Loading…
Reference in New Issue
Block a user