Skip to content

Commit 59749b1

Browse files
chore(docs): update code docs
1 parent 888e4d9 commit 59749b1

14 files changed

Lines changed: 213 additions & 125 deletions

docs/components_ItemGrid_ItemGridOptions.bs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,12 @@
214214
m.favoriteMenu.iconUri = "pkg:/images/icons/favorite_selected.png"
215215
m.favoriteMenu.focusedIconUri = "pkg:/images/icons/favorite_selected.png"
216216
req = GetApi().BuildMarkFavoriteRequest(m.selectedFavoriteItem.id)
217-
if isValid(req) then SubmitSideEffect(req)
217+
SubmitSideEffect(req)
218218
else
219219
m.favoriteMenu.iconUri = "pkg:/images/icons/favorite.png"
220220
m.favoriteMenu.focusedIconUri = "pkg:/images/icons/favorite.png"
221221
req = GetApi().BuildUnmarkFavoriteRequest(m.selectedFavoriteItem.id)
222-
if isValid(req) then SubmitSideEffect(req)
222+
SubmitSideEffect(req)
223223
end if
224224
' Make sure we set the Favorite Heart color for the appropriate child
225225
setHeartColor("#cc3333")

docs/components_ItemGrid_LoadVideoContentTask.bs.html

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,14 @@
404404
end if
405405
' Get transcoding reason
406406
video.transcodeReasons = getTranscodeReasons(m.playbackInfo.MediaSources[0].TranscodingUrl)
407-
video.content.url = buildURL(m.playbackInfo.MediaSources[0].TranscodingUrl)
407+
transcodingUrl = buildURL(m.playbackInfo.MediaSources[0].TranscodingUrl)
408+
if not isValid(transcodingUrl)
409+
m.log.error("Failed to build transcoding URL — server URL not set", "itemId", video.id)
410+
m.top.errorMsg = translate(translationKeys.ErrorAnErrorWasEncounteredWhilePlaying)
411+
video.content = invalid
412+
return
413+
end if
414+
video.content.url = transcodingUrl
408415
video.isTranscoded = true
409416

410417
' If DoVi preservation caused this transcode, flag that direct play is a viable buffer-overflow fallback.
@@ -449,9 +456,21 @@
449456
' if the domain of the URI is local to the server,
450457
' create a new URI by appending the received path to the server URL
451458
' later we will substitute the users provided URL for this case
452-
if isValid(uri[4])
453-
video.content.url = buildURL(uri[4])
459+
if not isValid(uri[4])
460+
m.log.error("Localhost stream has no path component", "sourceUrl", m.playbackInfo.MediaSources[0].Path)
461+
m.top.errorMsg = translate(translationKeys.ErrorAnErrorWasEncounteredWhilePlaying)
462+
video.content = invalid
463+
return
464+
end if
465+
466+
localUrl = buildURL(uri[4])
467+
if not isValid(localUrl)
468+
m.log.error("Failed to build localhost stream URL — server URL not set", "path", uri[4])
469+
m.top.errorMsg = translate(translationKeys.ErrorAnErrorWasEncounteredWhilePlaying)
470+
video.content = invalid
471+
return
454472
end if
473+
video.content.url = localUrl
455474
else
456475
' External stream - use raw URL without modification
457476
fullyExternal = true
@@ -470,7 +489,14 @@
470489
params.MediaSourceId = mediaSourceId
471490
end if
472491

473-
video.content.url = buildURL(Substitute("Videos/{0}/stream", video.id), params)
492+
streamUrl = buildURL(Substitute("Videos/{0}/stream", video.id), params)
493+
if not isValid(streamUrl)
494+
m.log.error("Failed to build stream URL — server URL not set", "itemId", video.id)
495+
m.top.errorMsg = translate(translationKeys.ErrorAnErrorWasEncounteredWhilePlaying)
496+
video.content = invalid
497+
return
498+
end if
499+
video.content.url = streamUrl
474500
end if
475501

476502
' Apply Jellyfin authentication only for internal streams

docs/components_api_ApiTask.bs.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@
6767
end if
6868
end if
6969

70+
if not isValid(req.url) or req.url = ""
71+
print "[ApiTask] request rejected: url is invalid or empty"
72+
return {
73+
requestId: req.requestId,
74+
ok: false,
75+
statusCode: 0,
76+
json: invalid,
77+
text: ""
78+
}
79+
end if
80+
7081
r = rr_Requests().request(method, req.url, args)
7182

7283
return {

docs/components_api_SideEffectTask.bs.html

Lines changed: 5 additions & 0 deletions
Large diffs are not rendered by default.

docs/components_mediaPlayers_AudioPlayer.bs.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/components_tasks_FontDownloadTask.bs.html

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@
1515
authArgs = { headers: { Authorization: buildAuthHeader() }, timeout: 10000, useCache: false }
1616

1717
' Check if server supports fallback fonts
18-
r = rr_Requests().get(buildURL("/system/configuration/encoding"), authArgs)
18+
encodingUrl = buildURL("/system/configuration/encoding")
19+
if not isValid(encodingUrl)
20+
print "FontDownloadTask: Cannot build URL — server URL not set"
21+
m.top.errorMessage = "Server URL not configured"
22+
m.top.isFontDownloadSuccess = false
23+
m.top.isFontDownloadCompleted = true
24+
return
25+
end if
26+
r = rr_Requests().get(encodingUrl, authArgs)
1927
if not r.ok or not isValid(r.json) or not r.json.EnableFallbackFont
2028
print "FontDownloadTask: Server does not support fallback fonts"
2129
m.top.errorMessage = "Server does not support fallback fonts"
@@ -26,7 +34,15 @@
2634

2735
' Get list of available fonts
2836
re = CreateObject("roRegex", "Name.:.(.*?).,.Size", "s")
29-
r = rr_Requests().get(buildURL("FallbackFont/Fonts"), authArgs)
37+
fontsUrl = buildURL("FallbackFont/Fonts")
38+
if not isValid(fontsUrl)
39+
print "FontDownloadTask: Cannot build URL — server URL not set"
40+
m.top.errorMessage = "Server URL not configured"
41+
m.top.isFontDownloadSuccess = false
42+
m.top.isFontDownloadCompleted = true
43+
return
44+
end if
45+
r = rr_Requests().get(fontsUrl, authArgs)
3046
if not r.ok or r.text = ""
3147
print "FontDownloadTask: Failed to get font list from server"
3248
m.top.errorMessage = "Failed to get font list from server"

docs/components_video_VideoPlayerView.bs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,7 @@
13871387

13881388
' Report playstate via side-effect task
13891389
req = GetApi().BuildPlaystateRequest(state, params)
1390-
if isValid(req) then SubmitSideEffect(req)
1390+
SubmitSideEffect(req)
13911391

13921392
m.log.debug("end ReportPlayback", state, int(m.top.position))
13931393
end sub

docs/module-ApiClient.ApiClient.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/module-ApiClient.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/module-apiPool.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)