Skip to content

Commit d1cdc60

Browse files
committed
Update code docs
1 parent 23695d3 commit d1cdc60

15 files changed

Lines changed: 155 additions & 81 deletions

docs/components_ItemGrid_LoadItemsTask2.bs.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
end sub
2323

2424
sub loadItems()
25+
globalUser = m.global.user
2526
results = []
2627

2728
sort_field = m.top.sortField
@@ -107,33 +108,33 @@
107108

108109
if m.top.ItemType = "LiveTV"
109110
url = "LiveTv/Channels"
110-
params.append({ UserId: m.global.user.id })
111+
params.append({ UserId: globalUser.id })
111112
else if m.top.view = "Networks"
112113
url = "Studios"
113-
params.append({ UserId: m.global.user.id })
114+
params.append({ UserId: globalUser.id })
114115
else if m.top.view = "Genres"
115116
url = "Genres"
116-
params.append({ UserId: m.global.user.id, includeItemTypes: m.top.itemType })
117+
params.append({ UserId: globalUser.id, includeItemTypes: m.top.itemType })
117118
else if m.top.ItemType = "MusicArtist"
118119
url = "Artists"
119120
params.append({
120-
UserId: m.global.user.id,
121+
UserId: globalUser.id,
121122
Fields: "Genres"
122123
})
123124
params.IncludeItemTypes = "MusicAlbum,Audio"
124125
else if m.top.ItemType = "AlbumArtists"
125126
url = "Artists/AlbumArtists"
126127
params.append({
127-
UserId: m.global.user.id,
128+
UserId: globalUser.id,
128129
Fields: "Genres"
129130
})
130131
params.IncludeItemTypes = "MusicAlbum,Audio"
131132
else if m.top.ItemType = "MusicAlbum"
132-
url = Substitute("Users/{0}/Items/", m.global.user.id)
133+
url = Substitute("Users/{0}/Items/", globalUser.id)
133134
params.append({ ImageTypeLimit: 1 })
134135
params.append({ EnableImageTypes: "Primary,Backdrop,Banner,Thumb" })
135136
else
136-
url = Substitute("Users/{0}/Items/", m.global.user.id)
137+
url = Substitute("Users/{0}/Items/", globalUser.id)
137138
end if
138139

139140
resp = APIRequest(url, params)
@@ -202,7 +203,7 @@
202203
tmp = CreateObject("roSGNode", "ContentNode")
203204
tmp.title = item.name
204205

205-
genreData = api.users.GetItemsByQuery(m.global.user.id, {
206+
genreData = api.users.GetItemsByQuery(globalUser.id, {
206207
SortBy: "Random",
207208
SortOrder: "Ascending",
208209
IncludeItemTypes: m.top.itemType,

docs/components_home_Home.bs.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,20 @@
8585
' Configure overhang UI
8686
m.log.increaseIndent("Configuring overhang")
8787
scene = m.top.getScene()
88+
globalUser = m.global.user
8889
m.log.debug("Retrieved scene", scene)
8990

9091
overhang = scene.findNode("overhang")
9192
if isValid(overhang)
9293
m.log.debug("Found overhang node", overhang)
9394

9495
overhang.isLogoVisible = true
95-
overhang.currentUser = m.global.user.name
96+
overhang.currentUser = globalUser.name
9697
overhang.title = tr("Home")
9798
m.log.debug("Updated overhang properties", "user:", overhang.currentUser, "title:", overhang.title, "logoVisible:", overhang.isLogoVisible)
9899

99100
' Hide clock if user preference is set
100-
hideClockSetting = m.global.user.settings.uiDesignHideClock
101+
hideClockSetting = globalUser.settings.uiDesignHideClock
101102
m.log.debug("Hide clock setting", hideClockSetting)
102103

103104
if hideClockSetting
@@ -147,7 +148,7 @@
147148
refresh()
148149

149150
' Update backdrop based on current splash background setting
150-
splashEnabled = m.global.user.settings.uiHomeSplashBackground
151+
splashEnabled = globalUser.settings.uiHomeSplashBackground
151152
m.log.debug("Current splash background setting", splashEnabled)
152153

153154
if isValid(m.backdrop)

docs/components_home_HomeItem.bs.html

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,8 @@
6767

6868
itemData.Title = itemData.name ' Temporarily required while we move from "HomeItem" to "JRContentItem"
6969

70-
' validate to prevent crash
71-
userSettings = invalid
72-
if isValid(m.global) and isValid(m.global.user) and isValid(m.global.user.settings)
73-
userSettings = m.global.user.settings
74-
end if
70+
globalUser = m.global.user
71+
userSettings = globalUser.settings
7572

7673
' validate to prevent crash
7774
if not isValid(m.itemPoster) then initItemPoster()
@@ -153,7 +150,7 @@
153150

154151
if isValid(userSettings)
155152
if userSettings.uiGeneralEpisodeImages = "webclient"
156-
tmpSetting = m.global.user.config.useEpisodeImagesInNextUpAndResume
153+
tmpSetting = globalUser.config.useEpisodeImagesInNextUpAndResume
157154
if isValid(tmpSetting) and tmpSetting
158155
m.itemPoster.uri = itemData.thumbnailURL
159156
else

docs/components_home_LoadItemsTask.bs.html

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
end sub
1414

1515
sub loadItems()
16+
globalUser = m.global.user
1617

1718
results = []
1819

1920
' Load Libraries
2021
if m.top.itemsToLoad = "libraries"
2122

22-
url = Substitute("Users/{0}/Views/", m.global.user.id)
23+
url = Substitute("Users/{0}/Views/", globalUser.id)
2324
resp = APIRequest(url)
2425
data = getJson(resp)
2526
if isValid(data) and isValid(data.Items)
@@ -35,7 +36,7 @@
3536

3637
' Load Latest Additions to Libraries
3738
else if m.top.itemsToLoad = "latest"
38-
activeUser = m.global.user.id
39+
activeUser = globalUser.id
3940
if isValid(activeUser)
4041
url = Substitute("Users/{0}/Items/Latest", activeUser)
4142
params = {}
@@ -62,15 +63,15 @@
6263

6364
' Load Next Up
6465
else if m.top.itemsToLoad = "nextUp"
65-
userSettings = m.global.user.settings
66+
userSettings = globalUser.settings
6667

6768
url = "Shows/NextUp"
6869
params = {}
6970
params["recursive"] = true
7071
params["SortBy"] = "DatePlayed"
7172
params["SortOrder"] = "Descending"
7273
params["ImageTypeLimit"] = 1
73-
params["UserId"] = m.global.user.id
74+
params["UserId"] = globalUser.id
7475
params["EnableRewatching"] = userSettings.uiDetailsEnableRewatchingNextUp
7576
params["DisableFirstEpisode"] = false
7677
params["limit"] = 69
@@ -100,7 +101,7 @@
100101
end if
101102
' Load Continue Watching
102103
else if m.top.itemsToLoad = "continue"
103-
activeUser = m.global.user.id
104+
activeUser = globalUser.id
104105
if isValid(activeUser)
105106
url = Substitute("Users/{0}/Items/Resume", activeUser)
106107

@@ -127,7 +128,7 @@
127128

128129
else if m.top.itemsToLoad = "favorites"
129130

130-
url = Substitute("Users/{0}/Items", m.global.user.id)
131+
url = Substitute("Users/{0}/Items", globalUser.id)
131132

132133
params = {}
133134
params["Filters"] = "IsFavorite"
@@ -161,7 +162,7 @@
161162
else if m.top.itemsToLoad = "onNow"
162163
url = "LiveTv/Programs/Recommended"
163164
params = {}
164-
params["userId"] = m.global.user.id
165+
params["userId"] = globalUser.id
165166
params["isAiring"] = true
166167
params["limit"] = 16 ' 16 to be consistent with "Latest In"
167168
params["imageTypeLimit"] = 1
@@ -198,7 +199,7 @@
198199
end for
199200
else if m.top.itemsToLoad = "specialfeatures"
200201
params = {}
201-
url = Substitute("Users/{0}/Items/{1}/SpecialFeatures", m.global.user.id, m.top.itemId)
202+
url = Substitute("Users/{0}/Items/{1}/SpecialFeatures", globalUser.id, m.top.itemId)
202203
resp = APIRequest(url, params)
203204
data = getJson(resp)
204205
if isValid(data) and data.count() > 0
@@ -232,7 +233,7 @@
232233
end for
233234
end if
234235
else if m.top.itemsToLoad = "likethis"
235-
params = { "userId": m.global.user.id, "limit": 16 }
236+
params = { "userId": globalUser.id, "limit": 16 }
236237
url = Substitute("Items/{0}/Similar", m.top.itemId)
237238
resp = APIRequest(url, params)
238239
data = getJson(resp)

docs/components_liveTv_LoadChannelsTask.bs.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
end sub
1010

1111
sub loadChannels()
12+
globalUser = m.global.user
1213

1314
results = []
1415

@@ -25,7 +26,7 @@
2526
SortBy: sort_field,
2627
SortOrder: sort_order,
2728
recursive: m.top.recursive,
28-
UserId: m.global.user.id
29+
UserId: globalUser.id
2930
}
3031

3132
' Handle special case when getting names starting with numeral
@@ -46,7 +47,7 @@
4647
params.append({ isFavorite: true })
4748
end if
4849

49-
url = Substitute("Users/{0}/Items/", m.global.user.id)
50+
url = Substitute("Users/{0}/Items/", globalUser.id)
5051

5152
resp = APIRequest(url, params)
5253
data = getJson(resp)

docs/components_ui_markupgrid_JRMarkupGrid.bs.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
end sub
1616

1717
sub applySectionDividerFontScale()
18+
globalUser = m.global.user
1819
if not isValid(m.top.sectionDividerFont) then return
1920

2021
' Get the current font size if one is set
2122
currentSize = m.top.sectionDividerFont.size
2223
if currentSize <= 0 then return
2324

2425
' Apply the global scale factor
25-
if isValid(m.global.user.fontScaleFactor) and m.global.user.fontScaleFactor > 0
26-
scaledSize = currentSize * m.global.user.fontScaleFactor
26+
if isValid(globalUser.fontScaleFactor) and globalUser.fontScaleFactor > 0
27+
scaledSize = currentSize * globalUser.fontScaleFactor
2728
m.top.sectionDividerFont.size = scaledSize
2829
end if
2930
end sub

docs/components_video_VideoPlayerView.bs.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,10 @@
578578
if m.top.content.contenttype <> 4 then return ' only display when content is type "Episode"
579579
if m.nextupbuttonseconds = 0 then return ' is the button disabled?
580580
if m.nextEpisodeButton.opacity <> 0 then return
581-
userSettings = m.global.user.settings
581+
globalUser = m.global.user
582+
userSettings = globalUser.settings
582583
if userSettings.playbackPlayNextEpisode = "disabled" then return
583-
if userSettings.playbackPlayNextEpisode = "webclient" and not m.global.user.config.enableNextEpisodeAutoPlay then return
584+
if userSettings.playbackPlayNextEpisode = "webclient" and not globalUser.config.enableNextEpisodeAutoPlay then return
584585

585586
' align button with bottom right edge with 5% padding
586587
boundingRect = m.notifyButtons.localBoundingRect()

docs/source_ShowScenes.bs.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,14 @@
270270
end sub
271271

272272
function CreateServerGroup()
273+
globalServer = m.global.server
273274
screen = CreateObject("roSGNode", "SetServerScreen")
274275
screen.optionsAvailable = true
275276
m.global.sceneManager.callFunc("pushScene", screen)
276277
port = CreateObject("roMessagePort")
277278

278-
if isValid(m.global.server.serverUrl)
279-
screen.serverUrl = m.global.server.serverUrl
279+
if isValid(globalServer.serverUrl)
280+
screen.serverUrl = globalServer.serverUrl
280281
end if
281282

282283
buttons = screen.findNode("buttons")
@@ -329,7 +330,7 @@
329330
set_setting("server", serverUrl)
330331
serverInfoResult = ServerInfo()
331332
'If this is a different server from what we know, reset username/password setting
332-
if m.global.server.serverUrl <> serverUrl
333+
if globalServer.serverUrl <> serverUrl
333334
set_setting("username", "")
334335
set_setting("password", "")
335336
end if

docs/source_VideoPlayer.bs.html

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
end function
3131

3232
sub AddVideoContent(video as object, mediaSourceId as dynamic, audio_stream_idx = 1 as integer, subtitle_idx = -1 as integer, playbackPosition = -1 as integer, forceTranscoding = false as boolean, showIntro = true as boolean, allowResumeDialog = true as boolean)
33+
globalUser = m.global.user
3334
video.content = createObject("RoSGNode", "ContentNode")
3435
meta = ItemMetaData(video.id)
3536
if not isValid(meta)
@@ -90,7 +91,7 @@
9091
params = {
9192
ids: video.Id
9293
}
93-
url = Substitute("Users/{0}/Items/", m.global.user.id)
94+
url = Substitute("Users/{0}/Items/", globalUser.id)
9495
resp = APIRequest(url, params)
9596
data = getJson(resp)
9697
for each item in data.Items
@@ -100,7 +101,7 @@
100101
params = {
101102
ids: m.series_id
102103
}
103-
url = Substitute("Users/{0}/Items/", m.global.user.id)
104+
url = Substitute("Users/{0}/Items/", globalUser.id)
104105
resp = APIRequest(url, params)
105106
data = getJson(resp)
106107
for each item in data.Items
@@ -117,7 +118,7 @@
117118
params = {
118119
ids: video.Id
119120
}
120-
url = Substitute("Users/{0}/Items/", m.global.user.id)
121+
url = Substitute("Users/{0}/Items/", globalUser.id)
121122
resp = APIRequest(url, params)
122123
data = getJson(resp)
123124
for each item in data.Items
@@ -128,7 +129,7 @@
128129
params = {
129130
ids: m.season_id
130131
}
131-
url = Substitute("Users/{0}/Items/", m.global.user.id)
132+
url = Substitute("Users/{0}/Items/", globalUser.id)
132133
resp = APIRequest(url, params)
133134
data = getJson(resp)
134135
for each item in data.Items
@@ -138,7 +139,7 @@
138139
params = {
139140
ids: m.series_id
140141
}
141-
url = Substitute("Users/{0}/Items/", m.global.user.id)
142+
url = Substitute("Users/{0}/Items/", globalUser.id)
142143
resp = APIRequest(url, params)
143144
data = getJson(resp)
144145
for each item in data.Items
@@ -155,7 +156,7 @@
155156
params = {
156157
ids: video.Id
157158
}
158-
url = Substitute("Users/{0}/Items/", m.global.user.id)
159+
url = Substitute("Users/{0}/Items/", globalUser.id)
159160
resp = APIRequest(url, params)
160161
data = getJson(resp)
161162
for each item in data.Items
@@ -225,7 +226,7 @@
225226
end if
226227

227228
subtitles = sortSubtitles(meta.id, m.playbackInfo.MediaSources[0].MediaStreams)
228-
if m.global.user.settings.playbackSubsOnlyText = true
229+
if globalUser.settings.playbackSubsOnlyText = true
229230
safesubs = []
230231
for each subtitle in subtitles["all"]
231232
if subtitle["IsTextSubtitleStream"]
@@ -260,8 +261,8 @@
260261
' Find first video stream - MediaStreams[0] might be subtitle/audio
261262
videoStream = getFirstVideoStream(m.playbackInfo.MediaSources[0].MediaStreams)
262263
if isValid(videoStream) and isValid(videoStream.codec)
263-
tryDirectPlay = m.global.user.settings.playbackTryDirectH264ProfileLevel = true and videoStream.codec = "h264"
264-
tryDirectPlay = tryDirectPlay or (m.global.user.settings.playbackTryDirectHevcProfileLevel = true and videoStream.codec = "hevc")
264+
tryDirectPlay = globalUser.settings.playbackTryDirectH264ProfileLevel = true and videoStream.codec = "h264"
265+
tryDirectPlay = tryDirectPlay or (globalUser.settings.playbackTryDirectHevcProfileLevel = true and videoStream.codec = "hevc")
265266
else
266267
tryDirectPlay = false
267268
end if

0 commit comments

Comments
 (0)