From d2512d324a3850562738b84575037b84fd6fcdd1 Mon Sep 17 00:00:00 2001 From: Lars Kiesow Date: Thu, 2 Feb 2023 00:38:35 +0100 Subject: [PATCH 1/5] Integration Test This patch adds a minimal integration test building Audiobookshelf as a binary, running it and checking if the server is available on each push and pull request. We can easily extend this with a Selenium or Playwright test later, but it should already alert us about problems in the build pipeline without the need for any developer to take a look at the new patches. --- .github/workflows/integration-test.yml | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/integration-test.yml diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml new file mode 100644 index 00000000..f88db2ed --- /dev/null +++ b/.github/workflows/integration-test.yml @@ -0,0 +1,44 @@ +name: Integration Test + +on: + pull_request: + push: + branches-ignore: + - 'dependabot/**' # Don't run dependabot branches, as they are already covered by pull requests + +jobs: + build: + name: build and test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: setup nade + uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: install pkg + run: npm install -g pkg + + - name: get client dependencies + working-directory: client + run: npm ci + + - name: build client + working-directory: client + run: npm run generate + + - name: get server dependencies + run: npm ci --only=production + + - name: build binary + run: pkg -t node18-linux-x64 -o audiobookshelf . + + - name: run audiobookshelf + run: | + ./audiobookshelf & + sleep 5 + + - name: test if server is available + run: curl -sf http://127.0.0.1:3333 | grep Audiobookshelf 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 2/5] 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 3/5] 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 4/5] 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 5/5] 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.' } }, {