Display songs when album selected

This commit is contained in:
1hitsong 2022-05-13 23:46:05 -04:00
parent 8f516926ef
commit 6d61084823
4 changed files with 48 additions and 3 deletions

View File

@ -15,7 +15,7 @@
<interface> <interface>
<field id="itemContent" type="node" onChange="itemContentChanged" /> <field id="itemContent" type="node" onChange="itemContentChanged" />
<field id="musicArtistAlbumData" type="assocarray" alias="seasons.MusicArtistAlbumData" /> <field id="musicArtistAlbumData" type="assocarray" alias="seasons.MusicArtistAlbumData" />
<field id="seasonSelected" alias="seasons.rowItemSelected" /> <field id="musicAlbumSelected" alias="seasons.rowItemSelected" />
</interface> </interface>
<script type="text/brightscript" uri="pkg:/source/utils/misc.brs" /> <script type="text/brightscript" uri="pkg:/source/utils/misc.brs" />
<script type="text/brightscript" uri="MusicArtistDetails.brs" /> <script type="text/brightscript" uri="MusicArtistDetails.brs" />

View File

@ -175,6 +175,13 @@ sub Main (args as dynamic) as void
series = msg.getRoSGNode() series = msg.getRoSGNode()
node = series.seasonData.items[ptr[1]] node = series.seasonData.items[ptr[1]]
group = CreateSeasonDetailsGroup(series.itemContent, node) 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") else if isNodeEvent(msg, "episodeSelected")
' If you select a TV Episode from ANYWHERE, follow this flow ' If you select a TV Episode from ANYWHERE, follow this flow
node = getMsgPicker(msg, "picker") node = getMsgPicker(msg, "picker")

View File

@ -328,7 +328,22 @@ function CreateMusicArtistDetailsGroup(musicartist)
group.itemContent = ItemMetaData(musicartist.id) group.itemContent = ItemMetaData(musicartist.id)
group.musicArtistAlbumData = MusicAlbums(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 = group.findNode("extrasGrid")
extras.observeField("selectedItem", m.port) extras.observeField("selectedItem", m.port)

View File

@ -136,7 +136,30 @@ function MusicAlbums(id as string)
resp = APIRequest(url, { resp = APIRequest(url, {
"UserId": get_setting("active_user"), "UserId": get_setting("active_user"),
"parentId": id, "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) data = getJson(resp)