jellyfin-roku/components/data/MusicArtistData.bs
2023-10-03 12:11:25 -04:00

40 lines
1.3 KiB
Plaintext

import "pkg:/source/api/Image.bs"
import "pkg:/source/api/baserequest.bs"
import "pkg:/source/utils/config.bs"
sub setFields()
json = m.top.json
m.top.id = json.id
m.top.favorite = json.UserData.isFavorite
m.top.Type = "MusicArtist"
setPoster()
m.top.title = json.name
end sub
sub setPoster()
if m.top.image <> invalid
m.top.posterURL = m.top.image.url
else
' Add Artist Image
if m.top.json.ImageTags.Primary <> invalid
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 }
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 }
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 }
m.top.backdropURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
end if
end if
end sub