Merge pull request #646 from 1hitsong/music-square-artwork

Cleanup Music Artist screen layout. Use square cover art
This commit is contained in:
Jimi 2022-06-26 06:25:43 -06:00 committed by GitHub
commit ecdc508f31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 61 additions and 15 deletions

View File

@ -60,6 +60,17 @@ sub itemContentChanged()
else if itemData.type = "MusicArtist"
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
print "Unhandled Grid Item Type: " + itemData.type
end if

View File

@ -111,6 +111,8 @@ sub loadInitialItems()
else if m.top.parentItem.collectionType = "music"
' Default Settings
m.loadItemsTask.recursive = false
m.itemGrid.itemSize = "[290, 290]"
m.itemGrid.itemSpacing = "[ 0, 20]"
m.loadItemsTask.itemType = "MusicArtist,MusicAlbum"
m.view = get_user_setting("display.music.view")
@ -122,7 +124,6 @@ sub loadInitialItems()
m.loadItemsTask.itemType = "MusicAlbum"
m.loadItemsTask.recursive = true
end if
else if m.top.parentItem.collectionType = "livetv"
m.loadItemsTask.itemType = "LiveTV"

View File

@ -51,8 +51,12 @@ sub itemContentChanged() as void
m.poster = m.top.findNode("poster")
itemData = m.top.itemContent
m.title.text = itemData.title
if itemData.json.lookup("Type") = "Episode" and itemData.json.IndexNumber <> invalid
m.title.text = StrI(itemData.json.IndexNumber) + ". " + m.title.text
else if itemData.json.lookup("Type") = "MusicAlbum"
m.title.font = "font:SmallestSystemFont"
m.staticTitle.font = "font:SmallestSystemFont"
end if
m.staticTitle.text = m.title.text

View File

@ -12,19 +12,19 @@ sub setPoster()
else
if m.top.json.ImageTags.Primary <> invalid
imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag": m.top.json.ImageTags.Primary }
imgParams = { "maxHeight": 440, "maxWidth": 295 }
m.top.posterURL = ImageURL(m.top.json.id, "Primary", imgParams)
else if m.top.json.BackdropImageTags[0] <> invalid
imgParams = { "maxHeight": 440, "Tag": m.top.json.BackdropImageTags[0] }
imgParams = { "maxHeight": 440 }
m.top.posterURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
else if m.top.json.ParentThumbImageTag <> invalid and m.top.json.ParentThumbItemId <> invalid
imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag": m.top.json.ParentThumbImageTag }
imgParams = { "maxHeight": 440, "maxWidth": 295 }
m.top.posterURL = ImageURL(m.top.json.ParentThumbItemId, "Thumb", imgParams)
end if
' Add Backdrop Image
if m.top.json.BackdropImageTags[0] <> invalid
imgParams = { "maxHeight": 720, "maxWidth": 1280, "Tag": m.top.json.BackdropImageTags[0] }
imgParams = { "maxHeight": 720, "maxWidth": 1280 }
m.top.backdropURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
end if

View File

@ -15,19 +15,19 @@ sub setPoster()
' Add Artist Image
if m.top.json.ImageTags.Primary <> invalid
imgParams = { "maxHeight": 440, "maxWidth": 440, "Tag": m.top.json.ImageTags.Primary }
imgParams = { "maxHeight": 440, "maxWidth": 440 }
m.top.posterURL = ImageURL(m.top.json.id, "Primary", imgParams)
else if m.top.json.BackdropImageTags[0] <> invalid
imgParams = { "maxHeight": 440, "Tag": m.top.json.BackdropImageTags[0] }
imgParams = { "maxHeight": 440 }
m.top.posterURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
else if m.top.json.ParentThumbImageTag <> invalid and m.top.json.ParentThumbItemId <> invalid
imgParams = { "maxHeight": 440, "maxWidth": 440, "Tag": m.top.json.ParentThumbImageTag }
imgParams = { "maxHeight": 440, "maxWidth": 440 }
m.top.posterURL = ImageURL(m.top.json.ParentThumbItemId, "Thumb", imgParams)
end if
' Add Backdrop Image
if m.top.json.BackdropImageTags[0] <> invalid
imgParams = { "maxHeight": 720, "maxWidth": 1280, "Tag": m.top.json.BackdropImageTags[0] }
imgParams = { "maxHeight": 720, "maxWidth": 1280 }
m.top.backdropURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
end if

View File

@ -11,13 +11,13 @@ sub init()
end sub
sub updateSize()
itemWidth = 200
itemHeight = 320 ' width * 1.5 + text
itemWidth = 250
itemHeight = 250
m.top.visible = true
' size of the whole row
m.top.itemSize = [1700, (itemHeight + 40)]
m.top.itemSize = [1650, 290]
' spacing between rows
m.top.itemSpacing = [0, 0]

View File

@ -2,6 +2,11 @@ sub init()
m.top.optionsAvailable = false
setupMainNode()
' Load background image
m.LoadBackdropImageTask = CreateObject("roSGNode", "LoadItemsTask")
m.LoadBackdropImageTask.itemsToLoad = "backdropImage"
m.backDrop = m.top.findNode("backdrop")
m.artistImage = m.top.findNode("artistImage")
m.dscr = m.top.findNode("overview")
m.dscr.observeField("isTextEllipsized", "onEllipsisChanged")
@ -17,6 +22,11 @@ end sub
sub pageContentChanged()
item = m.top.pageContent
' Use metadata to load backdrop image
m.LoadBackdropImageTask.itemId = item.json.id
m.LoadBackdropImageTask.observeField("content", "onBackdropImageLoaded")
m.LoadBackdropImageTask.control = "RUN"
' Populate scene data
setScreenTitle(item.json)
setPosterImage(item.posterURL)
@ -35,6 +45,23 @@ sub setPosterImage(posterURL)
end if
end sub
sub onBackdropImageLoaded()
data = m.LoadBackdropImageTask.content[0]
m.LoadBackdropImageTask.unobserveField("content")
if isValid(data) and data <> ""
setBackdropImage(data)
end if
end sub
' Add backdrop image to screen
sub setBackdropImage(data)
if isValid(data)
if m.backDrop.uri <> data
m.backDrop.uri = data
end if
end if
end sub
' Populate on screen text variables
sub setOnScreenTextValues(json)
if isValid(json)

View File

@ -1,12 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="MusicArtistDetails" extends="JFGroup">
<children>
<LayoutGroup id="toplevel" layoutDirection="vert" itemSpacings="[-10]" >
<Poster id="backdrop" opacity=".4" loadDisplayMode="scaleToZoom" width="1920" height="1200" blendColor="#3f3f3f" />
<LayoutGroup id="toplevel" layoutDirection="vert" itemSpacings="[35]" >
<LayoutGroup id="main_group" layoutDirection="horiz" itemSpacings="[15]" >
<Poster id="artistImage" width="450" height="450" />
<Label id="overview" wrap="true" maxLines="8" width="1250" ellipsisText=" ... (Press * to read more)" />
<Label id="overview" wrap="true" maxLines="9" width="1250" ellipsisText=" ... (Press * to read more)" />
</LayoutGroup>
<MusicArtistAlbumRow id="albums" />
<Rectangle id='albumRect' translation="[0, 0]" width="1720" height="325" color="0x00000066">
<MusicArtistAlbumRow id="albums" translation="[35, 10]" rowLabelColor="#999999" rowLabelFont="font:SmallestSystemFont" />
</Rectangle>
</LayoutGroup>
</children>
<interface>