mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-06-21 10:01:33 +00:00
Merge pull request #5318 from mikiher/match-update-episode-enclosure
Enhance PodcastController to handle enclosure updates
This commit is contained in:
commit
9b92b5de34
1 changed files with 11 additions and 0 deletions
|
|
@ -437,6 +437,17 @@ class PodcastController {
|
|||
}
|
||||
|
||||
updatePayload[key] = req.body[key]
|
||||
} else if (key === 'enclosure') {
|
||||
const enclosure = req.body.enclosure
|
||||
if (enclosure === null) {
|
||||
updatePayload.enclosureURL = null
|
||||
updatePayload.enclosureSize = null
|
||||
updatePayload.enclosureType = null
|
||||
} else if (typeof enclosure === 'object' && typeof enclosure.url === 'string') {
|
||||
updatePayload.enclosureURL = enclosure.url
|
||||
updatePayload.enclosureType = typeof enclosure.type === 'string' ? enclosure.type : null
|
||||
updatePayload.enclosureSize = enclosure.length !== undefined && enclosure.length !== null ? enclosure.length : null
|
||||
}
|
||||
} else if (key === 'chapters' && Array.isArray(req.body[key]) && req.body[key].every((ch) => typeof ch === 'object' && ch.title && ch.start)) {
|
||||
updatePayload[key] = req.body[key]
|
||||
} else if (key === 'publishedAt' && typeof req.body[key] === 'number') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue