2019-05-03 12:48:59 +00:00
|
|
|
sub setData()
|
|
|
|
' We keep json around just as a reference,
|
|
|
|
' but ideally everything should be going through one of the interfaces
|
|
|
|
datum = m.top.json
|
|
|
|
|
|
|
|
m.top.id = datum.id
|
|
|
|
m.top.name = datum.name
|
2020-03-12 18:33:45 +00:00
|
|
|
m.top.type = datum.type
|
|
|
|
|
2021-06-26 13:52:16 +00:00
|
|
|
if datum.CollectionType = invalid
|
2020-03-12 18:33:45 +00:00
|
|
|
m.top.CollectionType = datum.type
|
|
|
|
else
|
|
|
|
m.top.CollectionType = datum.CollectionType
|
|
|
|
end if
|
|
|
|
|
|
|
|
' Set appropriate Images for Wide and Tall based on type
|
|
|
|
|
2021-07-09 20:08:32 +00:00
|
|
|
if datum.type = "CollectionFolder" or datum.type = "UserView"
|
2022-12-26 20:42:50 +00:00
|
|
|
params = { "Tag": datum.ImageTags.Primary, "maxHeight": 261, "maxWidth": 464 }
|
2020-03-12 18:33:45 +00:00
|
|
|
m.top.thumbnailURL = ImageURL(datum.id, "Primary", params)
|
|
|
|
m.top.widePosterUrl = m.top.thumbnailURL
|
|
|
|
|
2020-10-25 16:32:26 +00:00
|
|
|
' Add Icon URLs for display if there is no Poster
|
2021-06-26 13:52:16 +00:00
|
|
|
if datum.CollectionType = "livetv"
|
2020-11-23 17:25:42 +00:00
|
|
|
m.top.iconUrl = "pkg:/images/media_type_icons/live_tv_white.png"
|
2021-06-26 13:52:16 +00:00
|
|
|
else if datum.CollectionType = "folders"
|
2021-04-12 06:43:41 +00:00
|
|
|
m.top.iconUrl = "pkg:/images/media_type_icons/folder_white.png"
|
2020-10-25 16:32:26 +00:00
|
|
|
end if
|
|
|
|
|
2021-06-26 13:52:16 +00:00
|
|
|
else if datum.type = "Episode"
|
2020-03-12 18:33:45 +00:00
|
|
|
imgParams = { "AddPlayedIndicator": datum.UserData.Played }
|
|
|
|
|
|
|
|
imgParams.Append({ "maxHeight": 261 })
|
|
|
|
imgParams.Append({ "maxWidth": 464 })
|
|
|
|
|
2022-12-26 20:42:50 +00:00
|
|
|
if datum.ImageTags.Primary <> invalid
|
|
|
|
param = { "Tag": datum.ImageTags.Primary }
|
|
|
|
imgParams.Append(param)
|
|
|
|
end if
|
|
|
|
|
2022-07-12 23:15:59 +00:00
|
|
|
m.top.thumbnailURL = ImageURL(datum.id, "Primary", imgParams)
|
2020-03-12 18:33:45 +00:00
|
|
|
|
|
|
|
' Add Wide Poster (Series Backdrop)
|
2021-06-26 13:52:16 +00:00
|
|
|
if datum.ParentThumbImageTag <> invalid
|
2022-12-26 20:42:50 +00:00
|
|
|
imgParams["Tag"] = datum.ParentThumbImageTag
|
2020-03-12 18:33:45 +00:00
|
|
|
m.top.widePosterUrl = ImageURL(datum.ParentThumbItemId, "Thumb", imgParams)
|
2021-06-26 13:52:16 +00:00
|
|
|
else if datum.ParentBackdropImageTags <> invalid
|
2022-12-26 20:42:50 +00:00
|
|
|
imgParams["Tag"] = datum.ParentBackdropImageTags[0]
|
2020-03-12 18:33:45 +00:00
|
|
|
m.top.widePosterUrl = ImageURL(datum.ParentBackdropItemId, "Backdrop", imgParams)
|
2021-06-26 13:52:16 +00:00
|
|
|
else if datum.ImageTags.Primary <> invalid
|
2022-12-26 20:42:50 +00:00
|
|
|
imgParams["Tag"] = datum.SeriesPrimaryImageTag
|
2022-07-12 23:15:59 +00:00
|
|
|
m.top.widePosterUrl = ImageURL(datum.id, "Primary", imgParams)
|
2020-03-12 18:33:45 +00:00
|
|
|
end if
|
|
|
|
|
2021-06-26 13:52:16 +00:00
|
|
|
else if datum.type = "Series"
|
2020-03-12 18:33:45 +00:00
|
|
|
imgParams = { "maxHeight": 261 }
|
|
|
|
imgParams.Append({ "maxWidth": 464 })
|
|
|
|
|
|
|
|
m.top.posterURL = ImageURL(datum.id, "Primary", imgParams)
|
|
|
|
|
|
|
|
' Add Wide Poster (Series Backdrop)
|
2021-06-26 13:52:16 +00:00
|
|
|
if datum.ImageTags <> invalid and datum.imageTags.Thumb <> invalid
|
2022-12-26 20:42:50 +00:00
|
|
|
imgParams["Tag"] = datum.imageTags.Thumb
|
2020-03-12 18:33:45 +00:00
|
|
|
m.top.widePosterUrl = ImageURL(datum.Id, "Thumb", imgParams)
|
2021-06-26 13:52:16 +00:00
|
|
|
else if datum.BackdropImageTags <> invalid
|
2022-12-26 20:42:50 +00:00
|
|
|
imgParams["Tag"] = datum.BackdropImageTags[0]
|
2020-03-12 18:33:45 +00:00
|
|
|
m.top.widePosterUrl = ImageURL(datum.Id, "Backdrop", imgParams)
|
|
|
|
end if
|
|
|
|
|
2021-06-26 13:52:16 +00:00
|
|
|
else if datum.type = "Movie"
|
2020-03-12 18:33:45 +00:00
|
|
|
imgParams = { AddPlayedIndicator: datum.UserData.Played }
|
|
|
|
|
|
|
|
imgParams.Append({ "maxHeight": 261 })
|
|
|
|
imgParams.Append({ "maxWidth": 175 })
|
|
|
|
|
2022-12-26 20:42:50 +00:00
|
|
|
if datum.ImageTags.Primary <> invalid
|
|
|
|
param = { "Tag": datum.ImageTags.Primary }
|
|
|
|
imgParams.Append(param)
|
|
|
|
end if
|
|
|
|
|
2020-03-12 18:33:45 +00:00
|
|
|
m.top.posterURL = ImageURL(datum.id, "Primary", imgParams)
|
|
|
|
|
|
|
|
' For wide image, use backdrop
|
|
|
|
imgParams["maxWidth"] = 464
|
|
|
|
|
2021-06-26 13:52:16 +00:00
|
|
|
if datum.ImageTags <> invalid and datum.imageTags.Thumb <> invalid
|
2022-12-26 20:42:50 +00:00
|
|
|
imgParams["Tag"] = datum.imageTags.Thumb
|
2020-03-14 15:00:41 +00:00
|
|
|
m.top.thumbnailUrl = ImageURL(datum.Id, "Thumb", imgParams)
|
2022-07-12 23:15:59 +00:00
|
|
|
else if datum.BackdropImageTags[0] <> invalid
|
2022-12-26 20:42:50 +00:00
|
|
|
imgParams["Tag"] = datum.BackdropImageTags[0]
|
2020-03-14 15:00:41 +00:00
|
|
|
m.top.thumbnailUrl = ImageURL(datum.id, "Backdrop", imgParams)
|
2020-03-12 18:33:45 +00:00
|
|
|
end if
|
|
|
|
|
2021-06-26 13:52:16 +00:00
|
|
|
else if datum.type = "Video"
|
2020-05-13 19:36:38 +00:00
|
|
|
imgParams = { AddPlayedIndicator: datum.UserData.Played }
|
|
|
|
|
|
|
|
imgParams.Append({ "maxHeight": 261 })
|
|
|
|
imgParams.Append({ "maxWidth": 175 })
|
|
|
|
|
2022-12-26 20:42:50 +00:00
|
|
|
if datum.ImageTags.Primary <> invalid
|
|
|
|
param = { "Tag": datum.ImageTags.Primary }
|
|
|
|
imgParams.Append(param)
|
|
|
|
end if
|
|
|
|
|
2020-05-13 19:36:38 +00:00
|
|
|
m.top.posterURL = ImageURL(datum.id, "Primary", imgParams)
|
|
|
|
|
|
|
|
' For wide image, use backdrop
|
|
|
|
imgParams["maxWidth"] = 464
|
|
|
|
|
2021-06-26 13:52:16 +00:00
|
|
|
if datum.ImageTags <> invalid and datum.imageTags.Thumb <> invalid
|
2022-12-26 20:42:50 +00:00
|
|
|
imgParams["Tag"] = datum.imageTags.Thumb
|
2020-05-13 19:36:38 +00:00
|
|
|
m.top.thumbnailUrl = ImageURL(datum.Id, "Thumb", imgParams)
|
2021-06-26 13:52:16 +00:00
|
|
|
else if datum.BackdropImageTags[0] <> invalid
|
2022-12-26 20:42:50 +00:00
|
|
|
imgParams["Tag"] = datum.BackdropImageTags[0]
|
2020-05-13 19:36:38 +00:00
|
|
|
m.top.thumbnailUrl = ImageURL(datum.id, "Backdrop", imgParams)
|
|
|
|
end if
|
2022-07-12 23:15:59 +00:00
|
|
|
else if datum.type = "MusicAlbum"
|
2022-12-26 20:42:50 +00:00
|
|
|
params = { "Tag": datum.ImageTags.Primary, "maxHeight": 261, "maxWidth": 261 }
|
2020-03-12 18:33:45 +00:00
|
|
|
m.top.thumbnailURL = ImageURL(datum.id, "Primary", params)
|
|
|
|
m.top.widePosterUrl = m.top.thumbnailURL
|
|
|
|
m.top.posterUrl = m.top.thumbnailURL
|
2020-03-15 17:09:51 +00:00
|
|
|
|
2021-07-09 20:08:32 +00:00
|
|
|
else if datum.type = "TvChannel" or datum.type = "Channel"
|
2022-12-26 20:42:50 +00:00
|
|
|
params = { "Tag": datum.ImageTags.Primary, "maxHeight": 261, "maxWidth": 464 }
|
2020-10-27 17:12:18 +00:00
|
|
|
m.top.thumbnailURL = ImageURL(datum.id, "Primary", params)
|
|
|
|
m.top.widePosterUrl = m.top.thumbnailURL
|
2020-11-23 17:25:42 +00:00
|
|
|
m.top.iconUrl = "pkg:/images/media_type_icons/live_tv_white.png"
|
2020-03-03 23:01:13 +00:00
|
|
|
end if
|
2020-03-12 18:33:45 +00:00
|
|
|
|
2022-05-30 12:57:40 +00:00
|
|
|
end sub
|