mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-31 21:51:41 +00:00
Compare commits
No commits in common. "6caa1aa2da450eb5a94daefa0feaedf9fa873d23" and "96d4021a3cd45f67bf374b65abafbe5d73e926b5" have entirely different histories.
6caa1aa2da
...
96d4021a3c
1 changed files with 2 additions and 12 deletions
|
|
@ -58,12 +58,8 @@ class PodcastScanner {
|
||||||
/** @type {AudioFile[]} */
|
/** @type {AudioFile[]} */
|
||||||
let newAudioFiles = []
|
let newAudioFiles = []
|
||||||
|
|
||||||
// Track episode add/remove/update so item_updated includes the current episode list
|
|
||||||
let hasEpisodeChanges = false
|
|
||||||
|
|
||||||
if (libraryItemData.hasAudioFileChanges || libraryItemData.audioLibraryFiles.length !== existingPodcastEpisodes.length) {
|
if (libraryItemData.hasAudioFileChanges || libraryItemData.audioLibraryFiles.length !== existingPodcastEpisodes.length) {
|
||||||
// Filter out and destroy episodes that were removed.
|
// Filter out and destroy episodes that were removed
|
||||||
// filter() returns a new array — reassign to media.podcastEpisodes before emit.
|
|
||||||
const episodesToRemove = []
|
const episodesToRemove = []
|
||||||
existingPodcastEpisodes = existingPodcastEpisodes.filter((ep) => {
|
existingPodcastEpisodes = existingPodcastEpisodes.filter((ep) => {
|
||||||
if (libraryItemData.checkAudioFileRemoved(ep.audioFile)) {
|
if (libraryItemData.checkAudioFileRemoved(ep.audioFile)) {
|
||||||
|
|
@ -74,7 +70,6 @@ class PodcastScanner {
|
||||||
})
|
})
|
||||||
|
|
||||||
if (episodesToRemove.length) {
|
if (episodesToRemove.length) {
|
||||||
hasEpisodeChanges = true
|
|
||||||
// Remove episodes from playlists and media progress
|
// Remove episodes from playlists and media progress
|
||||||
const episodeIds = episodesToRemove.map((ep) => ep.id)
|
const episodeIds = episodesToRemove.map((ep) => ep.id)
|
||||||
await Database.playlistModel.removeMediaItemsFromPlaylists(episodeIds)
|
await Database.playlistModel.removeMediaItemsFromPlaylists(episodeIds)
|
||||||
|
|
@ -121,7 +116,6 @@ class PodcastScanner {
|
||||||
AudioFileScanner.setPodcastEpisodeMetadataFromAudioMetaTags(podcastEpisode, libraryScan)
|
AudioFileScanner.setPodcastEpisodeMetadataFromAudioMetaTags(podcastEpisode, libraryScan)
|
||||||
libraryScan.addLog(LogLevel.INFO, `Podcast episode "${podcastEpisode.title}" keys changed [${podcastEpisode.changed()?.join(', ')}]`)
|
libraryScan.addLog(LogLevel.INFO, `Podcast episode "${podcastEpisode.title}" keys changed [${podcastEpisode.changed()?.join(', ')}]`)
|
||||||
await podcastEpisode.save()
|
await podcastEpisode.save()
|
||||||
hasEpisodeChanges = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,13 +155,9 @@ class PodcastScanner {
|
||||||
libraryScan.addLog(LogLevel.INFO, `New Podcast episode "${newPodcastEpisode.title}" added`)
|
libraryScan.addLog(LogLevel.INFO, `New Podcast episode "${newPodcastEpisode.title}" added`)
|
||||||
await newPodcastEpisode.save()
|
await newPodcastEpisode.save()
|
||||||
existingPodcastEpisodes.push(newPodcastEpisode)
|
existingPodcastEpisodes.push(newPodcastEpisode)
|
||||||
hasEpisodeChanges = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep association in sync for toOldJSONExpanded() / item_updated socket payload
|
|
||||||
media.podcastEpisodes = existingPodcastEpisodes
|
|
||||||
|
|
||||||
let hasMediaChanges = false
|
let hasMediaChanges = false
|
||||||
if (existingPodcastEpisodes.length !== media.numEpisodes) {
|
if (existingPodcastEpisodes.length !== media.numEpisodes) {
|
||||||
media.numEpisodes = existingPodcastEpisodes.length
|
media.numEpisodes = existingPodcastEpisodes.length
|
||||||
|
|
@ -260,7 +250,7 @@ class PodcastScanner {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
libraryItem: existingLibraryItem,
|
libraryItem: existingLibraryItem,
|
||||||
wasUpdated: hasMediaChanges || libraryItemUpdated || hasEpisodeChanges
|
wasUpdated: hasMediaChanges || libraryItemUpdated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue