From e60d2a98582a4d45f854880b85ad8f8aea3d7f60 Mon Sep 17 00:00:00 2001 From: advplyr Date: Mon, 8 Apr 2024 15:48:41 -0500 Subject: [PATCH] Add:Podcast library filter for languages and show language on podcast item page --- client/components/content/LibraryItemDetails.vue | 2 +- client/components/controls/LibraryFilterSelect.vue | 5 +++++ server/utils/queries/libraryFilters.js | 5 ++++- server/utils/queries/libraryItemsPodcastFilters.js | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/client/components/content/LibraryItemDetails.vue b/client/components/content/LibraryItemDetails.vue index 0b69b038..7c6ac222 100644 --- a/client/components/content/LibraryItemDetails.vue +++ b/client/components/content/LibraryItemDetails.vue @@ -89,7 +89,7 @@ -
+
{{ $strings.LabelLanguage }}
diff --git a/client/components/controls/LibraryFilterSelect.vue b/client/components/controls/LibraryFilterSelect.vue index 04dd11af..e5464293 100644 --- a/client/components/controls/LibraryFilterSelect.vue +++ b/client/components/controls/LibraryFilterSelect.vue @@ -235,6 +235,11 @@ export default { value: 'tags', sublist: true }, + { + text: this.$strings.LabelLanguage, + value: 'languages', + sublist: true + }, { text: this.$strings.ButtonIssues, value: 'issues', diff --git a/server/utils/queries/libraryFilters.js b/server/utils/queries/libraryFilters.js index 288ee6db..a2efb664 100644 --- a/server/utils/queries/libraryFilters.js +++ b/server/utils/queries/libraryFilters.js @@ -451,7 +451,7 @@ module.exports = { libraryId: libraryId } }, - attributes: ['tags', 'genres'] + attributes: ['tags', 'genres', 'language'] }) for (const podcast of podcasts) { if (podcast.tags?.length) { @@ -460,6 +460,9 @@ module.exports = { if (podcast.genres?.length) { podcast.genres.forEach((genre) => data.genres.add(genre)) } + if (podcast.language) { + data.languages.add(podcast.language) + } } } else { const books = await Database.bookModel.findAll({ diff --git a/server/utils/queries/libraryItemsPodcastFilters.js b/server/utils/queries/libraryItemsPodcastFilters.js index 7665c89b..3e6e337c 100644 --- a/server/utils/queries/libraryItemsPodcastFilters.js +++ b/server/utils/queries/libraryItemsPodcastFilters.js @@ -51,6 +51,8 @@ module.exports = { [Sequelize.Op.gte]: 1 }) replacements.filterValue = value + } else if (group === 'languages') { + mediaWhere['language'] = value } return {