dont use optional chaining operators
This commit is contained in:
parent
0b76f0279a
commit
4590a79758
|
@ -44,7 +44,7 @@ sub itemContentChanged()
|
|||
m.itemText.text = itemData.Title
|
||||
else if itemData.type = "Series"
|
||||
if get_user_setting("ui.tvshows.disableUnwatchedEpisodeCount", "false") = "false"
|
||||
if itemData?.json?.UserData?.UnplayedItemCount <> invalid
|
||||
if isValid(itemData.json) and isValid(itemData.json.UserData) and isValid(itemData.json.UserData.UnplayedItemCount)
|
||||
if itemData.json.UserData.UnplayedItemCount > 0
|
||||
m.unplayedCount.visible = true
|
||||
m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount
|
||||
|
@ -83,7 +83,7 @@ sub itemContentChanged()
|
|||
else if itemData.type = "Episode"
|
||||
m.itemPoster.uri = itemData.PosterUrl
|
||||
m.itemIcon.uri = itemData.iconUrl
|
||||
if isValid(itemData?.json?.SeriesName)
|
||||
if isValid(itemData.json) and isValid(itemData.json.SeriesName)
|
||||
m.itemText.text = itemData.json.SeriesName + " - " + itemData.Title
|
||||
else
|
||||
m.itemText.text = itemData.Title
|
||||
|
|
|
@ -38,25 +38,25 @@ sub setPoster()
|
|||
if m.top.image <> invalid
|
||||
m.top.posterURL = m.top.image.url
|
||||
else
|
||||
if isValid(m.top.json)
|
||||
if isValid(m.top.json.ImageTags) and isValid(m.top.json.ImageTags.Primary)
|
||||
imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag": m.top.json.ImageTags.Primary }
|
||||
m.top.posterURL = ImageURL(m.top.json.id, "Primary", imgParams)
|
||||
else if isValid(m.top.json.BackdropImageTags) and isValid(m.top.json.BackdropImageTags[0])
|
||||
imgParams = { "maxHeight": 440, "Tag": m.top.json.BackdropImageTags[0] }
|
||||
m.top.posterURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
|
||||
else if isValid(m.top.json.ParentThumbImageTag) and isValid(m.top.json.ParentThumbItemId)
|
||||
imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag": m.top.json.ParentThumbImageTag }
|
||||
m.top.posterURL = ImageURL(m.top.json.ParentThumbItemId, "Thumb", imgParams)
|
||||
end if
|
||||
|
||||
if isValid(m.top.json?.ImageTags?.Primary)
|
||||
imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag": m.top.json.ImageTags.Primary }
|
||||
m.top.posterURL = ImageURL(m.top.json.id, "Primary", imgParams)
|
||||
else if isValid(m.top.json?.BackdropImageTags?[0])
|
||||
imgParams = { "maxHeight": 440, "Tag": m.top.json.BackdropImageTags[0] }
|
||||
m.top.posterURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
|
||||
else if isValid(m.top.json?.ParentThumbImageTag) and isValid(m.top.json?.ParentThumbItemId)
|
||||
imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag": m.top.json.ParentThumbImageTag }
|
||||
m.top.posterURL = ImageURL(m.top.json.ParentThumbItemId, "Thumb", imgParams)
|
||||
' Add Backdrop Image
|
||||
if isValid(m.top.json.BackdropImageTags) and isValid(m.top.json.BackdropImageTags[0])
|
||||
imgParams = { "maxHeight": 720, "maxWidth": 1280, "Tag": m.top.json.BackdropImageTags[0] }
|
||||
m.top.backdropURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
' Add Backdrop Image
|
||||
if isValid(m.top.json?.BackdropImageTags?[0])
|
||||
imgParams = { "maxHeight": 720, "maxWidth": 1280, "Tag": m.top.json.BackdropImageTags[0] }
|
||||
m.top.backdropURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
|
||||
end if
|
||||
|
||||
end if
|
||||
end sub
|
||||
|
||||
sub setContainer()
|
||||
|
|
|
@ -432,23 +432,19 @@ end sub
|
|||
sub onMetaDataLoaded()
|
||||
data = m.LoadMetaDataTask.content[0]
|
||||
m.LoadMetaDataTask.unobserveField("content")
|
||||
if isValid(data) and data.count() > 0
|
||||
if isValid(data) and data.count() > 0 and isValid(data.json)
|
||||
' Use metadata to load backdrop image
|
||||
if isValid(data?.json?.ArtistItems)
|
||||
if data.json.ArtistItems.count() > 0
|
||||
if isValid(data.json.ArtistItems[0].id)
|
||||
m.LoadBackdropImageTask.itemId = data.json.ArtistItems[0].id
|
||||
m.LoadBackdropImageTask.observeField("content", "onBackdropImageLoaded")
|
||||
m.LoadBackdropImageTask.control = "RUN"
|
||||
end if
|
||||
end if
|
||||
if isValid(data.json.ArtistItems) and isValid(data.json.ArtistItems[0]) and isValid(data.json.ArtistItems[0].id)
|
||||
m.LoadBackdropImageTask.itemId = data.json.ArtistItems[0].id
|
||||
m.LoadBackdropImageTask.observeField("content", "onBackdropImageLoaded")
|
||||
m.LoadBackdropImageTask.control = "RUN"
|
||||
end if
|
||||
|
||||
setPosterImage(data.posterURL)
|
||||
setScreenTitle(data.json)
|
||||
setOnScreenTextValues(data.json)
|
||||
|
||||
if isValid(data?.json?.RunTimeTicks)
|
||||
if isValid(data.json.RunTimeTicks)
|
||||
m.songDuration = data.json.RunTimeTicks / 10000000.0
|
||||
end if
|
||||
end if
|
||||
|
|
|
@ -79,7 +79,7 @@ function ItemMetaData(id as string)
|
|||
|
||||
imgParams = {}
|
||||
if data.type <> "Audio"
|
||||
if data?.UserData?.PlayedPercentage <> invalid
|
||||
if data.UserData <> invalid and data.UserData.PlayedPercentage <> invalid
|
||||
param = { "PercentPlayed": data.UserData.PlayedPercentage }
|
||||
imgParams.Append(param)
|
||||
end if
|
||||
|
|
Loading…
Reference in New Issue
Block a user