PR comments

This commit is contained in:
Jimi 2023-05-11 21:57:15 -06:00
parent 85fba65c3b
commit c140e15c4b
2 changed files with 9 additions and 9 deletions

View File

@ -121,9 +121,10 @@ sub Main (args as dynamic) as void
itemNode = reportingNode.quickPlayNode
if isValid(itemNode) and isValid(itemNode.id) and itemNode.id <> ""
if itemNode.type = "Episode" or itemNode.type = "Movie" or itemNode.type = "Video"
audio_stream_idx = 0
if isValid(itemNode.selectedAudioStreamIndex) and itemNode.selectedAudioStreamIndex > 0
audio_stream_idx = itemNode.selectedAudioStreamIndex
else
else if isValid(itemNode.json) and isValid(itemNode.json.MediaStreams)
audio_stream_idx = FindPreferredAudioStream(itemNode.json.MediaStreams)
end if
@ -187,9 +188,10 @@ sub Main (args as dynamic) as void
sceneManager.callFunc("pushScene", group)
else if selectedItemType = "Episode"
' User has selected a TV episode they want us to play
audio_stream_idx = 0
if isValid(selectedItem.selectedAudioStreamIndex) and selectedItem.selectedAudioStreamIndex > 0
audio_stream_idx = selectedItem.selectedAudioStreamIndex
else
else if isValid(selectedItem.json) and isValid(selectedItem.json.id)
audio_stream_idx = FindPreferredAudioStream(invalid, selectedItem.json.id)
end if

View File

@ -845,12 +845,10 @@ function FindPreferredAudioStream(streams as dynamic, id = "" as string) as inte
url = Substitute("Users/{0}/Items/{1}", m.user.id, id)
resp = APIRequest(url)
jsonResponse = getJson(resp)
if jsonResponse <> invalid and jsonResponse.MediaStreams <> invalid
streams = jsonResponse.MediaStreams
else
' we can't find the streams? return the default track
return 1
end if
if jsonResponse = invalid or jsonResponse.MediaStreams = invalid then return 1
streams = jsonResponse.MediaStreams
end if
if playDefault <> invalid and playDefault = true
@ -859,7 +857,7 @@ function FindPreferredAudioStream(streams as dynamic, id = "" as string) as inte
if preferredLanguage <> invalid
for i = 0 to streams.Count() - 1
if streams[i].Type = "Audio" and streams[i].Language = preferredLanguage
if LCase(streams[i].Type) = "audio" and LCase(streams[i].Language) = LCase(preferredLanguage)
return i
end if
end for