mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-20 13:53:19 +01:00
Fix podcast episode playback session duration, use podcast episode plaintext description
This commit is contained in:
@@ -136,9 +136,14 @@ class PlaybackSession {
|
||||
this.mediaMetadata = libraryItem.media.metadata.clone()
|
||||
this.chapters = (libraryItem.media.chapters || []).map(c => ({ ...c })) // Only book mediaType has chapters
|
||||
this.displayTitle = libraryItem.media.getPlaybackTitle(episodeId)
|
||||
this.displayAuthor = libraryItem.media.getPlaybackAuthor(episodeId)
|
||||
this.displayAuthor = libraryItem.media.getPlaybackAuthor()
|
||||
this.coverPath = libraryItem.media.coverPath
|
||||
this.duration = libraryItem.media.duration
|
||||
|
||||
if (episodeId) {
|
||||
this.duration = libraryItem.media.getEpisodeDuration(episodeId)
|
||||
} else {
|
||||
this.duration = libraryItem.media.duration
|
||||
}
|
||||
|
||||
this.mediaPlayer = mediaPlayer
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
const { stripHtml } = require('string-strip-html')
|
||||
const { getId } = require('../../utils/index')
|
||||
const AudioFile = require('../files/AudioFile')
|
||||
const AudioTrack = require('../files/AudioTrack')
|
||||
@@ -73,7 +74,8 @@ class PodcastEpisode {
|
||||
episodeType: this.episodeType,
|
||||
title: this.title,
|
||||
subtitle: this.subtitle,
|
||||
description: this.description,
|
||||
// description: this.description,
|
||||
description: this.descriptionPlain, // Temporary stripping HTML until proper cleaning is implemented
|
||||
enclosure: this.enclosure ? { ...this.enclosure } : null,
|
||||
pubDate: this.pubDate,
|
||||
audioFile: this.audioFile.toJSON(),
|
||||
@@ -102,6 +104,10 @@ class PodcastEpisode {
|
||||
if (this.episode) return `${this.episode} - ${this.title}`
|
||||
return this.title
|
||||
}
|
||||
get descriptionPlain() {
|
||||
if (!this.description) return ''
|
||||
return stripHtml(this.description).result
|
||||
}
|
||||
|
||||
setData(data, index = 1) {
|
||||
this.id = getId('ep')
|
||||
|
||||
@@ -251,5 +251,11 @@ class Podcast {
|
||||
getPlaybackAuthor() {
|
||||
return this.metadata.author
|
||||
}
|
||||
|
||||
getEpisodeDuration(episodeId) {
|
||||
var episode = this.episodes.find(ep => ep.id == episodeId)
|
||||
if (!episode) return 0
|
||||
return episode.duration
|
||||
}
|
||||
}
|
||||
module.exports = Podcast
|
||||
Reference in New Issue
Block a user