2022-05-14 15:47:44 +00:00
|
|
|
sub init()
|
|
|
|
m.top.optionsAvailable = false
|
2022-05-21 20:45:01 +00:00
|
|
|
setupMainNode()
|
|
|
|
|
2022-05-15 19:10:21 +00:00
|
|
|
m.playAlbum = m.top.findNode("playAlbum")
|
|
|
|
m.songList = m.top.findNode("songList")
|
2022-05-14 15:47:44 +00:00
|
|
|
end sub
|
|
|
|
|
2022-05-21 20:45:01 +00:00
|
|
|
sub setupMainNode()
|
|
|
|
main = m.top.findNode("toplevel")
|
|
|
|
main.translation = [96, 175]
|
|
|
|
end sub
|
2022-05-14 15:47:44 +00:00
|
|
|
|
2022-05-21 20:45:01 +00:00
|
|
|
' Set values for displayed values on screen
|
|
|
|
sub pageContentChanged()
|
|
|
|
item = m.top.pageContent
|
2022-05-14 21:14:15 +00:00
|
|
|
|
2022-05-21 20:45:01 +00:00
|
|
|
setPosterImage(item.posterURL)
|
|
|
|
setScreenTitle(item.json)
|
|
|
|
setOnScreenTextValues(item.json)
|
|
|
|
end sub
|
2022-05-14 21:14:15 +00:00
|
|
|
|
2022-05-21 20:45:01 +00:00
|
|
|
' Set poster image on screen
|
|
|
|
sub setPosterImage(posterURL)
|
|
|
|
if isValid(posterURL)
|
|
|
|
m.top.findNode("albumCover").uri = posterURL
|
2022-05-14 15:47:44 +00:00
|
|
|
end if
|
|
|
|
end sub
|
|
|
|
|
2022-05-21 20:45:01 +00:00
|
|
|
' Set screen's title text
|
|
|
|
sub setScreenTitle(json)
|
|
|
|
if isValid(json)
|
|
|
|
m.top.overhangTitle = json.AlbumArtist + " / " + json.name
|
2022-05-14 15:47:44 +00:00
|
|
|
end if
|
|
|
|
end sub
|
|
|
|
|
2022-05-21 20:45:01 +00:00
|
|
|
' Populate on screen text variables
|
|
|
|
sub setOnScreenTextValues(json)
|
|
|
|
if isValid(json)
|
|
|
|
setFieldTextValue("overview", json.overview)
|
|
|
|
setFieldTextValue("numberofsongs", stri(json.ChildCount) + " Tracks")
|
2022-05-14 15:47:44 +00:00
|
|
|
|
2022-05-21 20:45:01 +00:00
|
|
|
if type(json.ProductionYear) = "roInt"
|
|
|
|
setFieldTextValue("released", "Released " + stri(json.ProductionYear))
|
|
|
|
end if
|
|
|
|
|
|
|
|
if json.genres.count() > 0
|
|
|
|
setFieldTextValue("genres", json.genres.join(", "))
|
|
|
|
end if
|
2022-05-14 15:47:44 +00:00
|
|
|
|
2022-05-21 20:45:01 +00:00
|
|
|
if type(json.RunTimeTicks) = "LongInteger"
|
|
|
|
setFieldTextValue("runtime", stri(getMinutes(json.RunTimeTicks)) + " mins")
|
|
|
|
end if
|
2022-05-14 15:47:44 +00:00
|
|
|
end if
|
2022-05-21 20:45:01 +00:00
|
|
|
end sub
|
2022-05-14 15:47:44 +00:00
|
|
|
|
|
|
|
function onKeyEvent(key as string, press as boolean) as boolean
|
|
|
|
if not press then return false
|
|
|
|
|
2022-05-15 19:10:21 +00:00
|
|
|
if key = "right" and m.playAlbum.hasFocus()
|
|
|
|
m.songList.setFocus(true)
|
|
|
|
return true
|
|
|
|
else if key = "left" and m.songList.hasFocus()
|
|
|
|
m.playAlbum.setFocus(true)
|
|
|
|
return true
|
|
|
|
end if
|
|
|
|
|
2022-05-14 15:47:44 +00:00
|
|
|
return false
|
|
|
|
end function
|