From 7f9eaa19b31556de11c33e737ee6b3c80a688e91 Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Wed, 16 Oct 2024 22:19:20 -0400 Subject: [PATCH] save m.global to local var to prevent deep copies --- components/GetPlaybackInfoTask.bs | 7 ++++--- components/WhatsNewDialog.bs | 5 +++-- components/photos/PhotoDetails.bs | 5 +++-- components/tvshows/TVListOptions.bs | 5 +++-- components/video/VideoPlayerView.bs | 14 ++++++++------ 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/components/GetPlaybackInfoTask.bs b/components/GetPlaybackInfoTask.bs index d93c602bb..ac2b8317e 100644 --- a/components/GetPlaybackInfoTask.bs +++ b/components/GetPlaybackInfoTask.bs @@ -9,14 +9,15 @@ sub init() end sub function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioTrackIndex = -1 as integer, startTimeTicks = 0 as longinteger) - currentView = m.global.sceneManager.callFunc("getActiveScene") - currentItem = m.global.queueManager.callFunc("getCurrentItem") + myGlobal = m.global + currentView = myGlobal.sceneManager.callFunc("getActiveScene") + currentItem = myGlobal.queueManager.callFunc("getCurrentItem") body = { "DeviceProfile": getDeviceProfile() } params = { - "UserId": m.global.session.user.id, + "UserId": myGlobal.session.user.id, "StartTimeTicks": currentItem.startingPoint, "IsPlayback": true, "AutoOpenLiveStream": true, diff --git a/components/WhatsNewDialog.bs b/components/WhatsNewDialog.bs index a556de8f8..c528c4d60 100644 --- a/components/WhatsNewDialog.bs +++ b/components/WhatsNewDialog.bs @@ -1,11 +1,12 @@ sub init() m.content = m.top.findNode("content") + appVersion = m.global.app.version setPalette() m.top.id = "OKDialog" m.top.height = 900 - m.top.title = tr("Welcome to version") + " " + m.global.app.version + m.top.title = tr("Welcome to version") + " " + appVersion m.top.buttons = [tr("OK")] dialogStyles = { @@ -27,7 +28,7 @@ sub init() textLine = m.content.CreateChild("StdDlgMultiStyleTextItem") textLine.drawingStyles = dialogStyles - textLine.text = tr("To view a complete list of changes visit") + " https://github.com/jellyfin/jellyfin-roku/releases/tag/v" + m.global.app.version + "" + textLine.text = tr("To view a complete list of changes visit") + " https://github.com/jellyfin/jellyfin-roku/releases/tag/v" + appVersion + "" end sub sub setPalette() diff --git a/components/photos/PhotoDetails.bs b/components/photos/PhotoDetails.bs index 07d16f67a..f6e9112f1 100644 --- a/components/photos/PhotoDetails.bs +++ b/components/photos/PhotoDetails.bs @@ -2,6 +2,7 @@ import "pkg:/source/utils/misc.bs" import "pkg:/source/utils/config.bs" sub init() + myGlobal = m.global m.top.optionsAvailable = true m.top.overhangVisible = false m.slideshowTimer = m.top.findNode("slideshowTimer") @@ -10,8 +11,8 @@ sub init() m.textBackground = m.top.findNode("background") m.statusTimer = m.top.findNode("statusTimer") m.statusTimer.observeField("fire", "statusUpdate") - m.slideshow = m.global.session.user.settings["photos.slideshow"] - m.random = m.global.session.user.settings["photos.random"] + m.slideshow = myGlobal.session.user.settings["photos.slideshow"] + m.random = myGlobal.session.user.settings["photos.random"] m.showStatusAnimation = m.top.findNode("showStatusAnimation") m.hideStatusAnimation = m.top.findNode("hideStatusAnimation") diff --git a/components/tvshows/TVListOptions.bs b/components/tvshows/TVListOptions.bs index 5cf169db6..aae28fcd8 100644 --- a/components/tvshows/TVListOptions.bs +++ b/components/tvshows/TVListOptions.bs @@ -17,8 +17,9 @@ sub init() m.audioNames = [] ' Set button colors to global - m.top.findNode("videoMenu").focusBitmapBlendColor = m.global.constants.colors.button - m.top.findNode("audioMenu").focusBitmapBlendColor = m.global.constants.colors.button + buttonColor = m.global.constants.colors.button + m.top.findNode("videoMenu").focusBitmapBlendColor = buttonColor + m.top.findNode("audioMenu").focusBitmapBlendColor = buttonColor ' Animation m.fadeAnim = m.top.findNode("fadeAnim") diff --git a/components/video/VideoPlayerView.bs b/components/video/VideoPlayerView.bs index 0182e1048..a79e47c9a 100644 --- a/components/video/VideoPlayerView.bs +++ b/components/video/VideoPlayerView.bs @@ -7,7 +7,8 @@ sub init() m.log = log.Logger("VideoPlayerView") ' Hide the overhang on init to prevent showing 2 clocks m.top.getScene().findNode("overhang").visible = false - m.currentItem = m.global.queueManager.callFunc("getCurrentItem") + myGlobal = m.global + m.currentItem = myGlobal.queueManager.callFunc("getCurrentItem") m.top.id = m.currentItem.id m.top.seekMode = "accurate" @@ -46,7 +47,7 @@ sub init() m.top.transcodeReasons = [] m.bufferCheckTimer.duration = 30 - if m.global.session.user.settings["ui.design.hideclock"] = true + if myGlobal.session.user.settings["ui.design.hideclock"] clockNode = findNodeBySubtype(m.top, "clock") if clockNode[0] <> invalid then clockNode[0].parent.removeChild(clockNode[0].node) end if @@ -55,7 +56,7 @@ sub init() m.nextEpisodeButton = m.top.findNode("nextEpisode") m.nextEpisodeButton.text = tr("Next Episode") m.nextEpisodeButton.setFocus(false) - m.nextupbuttonseconds = m.global.session.user.settings["playback.nextupbuttonseconds"].ToInt() + m.nextupbuttonseconds = myGlobal.session.user.settings["playback.nextupbuttonseconds"].ToInt() m.showNextEpisodeButtonAnimation = m.top.findNode("showNextEpisodeButton") m.hideNextEpisodeButtonAnimation = m.top.findNode("hideNextEpisodeButton") @@ -64,9 +65,10 @@ sub init() m.getNextEpisodeTask = createObject("roSGNode", "GetNextEpisodeTask") m.getNextEpisodeTask.observeField("nextEpisodeData", "onNextEpisodeDataLoaded") - m.top.retrievingBar.filledBarBlendColor = m.global.constants.colors.blue - m.top.bufferingBar.filledBarBlendColor = m.global.constants.colors.blue - m.top.trickPlayBar.filledBarBlendColor = m.global.constants.colors.blue + jellyfinBlue = myGlobal.constants.colors.blue + m.top.retrievingBar.filledBarBlendColor = jellyfinBlue + m.top.bufferingBar.filledBarBlendColor = jellyfinBlue + m.top.trickPlayBar.filledBarBlendColor = jellyfinBlue end sub ' handleChapterSkipAction: Handles user command to skip chapters in playing video