diff --git a/server/models/PodcastEpisode.js b/server/models/PodcastEpisode.js index 7c107a87..fdef2c50 100644 --- a/server/models/PodcastEpisode.js +++ b/server/models/PodcastEpisode.js @@ -91,8 +91,12 @@ class PodcastEpisode extends Model { Logger.debug("[PodcastEpisode] New episode doesn't have chapters, attempting to generate them from timestamps", rssPodcastEpisode.title) try { podcastEpisode.chapters = parsePodcastDescriptionForChapters.parse(podcastEpisode.description, podcastEpisode.audioFile.duration) + + if (podcastEpisode.chapters.length > 0) { + Logger.info(`[PodcastEpisode] Successfully generated ${podcastEpisode.chapters.length} chapters`) + } } catch (error) { - Logger.error(`[PodcastEpisode] createFromRssPodcastEpisode: Failed to auto generate chapters for "${podcastEpisode.title}"`, error) + Logger.error(`[PodcastEpisode] createFromRssPodcastEpisode: Failed to generate chapters for "${podcastEpisode.title}"`, error) } } diff --git a/server/utils/parsers/parsePodcastDescriptionForChapters.js b/server/utils/parsers/parsePodcastDescriptionForChapters.js index 53585d64..1fa59f83 100644 --- a/server/utils/parsers/parsePodcastDescriptionForChapters.js +++ b/server/utils/parsers/parsePodcastDescriptionForChapters.js @@ -36,6 +36,12 @@ module.exports.parse = (podcastDescription, audioDurationSecs) => { // Split on "
", "Introduction text paragraph 1
Introduction text paragraph 2
' + let chapters = parsePodcastDescriptionForChapters.parse(description, 1000) + + expect(chapters).to.be.empty + expect(loggerDebugStub.calledWith('No timestamps found in description, bailing out early')).to.be.true + + sinon.restore() + }) + var testCasesTestingSuccess = [ { testName: 'Should handle descriptions using html paragraphs',