mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-31 13:51:30 +02:00
Merge pull request #4520 from advplyr/fix_podcast_session_track_index
Fix podcast episode track index null in playback session
This commit is contained in:
commit
0ae7340889
@ -288,7 +288,12 @@ class SessionController {
|
|||||||
return res.sendStatus(404)
|
return res.sendStatus(404)
|
||||||
}
|
}
|
||||||
|
|
||||||
const audioTrack = playbackSession.audioTracks.find((t) => t.index === audioTrackIndex)
|
let audioTrack = playbackSession.audioTracks.find((t) => toNumber(t.index, 1) === audioTrackIndex)
|
||||||
|
|
||||||
|
// Support clients passing 0 or 1 for podcast episode audio track index (handles old episodes pre-v2.21.0 having null index)
|
||||||
|
if (!audioTrack && playbackSession.mediaType === 'podcast' && audioTrackIndex === 0) {
|
||||||
|
audioTrack = playbackSession.audioTracks[0]
|
||||||
|
}
|
||||||
if (!audioTrack) {
|
if (!audioTrack) {
|
||||||
Logger.error(`[SessionController] Unable to find audio track with index=${audioTrackIndex}`)
|
Logger.error(`[SessionController] Unable to find audio track with index=${audioTrackIndex}`)
|
||||||
return res.sendStatus(404)
|
return res.sendStatus(404)
|
||||||
|
@ -185,6 +185,7 @@ class PodcastEpisode extends Model {
|
|||||||
const track = structuredClone(this.audioFile)
|
const track = structuredClone(this.audioFile)
|
||||||
track.startOffset = 0
|
track.startOffset = 0
|
||||||
track.title = this.audioFile.metadata.filename
|
track.title = this.audioFile.metadata.filename
|
||||||
|
track.index = 1 // Podcast episodes only have one track
|
||||||
track.contentUrl = `/api/items/${libraryItemId}/file/${track.ino}`
|
track.contentUrl = `/api/items/${libraryItemId}/file/${track.ino}`
|
||||||
return track
|
return track
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user