- Add new migration to add an autoGenerateChapters column in the Podcasts table

- Bump minor version (I wasn't sure if this was needed for the migration)
- Feature is now controlled by the field in the podcast database object
- Move parsing code and tests to existing utils/parsers/ dir
- Add more test cases
This commit is contained in:
Harry Rose 2026-03-16 18:42:01 +00:00
parent 12b04faed2
commit 4907e70a48
10 changed files with 393 additions and 200 deletions

View file

@ -53,6 +53,8 @@ class Podcast extends Model {
this.maxEpisodesToKeep
/** @type {number} */
this.maxNewEpisodesToDownload
/** @type {boolean} */
this.autoGenerateChapters
/** @type {string} */
this.coverPath
/** @type {string[]} */
@ -106,6 +108,7 @@ class Podcast extends Model {
explicit: !!payload.metadata.explicit,
autoDownloadEpisodes: !!payload.autoDownloadEpisodes,
autoDownloadSchedule: autoDownloadSchedule || global.ServerSettings.podcastEpisodeSchedule,
autoGenerateChapters: !!payload.autoGenerateChapters,
lastEpisodeCheck: new Date(),
maxEpisodesToKeep: 0,
maxNewEpisodesToDownload: 3,
@ -145,6 +148,7 @@ class Podcast extends Model {
autoDownloadEpisodes: DataTypes.BOOLEAN,
autoDownloadSchedule: DataTypes.STRING,
lastEpisodeCheck: DataTypes.DATE,
autoGenerateChapters: DataTypes.BOOLEAN,
maxEpisodesToKeep: DataTypes.INTEGER,
maxNewEpisodesToDownload: DataTypes.INTEGER,
coverPath: DataTypes.STRING,
@ -273,6 +277,10 @@ class Podcast extends Model {
this.autoDownloadSchedule = payload.autoDownloadSchedule
hasUpdates = true
}
if (payload.autoGenerateChapters !== undefined && payload.autoGenerateChapters !== this.autoGenerateChapters) {
this.autoGenerateChapters = !!payload.autoGenerateChapters
hasUpdates = true
}
if (typeof payload.lastEpisodeCheck === 'number' && payload.lastEpisodeCheck !== this.lastEpisodeCheck?.valueOf()) {
this.lastEpisodeCheck = payload.lastEpisodeCheck
hasUpdates = true
@ -441,6 +449,7 @@ class Podcast extends Model {
autoDownloadEpisodes: this.autoDownloadEpisodes,
autoDownloadSchedule: this.autoDownloadSchedule,
lastEpisodeCheck: this.lastEpisodeCheck?.valueOf() || null,
autoGenerateChapters: this.autoGenerateChapters,
maxEpisodesToKeep: this.maxEpisodesToKeep,
maxNewEpisodesToDownload: this.maxNewEpisodesToDownload
}
@ -457,6 +466,7 @@ class Podcast extends Model {
autoDownloadEpisodes: this.autoDownloadEpisodes,
autoDownloadSchedule: this.autoDownloadSchedule,
lastEpisodeCheck: this.lastEpisodeCheck?.valueOf() || null,
autoGenerateChapters: this.autoGenerateChapters,
maxEpisodesToKeep: this.maxEpisodesToKeep,
maxNewEpisodesToDownload: this.maxNewEpisodesToDownload,
size: this.size
@ -481,6 +491,7 @@ class Podcast extends Model {
autoDownloadEpisodes: this.autoDownloadEpisodes,
autoDownloadSchedule: this.autoDownloadSchedule,
lastEpisodeCheck: this.lastEpisodeCheck?.valueOf() || null,
autoGenerateChapters: this.autoGenerateChapters,
maxEpisodesToKeep: this.maxEpisodesToKeep,
maxNewEpisodesToDownload: this.maxNewEpisodesToDownload,
size: this.size