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
|
|
|
|
|
2020-03-03 23:01:13 +00:00
|
|
|
if datum.CollectionType = invalid then
|
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
|
|
|
|
|
2020-03-23 16:14:26 +00:00
|
|
|
if datum.type = "CollectionFolder" OR datum.type = "UserView" then
|
2020-03-12 18:33:45 +00:00
|
|
|
params = { "Tag" : datum.ImageTags.Primary, "maxHeight" : 261, "maxWidth" : 464 }
|
|
|
|
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
|
|
|
|
if datum.CollectionType = "livetv" then
|
2020-11-23 17:25:42 +00:00
|
|
|
m.top.iconUrl = "pkg:/images/media_type_icons/live_tv_white.png"
|
2021-04-12 06:43:41 +00:00
|
|
|
else if datum.CollectionType = "folders" then
|
|
|
|
m.top.iconUrl = "pkg:/images/media_type_icons/folder_white.png"
|
2020-10-25 16:32:26 +00:00
|
|
|
end if
|
|
|
|
|
2020-03-12 18:33:45 +00:00
|
|
|
else if datum.type = "Episode" then
|
|
|
|
imgParams = { "AddPlayedIndicator": datum.UserData.Played }
|
|
|
|
|
|
|
|
if datum.UserData.PlayedPercentage <> invalid then
|
|
|
|
imgParams.Append({ "PercentPlayed": datum.UserData.PlayedPercentage })
|
|
|
|
end if
|
|
|
|
|
|
|
|
imgParams.Append({ "maxHeight": 261 })
|
|
|
|
imgParams.Append({ "maxWidth": 464 })
|
|
|
|
|
|
|
|
if datum.ImageTags.Primary <> invalid then
|
|
|
|
param = { "Tag" : datum.ImageTags.Primary }
|
|
|
|
imgParams.Append(param)
|
|
|
|
end if
|
|
|
|
|
|
|
|
m.top.thumbnailURL = ImageURL(datum.id, "Primary", imgParams)
|
|
|
|
|
|
|
|
' Add Wide Poster (Series Backdrop)
|
|
|
|
if datum.ParentThumbImageTag <> invalid then
|
|
|
|
imgParams["Tag"] = datum.ParentThumbImageTag
|
|
|
|
m.top.widePosterUrl = ImageURL(datum.ParentThumbItemId, "Thumb", imgParams)
|
|
|
|
else if datum.ParentBackdropImageTags <> invalid then
|
|
|
|
imgParams["Tag"] = datum.ParentBackdropImageTags[0]
|
|
|
|
m.top.widePosterUrl = ImageURL(datum.ParentBackdropItemId, "Backdrop", imgParams)
|
|
|
|
else if datum.ImageTags.Primary <> invalid then
|
|
|
|
imgParams["Tag"] = datum.SeriesPrimaryImageTag
|
|
|
|
m.top.widePosterUrl = ImageURL(datum.id, "Primary", imgParams)
|
|
|
|
end if
|
|
|
|
|
|
|
|
else if datum.type = "Series" then
|
|
|
|
imgParams = { "maxHeight": 261 }
|
|
|
|
imgParams.Append({ "maxWidth": 464 })
|
|
|
|
|
2020-03-18 02:12:11 +00:00
|
|
|
if datum.UserData.UnplayedItemCount > 0 then
|
|
|
|
imgParams["UnplayedCount"] = datum.UserData.UnplayedItemCount
|
|
|
|
end if
|
|
|
|
|
2020-03-12 18:33:45 +00:00
|
|
|
if datum.ImageTags.Primary <> invalid then
|
2020-03-18 02:12:11 +00:00
|
|
|
imgParams["Tag"] = datum.ImageTags.Primary
|
2020-03-12 18:33:45 +00:00
|
|
|
end if
|
|
|
|
|
|
|
|
m.top.posterURL = ImageURL(datum.id, "Primary", imgParams)
|
|
|
|
|
|
|
|
' Add Wide Poster (Series Backdrop)
|
|
|
|
if datum.ImageTags <> invalid and datum.imageTags.Thumb <> invalid then
|
|
|
|
imgParams["Tag"] = datum.imageTags.Thumb
|
|
|
|
m.top.widePosterUrl = ImageURL(datum.Id, "Thumb", imgParams)
|
|
|
|
else if datum.BackdropImageTags <> invalid then
|
|
|
|
imgParams["Tag"] = datum.BackdropImageTags[0]
|
|
|
|
m.top.widePosterUrl = ImageURL(datum.Id, "Backdrop", imgParams)
|
|
|
|
end if
|
|
|
|
|
|
|
|
else if datum.type = "Movie" then
|
|
|
|
imgParams = { AddPlayedIndicator: datum.UserData.Played }
|
|
|
|
|
|
|
|
if datum.UserData.PlayedPercentage <> invalid then
|
|
|
|
imgParams.Append({ "PercentPlayed": datum.UserData.PlayedPercentage })
|
|
|
|
end if
|
|
|
|
|
|
|
|
imgParams.Append({ "maxHeight": 261 })
|
|
|
|
imgParams.Append({ "maxWidth": 175 })
|
|
|
|
|
|
|
|
if datum.ImageTags.Primary <> invalid then
|
|
|
|
param = { "Tag" : datum.ImageTags.Primary }
|
|
|
|
imgParams.Append(param)
|
|
|
|
end if
|
|
|
|
|
|
|
|
m.top.posterURL = ImageURL(datum.id, "Primary", imgParams)
|
|
|
|
|
|
|
|
' For wide image, use backdrop
|
|
|
|
imgParams["maxWidth"] = 464
|
|
|
|
|
2020-03-14 15:00:41 +00:00
|
|
|
if datum.ImageTags <> invalid and datum.imageTags.Thumb <> invalid then
|
|
|
|
imgParams["Tag"] = datum.imageTags.Thumb
|
|
|
|
m.top.thumbnailUrl = ImageURL(datum.Id, "Thumb", imgParams)
|
|
|
|
else if datum.BackdropImageTags[0] <> invalid then
|
2020-03-12 18:33:45 +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
|
|
|
|
|
2020-05-13 19:36:38 +00:00
|
|
|
else if datum.type = "Video" then
|
|
|
|
imgParams = { AddPlayedIndicator: datum.UserData.Played }
|
|
|
|
|
|
|
|
if datum.UserData.PlayedPercentage <> invalid then
|
|
|
|
imgParams.Append({ "PercentPlayed": datum.UserData.PlayedPercentage })
|
|
|
|
end if
|
|
|
|
|
|
|
|
imgParams.Append({ "maxHeight": 261 })
|
|
|
|
imgParams.Append({ "maxWidth": 175 })
|
|
|
|
|
|
|
|
if datum.ImageTags.Primary <> invalid then
|
|
|
|
param = { "Tag" : datum.ImageTags.Primary }
|
|
|
|
imgParams.Append(param)
|
|
|
|
end if
|
|
|
|
|
|
|
|
m.top.posterURL = ImageURL(datum.id, "Primary", imgParams)
|
|
|
|
|
|
|
|
' For wide image, use backdrop
|
|
|
|
imgParams["maxWidth"] = 464
|
|
|
|
|
|
|
|
if datum.ImageTags <> invalid and datum.imageTags.Thumb <> invalid then
|
|
|
|
imgParams["Tag"] = datum.imageTags.Thumb
|
|
|
|
m.top.thumbnailUrl = ImageURL(datum.Id, "Thumb", imgParams)
|
|
|
|
else if datum.BackdropImageTags[0] <> invalid then
|
|
|
|
imgParams["Tag"] = datum.BackdropImageTags[0]
|
|
|
|
m.top.thumbnailUrl = ImageURL(datum.id, "Backdrop", imgParams)
|
|
|
|
end if
|
2020-03-12 18:33:45 +00:00
|
|
|
else if datum.type = "MusicAlbum" then
|
|
|
|
params = { "Tag" : datum.ImageTags.Primary, "maxHeight" : 261, "maxWidth" : 261 }
|
|
|
|
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
|
|
|
|
2020-10-27 17:12:18 +00:00
|
|
|
else if datum.type = "TvChannel" OR datum.type = "Channel" then
|
|
|
|
params = { "Tag" : datum.ImageTags.Primary, "maxHeight" : 261, "maxWidth" : 464 }
|
|
|
|
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
|
|
|
|
2019-05-03 12:48:59 +00:00
|
|
|
end sub
|