Adjust album view
This commit is contained in:
parent
5f4fb2239f
commit
f257a3195a
|
@ -80,6 +80,20 @@ sub itemContentChanged()
|
|||
m.backdrop.height = 290
|
||||
m.backdrop.width = 290
|
||||
|
||||
m.posterText.height = 200
|
||||
m.posterText.width = 280
|
||||
else if itemData.json.type = "MusicAlbum"
|
||||
m.itemPoster.uri = itemData.PosterUrl
|
||||
m.itemText.text = itemData.Title
|
||||
|
||||
m.itemPoster.height = 290
|
||||
m.itemPoster.width = 290
|
||||
|
||||
m.itemText.translation = [0, m.itemPoster.height + 7]
|
||||
|
||||
m.backdrop.height = 290
|
||||
m.backdrop.width = 290
|
||||
|
||||
m.posterText.height = 200
|
||||
m.posterText.width = 280
|
||||
else
|
||||
|
|
|
@ -303,7 +303,6 @@ end sub
|
|||
' Set Music view, sort, and filter options
|
||||
sub setMusicOptions(options)
|
||||
options.views = [
|
||||
{ "Title": tr("Default"), "Name": "music-default" },
|
||||
{ "Title": tr("Artists"), "Name": "music-artist" },
|
||||
{ "Title": tr("Albums"), "Name": "music-album" },
|
||||
]
|
||||
|
@ -590,13 +589,7 @@ sub optionsClosed()
|
|||
|
||||
if m.top.parentItem.collectionType = "music"
|
||||
if m.options.view <> m.view
|
||||
if m.options.view = "music-artist"
|
||||
m.view = "music-artist"
|
||||
else if m.options.view = "music-album"
|
||||
m.view = "music-album"
|
||||
else
|
||||
m.view = "music-default"
|
||||
end if
|
||||
m.view = m.options.view
|
||||
set_user_setting("display.music.view", m.view)
|
||||
reload = true
|
||||
end if
|
||||
|
@ -787,6 +780,12 @@ sub updateTitle()
|
|||
m.top.overhangTitle = m.top.parentItem.title + tr(" (Filtered by ") + m.loadItemsTask.nameStartsWith + ")"
|
||||
end if
|
||||
|
||||
if m.view = "music-artist"
|
||||
m.top.overhangTitle = "%s (%s)".Format(m.top.parentItem.title, tr("Artists"))
|
||||
else if m.view = "music-album"
|
||||
m.top.overhangTitle = "%s (%s)".Format(m.top.parentItem.title, tr("Albums"))
|
||||
end if
|
||||
|
||||
if m.options.view = "Networks" or m.view = "Networks"
|
||||
m.top.overhangTitle = "%s (%s)".Format(m.top.parentItem.title, tr("Networks"))
|
||||
end if
|
||||
|
|
|
@ -83,6 +83,10 @@ sub loadItems()
|
|||
UserId: get_setting("active_user")
|
||||
})
|
||||
params.IncludeItemTypes = ""
|
||||
else if m.top.ItemType = "MusicAlbum"
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
params.append({ ImageTypeLimit: 1 })
|
||||
params.append({ EnableImageTypes: "Primary,Backdrop,Banner,Thumb" })
|
||||
else
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
end if
|
||||
|
@ -118,6 +122,12 @@ sub loadItems()
|
|||
tmp = CreateObject("roSGNode", "FolderData")
|
||||
else if item.Type = "MusicAlbum"
|
||||
tmp = CreateObject("roSGNode", "MusicAlbumData")
|
||||
tmp.type = "MusicAlbum"
|
||||
if api_API().items.headimageurlbyname(item.id, "primary")
|
||||
tmp.posterURL = ImageURL(item.id, "Primary")
|
||||
else
|
||||
tmp.posterURL = ImageURL(item.id, "backdrop")
|
||||
end if
|
||||
else if item.Type = "MusicArtist"
|
||||
tmp = CreateObject("roSGNode", "MusicArtistData")
|
||||
else if item.Type = "Audio"
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
</interface>
|
||||
<script type="text/brightscript" uri="LoadItemsTask2.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/api/Items.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/roku_modules/api/api.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/api/baserequest.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/api/Image.brs" />
|
||||
|
|
|
@ -812,5 +812,10 @@
|
|||
<translation>WxH</translation>
|
||||
<extracomment>Video width x height</extracomment>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to find any albums or songs belonging to this artist</source>
|
||||
<translation>Unable to find any albums or songs belonging to this artist</translation>
|
||||
<extracomment>Popup message when we find no audio data for an artist</extracomment>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
|
@ -159,6 +159,9 @@ sub Main (args as dynamic) as void
|
|||
' Nothing to do here, handled in ItemGrid
|
||||
else if selectedItem.type = "MusicArtist"
|
||||
group = CreateArtistView(selectedItem.json)
|
||||
if not isValid(group)
|
||||
message_dialog(tr("Unable to find any albums or songs belonging to this artist"))
|
||||
end if
|
||||
else if selectedItem.type = "MusicAlbum"
|
||||
group = CreateAlbumView(selectedItem.json)
|
||||
else if selectedItem.type = "Audio"
|
||||
|
|
|
@ -383,7 +383,20 @@ function CreateArtistView(musicartist)
|
|||
' Just songs under artists...
|
||||
group = CreateObject("roSGNode", "AlbumView")
|
||||
group.pageContent = ItemMetaData(musicartist.id)
|
||||
group.albumData = MusicSongList(musicartist.id)
|
||||
|
||||
' Lookup songs based on artist id
|
||||
songList = GetSongsByArtist(musicartist.id)
|
||||
|
||||
if not isValid(songList)
|
||||
' Lookup songs based on folder parent / child relationship
|
||||
songList = MusicSongList(musicartist.id)
|
||||
end if
|
||||
|
||||
if not isValid(songList)
|
||||
return invalid
|
||||
end if
|
||||
|
||||
group.albumData = songList
|
||||
group.observeField("playSong", m.port)
|
||||
group.observeField("playAllSelected", m.port)
|
||||
group.observeField("instantMixSelected", m.port)
|
||||
|
|
|
@ -219,6 +219,33 @@ function AppearsOnList(id as string)
|
|||
return data
|
||||
end function
|
||||
|
||||
' Get list of songs belonging to an artist
|
||||
function GetSongsByArtist(id as string)
|
||||
url = Substitute("Users/{0}/Items", get_setting("active_user"))
|
||||
resp = APIRequest(url, {
|
||||
"AlbumArtistIds": id,
|
||||
"includeitemtypes": "Audio",
|
||||
"sortBy": "SortName",
|
||||
"Recursive": true
|
||||
})
|
||||
|
||||
data = getJson(resp)
|
||||
results = []
|
||||
|
||||
if data = invalid then return invalid
|
||||
if data.Items = invalid then return invalid
|
||||
if data.Items.Count() = 0 then return invalid
|
||||
|
||||
for each item in data.Items
|
||||
tmp = CreateObject("roSGNode", "MusicAlbumData")
|
||||
tmp.image = PosterImage(item.id)
|
||||
tmp.json = item
|
||||
results.push(tmp)
|
||||
end for
|
||||
data.Items = results
|
||||
return data
|
||||
end function
|
||||
|
||||
' Get Songs that are on an Album
|
||||
function MusicSongList(id as string)
|
||||
url = Substitute("Users/{0}/Items", get_setting("active_user"), id)
|
||||
|
@ -229,8 +256,13 @@ function MusicSongList(id as string)
|
|||
"sortBy": "SortName"
|
||||
})
|
||||
|
||||
data = getJson(resp)
|
||||
results = []
|
||||
data = getJson(resp)
|
||||
|
||||
if data = invalid then return invalid
|
||||
if data.Items = invalid then return invalid
|
||||
if data.Items.Count() = 0 then return invalid
|
||||
|
||||
for each item in data.Items
|
||||
tmp = CreateObject("roSGNode", "MusicSongData")
|
||||
tmp.image = PosterImage(item.id)
|
||||
|
|
Loading…
Reference in New Issue
Block a user