Podcast episode player fixes, episode table ui updates

This commit is contained in:
advplyr 2022-03-26 18:23:33 -05:00
parent 0e665e2091
commit 12027b9a76
13 changed files with 47 additions and 22 deletions

View file

@ -62,6 +62,7 @@ class PodcastController {
// Download and save cover image
if (payload.media.metadata.imageUrl) {
// TODO: Scan cover image to library files
var coverResponse = await this.coverManager.downloadCoverFromUrl(libraryItem, payload.media.metadata.imageUrl)
if (coverResponse) {
if (coverResponse.error) {

View file

@ -84,9 +84,11 @@ class PodcastManager {
Logger.error(`[PodcastManager] Podcast Episode finished but library item was not found ${this.currentDownload.libraryItem.id}`)
return false
}
var podcastEpisode = this.currentDownload.podcastEpisode
podcastEpisode.audioFile = audioFile
libraryItem.media.addPodcastEpisode(podcastEpisode)
libraryItem.libraryFiles.push(libraryFile)
libraryItem.updatedAt = Date.now()
await this.db.updateLibraryItem(libraryItem)
this.emitter('item_updated', libraryItem.toJSONExpanded())

View file

@ -24,7 +24,7 @@ class PodcastEpisodeDownload {
}
get targetRelPath() {
return Path.join(this.libraryItem.relPath, this.targetFilename)
return this.targetFilename
}
setData(podcastEpisode, libraryItem) {

View file

@ -1,5 +1,5 @@
const Path = require('path')
const { encodeUriPath } = require('../../utils/index')
class AudioTrack {
constructor() {
this.index = null
@ -26,7 +26,7 @@ class AudioTrack {
this.startOffset = startOffset
this.duration = audioFile.duration
this.title = audioFile.metadata.filename || ''
this.contentUrl = Path.join(`/s/item/${itemId}`, audioFile.metadata.relPath)
this.contentUrl = Path.join(`/s/item/${itemId}`, encodeUriPath(audioFile.metadata.relPath))
this.mimeType = audioFile.mimeType
}

View file

@ -1,3 +1,4 @@
const Logger = require('../../Logger')
const PodcastEpisode = require('../entities/PodcastEpisode')
const PodcastMetadata = require('../metadata/PodcastMetadata')
const { areEquivalent, copyValue } = require('../../utils/index')

View file

@ -18,6 +18,7 @@ class StaticRouter {
var remainingPath = req.params['0']
var fullPath = Path.join(item.path, remainingPath)
console.log('fullpath', fullPath)
res.sendFile(fullPath)
})
}

View file

@ -117,4 +117,8 @@ module.exports.copyValue = (val) => {
}
return final
}
}
module.exports.encodeUriPath = (path) => {
return path.replace(/\\/g, '/').replace(/%/g, '%25').replace(/#/g, '%23')
}