From 7207efb4da4132cf4edc8aeca1e530cff9840d37 Mon Sep 17 00:00:00 2001 From: Philipp Rintz <13933258+p-rintz@users.noreply.github.com> Date: Tue, 14 Feb 2023 16:41:58 +0100 Subject: [PATCH 1/4] Add library tags variable to podcast notifications --- server/managers/NotificationManager.js | 1 + server/utils/notifications.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/managers/NotificationManager.js b/server/managers/NotificationManager.js index e13e99f9..943c66ea 100644 --- a/server/managers/NotificationManager.js +++ b/server/managers/NotificationManager.js @@ -24,6 +24,7 @@ class NotificationManager { libraryItemId: libraryItem.id, libraryId: libraryItem.libraryId, libraryName: library ? library.name : 'Unknown', + libraryTags: libraryItem.tags, podcastTitle: libraryItem.media.metadata.title, episodeId: episode.id, episodeTitle: episode.title diff --git a/server/utils/notifications.js b/server/utils/notifications.js index c5049d73..02b74631 100644 --- a/server/utils/notifications.js +++ b/server/utils/notifications.js @@ -7,8 +7,7 @@ module.exports.notificationData = { requiresLibrary: true, libraryMediaType: 'podcast', description: 'Triggered when a podcast episode is auto-downloaded', - variables: ['libraryItemId', 'libraryId', 'podcastTitle', 'episodeTitle', 'libraryName', 'episodeId'], - defaults: { + variables: ['libraryItemId', 'libraryId', 'podcastTitle', 'episodeTitle', 'libraryName', 'episodeId', 'libraryTags'], defaults: { title: 'New {{podcastTitle}} Episode!', body: '{{episodeTitle}} has been added to {{libraryName}} library.' }, @@ -16,6 +15,7 @@ module.exports.notificationData = { libraryItemId: 'li_notification_test', libraryId: 'lib_test', libraryName: 'Podcasts', + libraryTags: ['TestTag1', 'TestTag2'], podcastTitle: 'Abs Test Podcast', episodeId: 'ep_notification_test', episodeTitle: 'Successful Test' From a08cfa436e6b0d829ef3b4fc5f8f774fa0f07f6a Mon Sep 17 00:00:00 2001 From: Philipp Rintz <13933258+p-rintz@users.noreply.github.com> Date: Tue, 14 Feb 2023 16:51:20 +0100 Subject: [PATCH 2/4] Fix code formatting --- server/utils/notifications.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/utils/notifications.js b/server/utils/notifications.js index 02b74631..99513e0d 100644 --- a/server/utils/notifications.js +++ b/server/utils/notifications.js @@ -7,7 +7,8 @@ module.exports.notificationData = { requiresLibrary: true, libraryMediaType: 'podcast', description: 'Triggered when a podcast episode is auto-downloaded', - variables: ['libraryItemId', 'libraryId', 'podcastTitle', 'episodeTitle', 'libraryName', 'episodeId', 'libraryTags'], defaults: { + variables: ['libraryItemId', 'libraryId', 'podcastTitle', 'episodeTitle', 'libraryName', 'episodeId', 'libraryTags'], + defaults: { title: 'New {{podcastTitle}} Episode!', body: '{{episodeTitle}} has been added to {{libraryName}} library.' }, @@ -35,4 +36,4 @@ module.exports.notificationData = { } } ] -} \ No newline at end of file +} From e345c4cc9e1124398477336569db76b7f17240f2 Mon Sep 17 00:00:00 2001 From: Philipp Rintz <13933258+p-rintz@users.noreply.github.com> Date: Wed, 15 Feb 2023 00:00:34 +0100 Subject: [PATCH 3/4] Correct the libraryTags variable --- server/managers/NotificationManager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/managers/NotificationManager.js b/server/managers/NotificationManager.js index 943c66ea..dacf0bdb 100644 --- a/server/managers/NotificationManager.js +++ b/server/managers/NotificationManager.js @@ -24,7 +24,7 @@ class NotificationManager { libraryItemId: libraryItem.id, libraryId: libraryItem.libraryId, libraryName: library ? library.name : 'Unknown', - libraryTags: libraryItem.tags, + libraryTags: libraryItem.media.tags, podcastTitle: libraryItem.media.metadata.title, episodeId: episode.id, episodeTitle: episode.title @@ -111,4 +111,4 @@ class NotificationManager { }) } } -module.exports = NotificationManager \ No newline at end of file +module.exports = NotificationManager From 4039dc7968b3c5378bae9cdeb0027ed2dbf314b5 Mon Sep 17 00:00:00 2001 From: advplyr Date: Wed, 15 Feb 2023 15:57:04 -0600 Subject: [PATCH 4/4] Podcast episode download notification adding variables for mediaTags, podcastAuthor, podcastDescription, podcastGenres, episodeTitle, episodeSubtitle, episodeDescription --- server/managers/NotificationManager.js | 9 +++++++-- server/utils/notifications.js | 11 ++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/server/managers/NotificationManager.js b/server/managers/NotificationManager.js index dacf0bdb..3a70ce8e 100644 --- a/server/managers/NotificationManager.js +++ b/server/managers/NotificationManager.js @@ -24,10 +24,15 @@ class NotificationManager { libraryItemId: libraryItem.id, libraryId: libraryItem.libraryId, libraryName: library ? library.name : 'Unknown', - libraryTags: libraryItem.media.tags, + mediaTags: (libraryItem.media.tags || []).join(', '), podcastTitle: libraryItem.media.metadata.title, + podcastAuthor: libraryItem.media.metadata.author || '', + podcastDescription: libraryItem.media.metadata.description || '', + podcastGenres: (libraryItem.media.metadata.genres || []).join(', '), episodeId: episode.id, - episodeTitle: episode.title + episodeTitle: episode.title, + episodeSubtitle: episode.subtitle || '', + episodeDescription: episode.description || '' } this.triggerNotification('onPodcastEpisodeDownloaded', eventData) } diff --git a/server/utils/notifications.js b/server/utils/notifications.js index 99513e0d..c90e3408 100644 --- a/server/utils/notifications.js +++ b/server/utils/notifications.js @@ -7,7 +7,7 @@ module.exports.notificationData = { requiresLibrary: true, libraryMediaType: 'podcast', description: 'Triggered when a podcast episode is auto-downloaded', - variables: ['libraryItemId', 'libraryId', 'podcastTitle', 'episodeTitle', 'libraryName', 'episodeId', 'libraryTags'], + variables: ['libraryItemId', 'libraryId', 'podcastTitle', 'podcastAuthor', 'podcastDescription', 'podcastGenres', 'episodeTitle', 'episodeSubtitle', 'episodeDescription', 'libraryName', 'episodeId', 'mediaTags'], defaults: { title: 'New {{podcastTitle}} Episode!', body: '{{episodeTitle}} has been added to {{libraryName}} library.' @@ -16,10 +16,15 @@ module.exports.notificationData = { libraryItemId: 'li_notification_test', libraryId: 'lib_test', libraryName: 'Podcasts', - libraryTags: ['TestTag1', 'TestTag2'], + mediaTags: 'TestTag1, TestTag2', podcastTitle: 'Abs Test Podcast', + podcastAuthor: 'Audiobookshelf', + podcastDescription: 'Description of the Abs Test Podcast belongs here.', + podcastGenres: 'TestGenre1, TestGenre2', episodeId: 'ep_notification_test', - episodeTitle: 'Successful Test' + episodeTitle: 'Successful Test Episode', + episodeSubtitle: 'Episode Subtitle', + episodeDescription: 'Some description of the podcast episode.' } }, {