Adjust track number display logic

Shuffled Enabled: Shuffled Track Number / Total Tracks
Shuffled Disabled: Linear Track Number / Total Tracks
This commit is contained in:
1hitsong 2023-04-09 14:05:30 -04:00
parent ff0986a4e1
commit 52c9600a5d

View File

@ -112,7 +112,6 @@ sub setupInfoNodes()
m.playPosition = m.top.findNode("playPosition")
m.bufferPosition = m.top.findNode("bufferPosition")
m.seekBar = m.top.findNode("seekBar")
m.numberofsongsField = m.top.findNode("numberofsongs")
m.shuffleIndicator = m.top.findNode("shuffleIndicator")
m.loopIndicator = m.top.findNode("loopIndicator")
end sub
@ -339,13 +338,13 @@ function shuffleClicked() as boolean
m.shuffleIndicator.opacity = ".4"
m.shuffleIndicator.uri = m.shuffleIndicator.uri.Replace("-on", "-off")
m.global.queueManager.callFunc("setPosition", currentSongIndex)
setFieldTextValue("numberofsongs", "Track " + stri(m.global.queueManager.callFunc("getPosition") + 1) + "/" + stri(m.global.queueManager.callFunc("getCount")))
setTrackNumberDisplay()
return true
end if
m.shuffleIndicator.opacity = "1"
m.shuffleIndicator.uri = m.shuffleIndicator.uri.Replace("-off", "-on")
setTrackNumberDisplay()
return true
end function
@ -357,6 +356,10 @@ sub setShuffleIconState()
end if
end sub
sub setTrackNumberDisplay()
setFieldTextValue("numberofsongs", "Track " + stri(m.global.queueManager.callFunc("getPosition") + 1) + "/" + stri(m.global.queueManager.callFunc("getCount")))
end sub
sub LoadNextSong()
if m.global.audioPlayer.state = "playing"
m.global.audioPlayer.control = "stop"
@ -498,14 +501,8 @@ end sub
' Populate on screen text variables
sub setOnScreenTextValues(json)
if isValid(json)
currentSongIndex = m.global.queueManager.callFunc("getPosition")
if m.global.queueManager.callFunc("getIsShuffled")
currentSongIndex = findCurrentSongIndex(m.global.queueManager.callFunc("getUnshuffledQueue"))
end if
if m.playlistTypeCount = 1
setFieldTextValue("numberofsongs", "Track " + stri(currentSongIndex + 1) + "/" + stri(m.global.queueManager.callFunc("getCount")))
setTrackNumberDisplay()
end if
setFieldTextValue("artist", json.Artists[0])