Code cleanup
Some checks failed
Automation 🤖 / Project board 📊 (push) Has been cancelled
Automation 🤖 / Labeling 🏷️ (push) Has been cancelled
build-dev / dev (push) Has been cancelled

This commit is contained in:
Jimi 2024-11-18 15:14:26 -07:00
parent 89160be480
commit 0a419163e2
4 changed files with 17 additions and 17 deletions

View File

@ -51,23 +51,23 @@ sub loadItems()
id = m.top.itemId
mediaSourceId = invalid
audio_stream_idx = m.top.selectedAudioStreamIndex
if m.top.transcodeLiveTV = true
forceTranscoding = false
forceMP3Audio = false
if m.top.forceTranscodeMP3Audio = true
print "forcing retry of Live TV with transcoding..."
forceTranscoding = true
else
forceTranscoding = false
forceMP3Audio = true
end if
m.top.content = [LoadItems_VideoPlayer(id, mediaSourceId, audio_stream_idx, forceTranscoding)]
m.top.content = [LoadItems_VideoPlayer(id, mediaSourceId, audio_stream_idx, forceTranscoding, forceMP3Audio)]
end sub
function LoadItems_VideoPlayer(id as string, mediaSourceId = invalid as dynamic, audio_stream_idx = 1 as integer, forceTranscoding = false as boolean) as dynamic
function LoadItems_VideoPlayer(id as string, mediaSourceId = invalid as dynamic, audio_stream_idx = 1 as integer, forceTranscoding = false as boolean, forceMP3Audio = false as boolean) as dynamic
video = {}
video.id = id
video.content = createObject("RoSGNode", "ContentNode")
LoadItems_AddVideoContent(video, mediaSourceId, audio_stream_idx, forceTranscoding)
LoadItems_AddVideoContent(video, mediaSourceId, audio_stream_idx, forceTranscoding, forceMP3Audio)
if video.content = invalid
return invalid
@ -76,7 +76,7 @@ function LoadItems_VideoPlayer(id as string, mediaSourceId = invalid as dynamic,
return video
end function
sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_stream_idx = 1 as integer, forceTranscoding = false as boolean)
sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_stream_idx = 1 as integer, forceTranscoding = false as boolean, forceMP3Audio = false as boolean)
meta = ItemMetaData(video.id)
if not isValid(meta)
@ -167,7 +167,7 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
if not isValid(mediaSourceId) then mediaSourceId = video.id
if meta.live then mediaSourceId = ""
m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, forceTranscoding)
m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, forceMP3Audio)
if not isValid(m.playbackInfo)
video.errorMsg = "Error loading playback info"
video.content = invalid
@ -184,7 +184,7 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
video.SelectedSubtitle = defaultSubtitleIndex
subtitle_idx = defaultSubtitleIndex
m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, forceTranscoding)
m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, forceMP3Audio)
if not isValid(m.playbackInfo)
video.errorMsg = "Error loading playback info"
video.content = invalid

View File

@ -21,6 +21,6 @@
<!-- Total records available from server-->
<field id="totalRecordCount" type="int" value="-1" />
<field id="content" type="array" />
<field id="transcodeLiveTV" type="boolean" value="false" />
<field id="forceTranscodeMP3Audio" type="boolean" value="false" />
</interface>
</component>

View File

@ -354,7 +354,7 @@ sub onAudioIndexChange()
end sub
sub RetryLiveTV()
m.LoadMetaDataTask.transcodeLiveTV = true
m.LoadMetaDataTask.forceTranscodeMP3Audio = true
m.LoadMetaDataTask.selectedSubtitleIndex = m.top.SelectedSubtitle
m.LoadMetaDataTask.selectedAudioStreamIndex = m.top.audioIndex
m.LoadMetaDataTask.itemId = m.currentItem.id

View File

@ -13,7 +13,7 @@ function ItemGetPlaybackInfo(id as string, startTimeTicks = 0 as longinteger)
return getJson(resp)
end function
function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioTrackIndex = -1 as integer, subtitleTrackIndex = -1 as integer, startTimeTicks = 0 as longinteger, forceLiveTVTranscode = false)
function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioTrackIndex = -1 as integer, subtitleTrackIndex = -1 as integer, startTimeTicks = 0 as longinteger, forceMP3 = false)
params = {
"UserId": m.global.session.user.id,
"StartTimeTicks": startTimeTicks,
@ -39,16 +39,16 @@ function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioT
myGLobal = m.global
if audioTrackIndex > -1 and myGLobal.session.video.json.MediaStreams <> invalid or forceLiveTVTranscode
if audioTrackIndex > -1 and myGLobal.session.video.json.MediaStreams <> invalid or forceMP3
selectedAudioStream = myGLobal.session.video.json.MediaStreams[audioTrackIndex]
if selectedAudioStream <> invalid or forceLiveTVTranscode
if selectedAudioStream <> invalid or forceMP3
params.AudioStreamIndex = audioTrackIndex
' force the server to transcode AAC profiles we don't support to MP3 instead of the usual AAC
' TODO: Remove this after server adds support for transcoding AAC from one profile to another
if forceLiveTVTranscode or selectedAudioStream.Codec <> invalid and LCase(selectedAudioStream.Codec) = "aac"
if forceLiveTVTranscode or selectedAudioStream.Profile <> invalid and LCase(selectedAudioStream.Profile) = "main" or LCase(selectedAudioStream.Profile) = "he-aac"
if forceMP3 or selectedAudioStream.Codec <> invalid and LCase(selectedAudioStream.Codec) = "aac"
if forceMP3 or selectedAudioStream.Profile <> invalid and LCase(selectedAudioStream.Profile) = "main" or LCase(selectedAudioStream.Profile) = "he-aac"
for each rule in deviceProfile.TranscodingProfiles
if rule.Container = "ts" or rule.Container = "mp4"
if rule.AudioCodec = "aac"