mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-02-19 00:18:56 +01:00
Resolved a server crash when a playback session lacked associated media metadata.
This commit is contained in:
parent
3b4a5b8785
commit
7486d6345d
@ -127,20 +127,20 @@ module.exports = {
|
|||||||
bookListeningMap[ls.displayTitle] += listeningSessionListeningTime
|
bookListeningMap[ls.displayTitle] += listeningSessionListeningTime
|
||||||
}
|
}
|
||||||
|
|
||||||
const authors = ls.mediaMetadata.authors || []
|
const authors = ls.mediaMetadata?.authors || []
|
||||||
authors.forEach((au) => {
|
authors.forEach((au) => {
|
||||||
if (!authorListeningMap[au.name]) authorListeningMap[au.name] = 0
|
if (!authorListeningMap[au.name]) authorListeningMap[au.name] = 0
|
||||||
authorListeningMap[au.name] += listeningSessionListeningTime
|
authorListeningMap[au.name] += listeningSessionListeningTime
|
||||||
})
|
})
|
||||||
|
|
||||||
const narrators = ls.mediaMetadata.narrators || []
|
const narrators = ls.mediaMetadata?.narrators || []
|
||||||
narrators.forEach((narrator) => {
|
narrators.forEach((narrator) => {
|
||||||
if (!narratorListeningMap[narrator]) narratorListeningMap[narrator] = 0
|
if (!narratorListeningMap[narrator]) narratorListeningMap[narrator] = 0
|
||||||
narratorListeningMap[narrator] += listeningSessionListeningTime
|
narratorListeningMap[narrator] += listeningSessionListeningTime
|
||||||
})
|
})
|
||||||
|
|
||||||
// Filter out bad genres like "audiobook" and "audio book"
|
// Filter out bad genres like "audiobook" and "audio book"
|
||||||
const genres = (ls.mediaMetadata.genres || []).filter((g) => g && !g.toLowerCase().includes('audiobook') && !g.toLowerCase().includes('audio book'))
|
const genres = (ls.mediaMetadata?.genres || []).filter((g) => g && !g.toLowerCase().includes('audiobook') && !g.toLowerCase().includes('audio book'))
|
||||||
genres.forEach((genre) => {
|
genres.forEach((genre) => {
|
||||||
if (!genreListeningMap[genre]) genreListeningMap[genre] = 0
|
if (!genreListeningMap[genre]) genreListeningMap[genre] = 0
|
||||||
genreListeningMap[genre] += listeningSessionListeningTime
|
genreListeningMap[genre] += listeningSessionListeningTime
|
||||||
|
Loading…
Reference in New Issue
Block a user