Skip to content

Commit

Permalink
save m.global to local var to prevent deep copies
Browse files Browse the repository at this point in the history
  • Loading branch information
cewert committed Oct 17, 2024
1 parent 7d8628a commit 7f9eaa1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
7 changes: 4 additions & 3 deletions components/GetPlaybackInfoTask.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions components/WhatsNewDialog.bs
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -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") + " <url>https://github.com/jellyfin/jellyfin-roku/releases/tag/v" + m.global.app.version + "</url>"
textLine.text = tr("To view a complete list of changes visit") + " <url>https://github.com/jellyfin/jellyfin-roku/releases/tag/v" + appVersion + "</url>"
end sub

sub setPalette()
Expand Down
5 changes: 3 additions & 2 deletions components/photos/PhotoDetails.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down
5 changes: 3 additions & 2 deletions components/tvshows/TVListOptions.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
14 changes: 8 additions & 6 deletions components/video/VideoPlayerView.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -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
Expand Down

0 comments on commit 7f9eaa1

Please sign in to comment.