2023-10-03 16:11:25 +00:00
|
|
|
import "pkg:/source/api/Image.bs"
|
|
|
|
import "pkg:/source/api/baserequest.bs"
|
|
|
|
import "pkg:/source/utils/config.bs"
|
2023-05-03 21:21:04 +00:00
|
|
|
|
2022-05-14 02:35:50 +00:00
|
|
|
sub setFields()
|
|
|
|
json = m.top.json
|
|
|
|
m.top.id = json.id
|
|
|
|
m.top.favorite = json.UserData.isFavorite
|
|
|
|
m.top.Type = "MusicArtist"
|
|
|
|
setPoster()
|
2022-05-14 21:14:15 +00:00
|
|
|
|
|
|
|
m.top.title = json.name
|
2022-05-14 02:35:50 +00:00
|
|
|
end sub
|
|
|
|
|
|
|
|
sub setPoster()
|
|
|
|
if m.top.image <> invalid
|
|
|
|
m.top.posterURL = m.top.image.url
|
|
|
|
else
|
|
|
|
|
2022-05-14 22:30:22 +00:00
|
|
|
' Add Artist Image
|
2022-05-14 02:35:50 +00:00
|
|
|
if m.top.json.ImageTags.Primary <> invalid
|
2022-06-11 23:32:24 +00:00
|
|
|
imgParams = { "maxHeight": 440, "maxWidth": 440 }
|
2022-05-14 02:35:50 +00:00
|
|
|
m.top.posterURL = ImageURL(m.top.json.id, "Primary", imgParams)
|
|
|
|
else if m.top.json.BackdropImageTags[0] <> invalid
|
2022-06-11 23:32:24 +00:00
|
|
|
imgParams = { "maxHeight": 440 }
|
2022-05-14 02:35:50 +00:00
|
|
|
m.top.posterURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
|
|
|
|
else if m.top.json.ParentThumbImageTag <> invalid and m.top.json.ParentThumbItemId <> invalid
|
2022-06-11 23:32:24 +00:00
|
|
|
imgParams = { "maxHeight": 440, "maxWidth": 440 }
|
2022-05-14 02:35:50 +00:00
|
|
|
m.top.posterURL = ImageURL(m.top.json.ParentThumbItemId, "Thumb", imgParams)
|
|
|
|
end if
|
|
|
|
|
|
|
|
' Add Backdrop Image
|
|
|
|
if m.top.json.BackdropImageTags[0] <> invalid
|
2022-06-11 23:32:24 +00:00
|
|
|
imgParams = { "maxHeight": 720, "maxWidth": 1280 }
|
2022-05-14 02:35:50 +00:00
|
|
|
m.top.backdropURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
|
|
|
|
end if
|
|
|
|
|
|
|
|
end if
|
|
|
|
end sub
|