From a814e4515034a8910d3f755ca76d067a201aeb4e Mon Sep 17 00:00:00 2001 From: Lauri Vuorela Date: Tue, 12 Mar 2024 17:00:21 +0100 Subject: [PATCH 1/6] add a toggle for the new continue series setting --- client/components/modals/libraries/EditModal.vue | 1 + .../modals/libraries/LibrarySettings.vue | 14 ++++++++++++++ client/strings/en-us.json | 2 ++ 3 files changed, 17 insertions(+) diff --git a/client/components/modals/libraries/EditModal.vue b/client/components/modals/libraries/EditModal.vue index 2a68dd63..27e3ec6d 100644 --- a/client/components/modals/libraries/EditModal.vue +++ b/client/components/modals/libraries/EditModal.vue @@ -127,6 +127,7 @@ export default { skipMatchingMediaWithIsbn: false, autoScanCronExpression: null, hideSingleBookSeries: false, + onlyShowLaterBooksInContinueSeries: false, metadataPrecedence: ['folderStructure', 'audioMetatags', 'nfoFile', 'txtFiles', 'opfFile', 'absMetadata'] } } diff --git a/client/components/modals/libraries/LibrarySettings.vue b/client/components/modals/libraries/LibrarySettings.vue index 4712d6a2..5a8a7a40 100644 --- a/client/components/modals/libraries/LibrarySettings.vue +++ b/client/components/modals/libraries/LibrarySettings.vue @@ -49,6 +49,17 @@ +
+
+ + +

+ {{ $strings.LabelSettingsOnlyShowLaterBooksInContinueSeries }} + info_outlined +

+
+
+
@@ -73,6 +84,7 @@ export default { skipMatchingMediaWithIsbn: false, audiobooksOnly: false, hideSingleBookSeries: false, + onlyShowLaterBooksInContinueSeries: false, podcastSearchRegion: 'us' } }, @@ -107,6 +119,7 @@ export default { skipMatchingMediaWithIsbn: !!this.skipMatchingMediaWithIsbn, audiobooksOnly: !!this.audiobooksOnly, hideSingleBookSeries: !!this.hideSingleBookSeries, + onlyShowLaterBooksInContinueSeries: !!this.onlyShowLaterBooksInContinueSeries, podcastSearchRegion: this.podcastSearchRegion } } @@ -121,6 +134,7 @@ export default { this.skipMatchingMediaWithIsbn = !!this.librarySettings.skipMatchingMediaWithIsbn this.audiobooksOnly = !!this.librarySettings.audiobooksOnly this.hideSingleBookSeries = !!this.librarySettings.hideSingleBookSeries + this.onlyShowLaterBooksInContinueSeries = !!this.librarySettings.onlyShowLaterBooksInContinueSeries this.podcastSearchRegion = this.librarySettings.podcastSearchRegion || 'us' } }, diff --git a/client/strings/en-us.json b/client/strings/en-us.json index 2465f873..b5cf5ecd 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Series that have a single book will be hidden from the series page and home page shelves.", "LabelSettingsHomePageBookshelfView": "Home page use bookshelf view", "LabelSettingsLibraryBookshelfView": "Library use bookshelf view", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "Avoids showing books that are earlier in a series than the ones you have already read.", "LabelSettingsParseSubtitles": "Parse subtitles", "LabelSettingsParseSubtitlesHelp": "Extract subtitles from audiobook folder names.
Subtitle must be seperated by \" - \"
i.e. \"Book Title - A Subtitle Here\" has the subtitle \"A Subtitle Here\"", "LabelSettingsPreferMatchedMetadata": "Prefer matched metadata", From c83399c7b5de67103d508ac2d758e8d4e3d88672 Mon Sep 17 00:00:00 2001 From: Lauri Vuorela Date: Tue, 12 Mar 2024 17:04:26 +0100 Subject: [PATCH 2/6] use the toggle to not show earlier works than the ones already read --- server/models/Library.js | 1 + server/objects/settings/LibrarySettings.js | 5 +++- .../utils/queries/libraryItemsBookFilters.js | 24 +++++++++++++++---- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/server/models/Library.js b/server/models/Library.js index c6875ad7..49b54d68 100644 --- a/server/models/Library.js +++ b/server/models/Library.js @@ -11,6 +11,7 @@ const oldLibrary = require('../objects/Library') * @property {string} autoScanCronExpression * @property {boolean} audiobooksOnly * @property {boolean} hideSingleBookSeries Do not show series that only have 1 book + * @property {boolean} onlyShowLaterBooksInContinueSeries Skip showing books that are earlier than the max sequence read * @property {string[]} metadataPrecedence */ diff --git a/server/objects/settings/LibrarySettings.js b/server/objects/settings/LibrarySettings.js index b070ff79..a9885c79 100644 --- a/server/objects/settings/LibrarySettings.js +++ b/server/objects/settings/LibrarySettings.js @@ -8,7 +8,8 @@ class LibrarySettings { this.skipMatchingMediaWithIsbn = false this.autoScanCronExpression = null this.audiobooksOnly = false - this.hideSingleBookSeries = false // Do not show series that only have 1 book + this.hideSingleBookSeries = false // Do not show series that only have 1 book + this.onlyShowLaterBooksInContinueSeries = false // Skip showing books that are earlier than the max sequence read this.metadataPrecedence = ['folderStructure', 'audioMetatags', 'nfoFile', 'txtFiles', 'opfFile', 'absMetadata'] this.podcastSearchRegion = 'us' @@ -25,6 +26,7 @@ class LibrarySettings { this.autoScanCronExpression = settings.autoScanCronExpression || null this.audiobooksOnly = !!settings.audiobooksOnly this.hideSingleBookSeries = !!settings.hideSingleBookSeries + this.onlyShowLaterBooksInContinueSeries = !!settings.onlyShowLaterBooksInContinueSeries if (settings.metadataPrecedence) { this.metadataPrecedence = [...settings.metadataPrecedence] } else { @@ -43,6 +45,7 @@ class LibrarySettings { autoScanCronExpression: this.autoScanCronExpression, audiobooksOnly: this.audiobooksOnly, hideSingleBookSeries: this.hideSingleBookSeries, + onlyShowLaterBooksInContinueSeries: this.onlyShowLaterBooksInContinueSeries, metadataPrecedence: [...this.metadataPrecedence], podcastSearchRegion: this.podcastSearchRegion } diff --git a/server/utils/queries/libraryItemsBookFilters.js b/server/utils/queries/libraryItemsBookFilters.js index 16a25847..dc48c89c 100644 --- a/server/utils/queries/libraryItemsBookFilters.js +++ b/server/utils/queries/libraryItemsBookFilters.js @@ -676,11 +676,14 @@ module.exports = { ], attributes: { include: [ - [Sequelize.literal('(SELECT max(mp.updatedAt) FROM bookSeries bs, mediaProgresses mp WHERE mp.mediaItemId = bs.bookId AND mp.userId = :userId AND bs.seriesId = series.id)'), 'recent_progress'] + [Sequelize.literal('(SELECT max(mp.updatedAt) FROM bookSeries bs, mediaProgresses mp WHERE mp.mediaItemId = bs.bookId AND mp.userId = :userId AND bs.seriesId = series.id)'), 'recent_progress'], + [Sequelize.literal('(SELECT CAST(max(bs.sequence) as FLOAT) FROM bookSeries bs, mediaProgresses mp WHERE mp.mediaItemId = bs.bookId AND mp.userId = :userId AND bs.seriesId = series.id)'), 'maxSequence'], + [Sequelize.literal('(SELECT json_extract(libraries.settings, "$.onlyShowLaterBooksInContinueSeries") FROM libraries WHERE id = :libraryId)'), 'onlyShowLaterBooksInContinueSeries'] ] }, replacements: { userId: user.id, + libraryId: libraryId, ...userPermissionBookWhere.replacements }, include: { @@ -731,13 +734,26 @@ module.exports = { const libraryItems = series.map(s => { if (!s.bookSeries.length) return null // this is only possible if user has restricted books in series - const libraryItem = s.bookSeries[0].book.libraryItem.toJSON() - const book = s.bookSeries[0].book.toJSON() + + var bookIndex = 0 + // if the library setting is toggled, only show later entries in series, otherwise skip + if (s.dataValues.onlyShowLaterBooksInContinueSeries === 1) { + bookIndex = s.bookSeries.findIndex(function (b) { + return parseFloat(b.dataValues.sequence) > s.dataValues.maxSequence + }) + if (bookIndex === -1) { + // no later books than maxSequence + return null + } + } + + const libraryItem = s.bookSeries[bookIndex].book.libraryItem.toJSON() + const book = s.bookSeries[bookIndex].book.toJSON() delete book.libraryItem libraryItem.series = { id: s.id, name: s.name, - sequence: s.bookSeries[0].sequence + sequence: s.bookSeries[bookIndex].sequence } if (libraryItem.feeds?.length) { libraryItem.rssFeed = libraryItem.feeds[0] From d4c1bc5dfcfe323706604039088359daad879b1a Mon Sep 17 00:00:00 2001 From: Lauri Vuorela Date: Thu, 14 Mar 2024 09:41:48 +0100 Subject: [PATCH 3/6] use already fetched library settings, only fetch maxSequence if setting is turned on --- server/utils/queries/libraryFilters.js | 2 +- .../utils/queries/libraryItemsBookFilters.js | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/server/utils/queries/libraryFilters.js b/server/utils/queries/libraryFilters.js index 785124a9..9a5dc658 100644 --- a/server/utils/queries/libraryFilters.js +++ b/server/utils/queries/libraryFilters.js @@ -127,7 +127,7 @@ module.exports = { * @returns {object} { libraryItems:LibraryItem[], count:number } */ async getLibraryItemsContinueSeries(library, user, include, limit) { - const { libraryItems, count } = await libraryItemsBookFilters.getContinueSeriesLibraryItems(library.id, user, include, limit, 0) + const { libraryItems, count } = await libraryItemsBookFilters.getContinueSeriesLibraryItems(library, user, include, limit, 0) return { libraryItems: libraryItems.map(li => { const oldLibraryItem = Database.libraryItemModel.getOldLibraryItem(li).toJSONMinified() diff --git a/server/utils/queries/libraryItemsBookFilters.js b/server/utils/queries/libraryItemsBookFilters.js index dc48c89c..f1b75699 100644 --- a/server/utils/queries/libraryItemsBookFilters.js +++ b/server/utils/queries/libraryItemsBookFilters.js @@ -640,7 +640,8 @@ module.exports = { * @param {number} offset * @returns {object} { libraryItems:LibraryItem[], count:number } */ - async getContinueSeriesLibraryItems(libraryId, user, include, limit, offset) { + async getContinueSeriesLibraryItems(library, user, include, limit, offset) { + const libraryId = library.id const libraryItemIncludes = [] if (include.includes('rssfeed')) { libraryItemIncludes.push({ @@ -654,6 +655,13 @@ module.exports = { const userPermissionBookWhere = this.getUserPermissionBookWhereQuery(user) bookWhere.push(...userPermissionBookWhere.bookWhere) + let includeAttributes = [ + [Sequelize.literal('(SELECT max(mp.updatedAt) FROM bookSeries bs, mediaProgresses mp WHERE mp.mediaItemId = bs.bookId AND mp.userId = :userId AND bs.seriesId = series.id)'), 'recent_progress'], + ] + if (library.settings.onlyShowLaterBooksInContinueSeries) { + includeAttributes.push([Sequelize.literal('(SELECT CAST(max(bs.sequence) as FLOAT) FROM bookSeries bs, mediaProgresses mp WHERE mp.mediaItemId = bs.bookId AND mp.userId = :userId AND bs.seriesId = series.id)'), 'maxSequence']) + } + const { rows: series, count } = await Database.seriesModel.findAndCountAll({ where: [ { @@ -675,11 +683,7 @@ module.exports = { Sequelize.where(Sequelize.literal(`(SELECT count(*) FROM mediaProgresses mp, bookSeries bs WHERE mp.mediaItemId = bs.bookId AND mp.userId = :userId AND bs.seriesId = series.id AND mp.isFinished = 0 AND mp.currentTime > 0)`), 0) ], attributes: { - include: [ - [Sequelize.literal('(SELECT max(mp.updatedAt) FROM bookSeries bs, mediaProgresses mp WHERE mp.mediaItemId = bs.bookId AND mp.userId = :userId AND bs.seriesId = series.id)'), 'recent_progress'], - [Sequelize.literal('(SELECT CAST(max(bs.sequence) as FLOAT) FROM bookSeries bs, mediaProgresses mp WHERE mp.mediaItemId = bs.bookId AND mp.userId = :userId AND bs.seriesId = series.id)'), 'maxSequence'], - [Sequelize.literal('(SELECT json_extract(libraries.settings, "$.onlyShowLaterBooksInContinueSeries") FROM libraries WHERE id = :libraryId)'), 'onlyShowLaterBooksInContinueSeries'] - ] + include: includeAttributes }, replacements: { userId: user.id, @@ -737,7 +741,7 @@ module.exports = { var bookIndex = 0 // if the library setting is toggled, only show later entries in series, otherwise skip - if (s.dataValues.onlyShowLaterBooksInContinueSeries === 1) { + if (library.settings.onlyShowLaterBooksInContinueSeries) { bookIndex = s.bookSeries.findIndex(function (b) { return parseFloat(b.dataValues.sequence) > s.dataValues.maxSequence }) From 65153fae9da30a5528380d279cfde1aab4652603 Mon Sep 17 00:00:00 2001 From: Lauri Vuorela Date: Thu, 14 Mar 2024 09:42:50 +0100 Subject: [PATCH 4/6] var => let --- server/utils/queries/libraryItemsBookFilters.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/utils/queries/libraryItemsBookFilters.js b/server/utils/queries/libraryItemsBookFilters.js index f1b75699..0cb3ffc3 100644 --- a/server/utils/queries/libraryItemsBookFilters.js +++ b/server/utils/queries/libraryItemsBookFilters.js @@ -739,7 +739,7 @@ module.exports = { const libraryItems = series.map(s => { if (!s.bookSeries.length) return null // this is only possible if user has restricted books in series - var bookIndex = 0 + let bookIndex = 0 // if the library setting is toggled, only show later entries in series, otherwise skip if (library.settings.onlyShowLaterBooksInContinueSeries) { bookIndex = s.bookSeries.findIndex(function (b) { From d02fc2debe3ca91c467113d7d03fc7e13bc684fb Mon Sep 17 00:00:00 2001 From: advplyr Date: Thu, 14 Mar 2024 14:27:33 -0500 Subject: [PATCH 5/6] Update continue series skip earlier books query attribute to look for finished books, update wording on help text, map translations --- client/strings/cs.json | 2 ++ client/strings/da.json | 2 ++ client/strings/de.json | 2 ++ client/strings/en-us.json | 2 +- client/strings/es.json | 2 ++ client/strings/et.json | 2 ++ client/strings/fr.json | 4 +++- client/strings/gu.json | 2 ++ client/strings/hi.json | 2 ++ client/strings/hr.json | 2 ++ client/strings/hu.json | 2 ++ client/strings/it.json | 2 ++ client/strings/lt.json | 2 ++ client/strings/nl.json | 2 ++ client/strings/no.json | 2 ++ client/strings/pl.json | 2 ++ client/strings/pt-br.json | 4 +++- client/strings/ru.json | 2 ++ client/strings/sv.json | 2 ++ client/strings/vi-vn.json | 4 +++- client/strings/zh-cn.json | 2 ++ server/utils/queries/libraryItemsBookFilters.js | 2 +- 22 files changed, 45 insertions(+), 5 deletions(-) diff --git a/client/strings/cs.json b/client/strings/cs.json index 7dc18aa6..4ce358a2 100644 --- a/client/strings/cs.json +++ b/client/strings/cs.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Série, které mají jedinou knihu, budou skryty na stránce série a na domovské stránce.", "LabelSettingsHomePageBookshelfView": "Domovská stránka používá zobrazení police s knihami", "LabelSettingsLibraryBookshelfView": "Knihovna používá zobrazení police s knihami", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Analzyovat podtitul", "LabelSettingsParseSubtitlesHelp": "Rozparsovat podtitul z názvů složek audioknih.
Podtiul musí být oddělen znakem \" - \"
tj. \"Název knihy - Zde Podtitul\" má podtitul \"Zde podtitul\"", "LabelSettingsPreferMatchedMetadata": "Preferovat spárovaná metadata", diff --git a/client/strings/da.json b/client/strings/da.json index 8c305ca2..de00a1fc 100644 --- a/client/strings/da.json +++ b/client/strings/da.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Serier med en enkelt bog vil blive skjult fra serie-siden og hjemmesidehylder.", "LabelSettingsHomePageBookshelfView": "Brug bogreolvisning på startside", "LabelSettingsLibraryBookshelfView": "Brug bogreolvisning i biblioteket", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Fortolk undertekster", "LabelSettingsParseSubtitlesHelp": "Udtræk undertekster fra lydbogsmappenavne.
Undertitler skal adskilles af \" - \"
f.eks. \"Bogtitel - En undertitel her\" har undertitlen \"En undertitel her\"", "LabelSettingsPreferMatchedMetadata": "Foretræk matchede metadata", diff --git a/client/strings/de.json b/client/strings/de.json index 33b0fb1b..ed99f095 100644 --- a/client/strings/de.json +++ b/client/strings/de.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Serien, die nur ein einzelnes Buch enthalten, werden auf der Startseite und in der Serienansicht ausgeblendet.", "LabelSettingsHomePageBookshelfView": "Startseite verwendet die Bücherregalansicht", "LabelSettingsLibraryBookshelfView": "Bibliothek verwendet die Bücherregalansicht", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Analysiere Untertitel", "LabelSettingsParseSubtitlesHelp": "Extrahiere den Untertitel von Medium-Ordnernamen.
Untertitel müssen vom eigentlichem Titel durch ein \" - \" getrennt sein.
Beispiel: \"Titel - Untertitel\"", "LabelSettingsPreferMatchedMetadata": "Bevorzuge online abgestimmte Metadaten", diff --git a/client/strings/en-us.json b/client/strings/en-us.json index b5cf5ecd..43a1ef44 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -467,7 +467,7 @@ "LabelSettingsHomePageBookshelfView": "Home page use bookshelf view", "LabelSettingsLibraryBookshelfView": "Library use bookshelf view", "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", - "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "Avoids showing books that are earlier in a series than the ones you have already read.", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Parse subtitles", "LabelSettingsParseSubtitlesHelp": "Extract subtitles from audiobook folder names.
Subtitle must be seperated by \" - \"
i.e. \"Book Title - A Subtitle Here\" has the subtitle \"A Subtitle Here\"", "LabelSettingsPreferMatchedMetadata": "Prefer matched metadata", diff --git a/client/strings/es.json b/client/strings/es.json index 452b625d..068c5bc4 100644 --- a/client/strings/es.json +++ b/client/strings/es.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Las series con un solo libro no aparecerán en la página de series ni la repisa para series de la página principal.", "LabelSettingsHomePageBookshelfView": "Usar la vista de librero en la página principal", "LabelSettingsLibraryBookshelfView": "Usar la vista de librero en la biblioteca", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Extraer Subtítulos", "LabelSettingsParseSubtitlesHelp": "Extraer subtítulos de los nombres de las carpetas de los audiolibros.
Los subtítulos deben estar separados por \" - \"
Por ejemplo: \"Ejemplo de Título - Subtítulo Aquí\" tiene el subtítulo \"Subtítulo Aquí\"", "LabelSettingsPreferMatchedMetadata": "Preferir metadatos encontrados", diff --git a/client/strings/et.json b/client/strings/et.json index 8c13c435..da145027 100644 --- a/client/strings/et.json +++ b/client/strings/et.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Ühe raamatuga seeriaid peidetakse seeria lehelt ja avalehe riiulitelt.", "LabelSettingsHomePageBookshelfView": "Avaleht kasutage raamatukoguvaadet", "LabelSettingsLibraryBookshelfView": "Raamatukogu kasutamiseks kasutage raamatukoguvaadet", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Lugege subtiitreid", "LabelSettingsParseSubtitlesHelp": "Eraldage subtiitrid heliraamatu kaustade nimedest.
Subtiitrid peavad olema eraldatud \" - \".
Näiteks: \"Raamatu pealkiri - Siin on alapealkiri\" alapealkiri on \"Siin on alapealkiri\"", "LabelSettingsPreferMatchedMetadata": "Eelista sobitatud metaandmeid", diff --git a/client/strings/fr.json b/client/strings/fr.json index 2948168e..b7b28472 100644 --- a/client/strings/fr.json +++ b/client/strings/fr.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Les séries qui ne comportent qu’un seul livre seront masquées sur la page de la série et sur les étagères de la page d’accueil.", "LabelSettingsHomePageBookshelfView": "La page d’accueil utilise la vue étagère", "LabelSettingsLibraryBookshelfView": "La bibliothèque utilise la vue étagère", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Analyser les sous-titres", "LabelSettingsParseSubtitlesHelp": "Extrait les sous-titres depuis le dossier du livre audio.
Les sous-titres doivent être séparés par « - »
c’est-à-dire : « Titre du livre - Ceci est un sous-titre » aura le sous-titre « Ceci est un sous-titre »", "LabelSettingsPreferMatchedMetadata": "Préférer les métadonnées par correspondance", @@ -776,4 +778,4 @@ "ToastSocketFailedToConnect": "Échec de la connexion WebSocket", "ToastUserDeleteFailed": "Échec de la suppression de l’utilisateur", "ToastUserDeleteSuccess": "Utilisateur supprimé" -} +} \ No newline at end of file diff --git a/client/strings/gu.json b/client/strings/gu.json index eff18343..0a2dc3b6 100644 --- a/client/strings/gu.json +++ b/client/strings/gu.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Series that have a single book will be hidden from the series page and home page shelves.", "LabelSettingsHomePageBookshelfView": "Home page use bookshelf view", "LabelSettingsLibraryBookshelfView": "Library use bookshelf view", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Parse subtitles", "LabelSettingsParseSubtitlesHelp": "Extract subtitles from audiobook folder names.
Subtitle must be seperated by \" - \"
i.e. \"Book Title - A Subtitle Here\" has the subtitle \"A Subtitle Here\"", "LabelSettingsPreferMatchedMetadata": "Prefer matched metadata", diff --git a/client/strings/hi.json b/client/strings/hi.json index d126e9f5..4e8aae7b 100644 --- a/client/strings/hi.json +++ b/client/strings/hi.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Series that have a single book will be hidden from the series page and home page shelves.", "LabelSettingsHomePageBookshelfView": "Home page use bookshelf view", "LabelSettingsLibraryBookshelfView": "Library use bookshelf view", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Parse subtitles", "LabelSettingsParseSubtitlesHelp": "Extract subtitles from audiobook folder names.
Subtitle must be seperated by \" - \"
i.e. \"Book Title - A Subtitle Here\" has the subtitle \"A Subtitle Here\"", "LabelSettingsPreferMatchedMetadata": "Prefer matched metadata", diff --git a/client/strings/hr.json b/client/strings/hr.json index 313505ac..fa5bcd35 100644 --- a/client/strings/hr.json +++ b/client/strings/hr.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Series that have a single book will be hidden from the series page and home page shelves.", "LabelSettingsHomePageBookshelfView": "Koristi bookshelf pogled za početnu stranicu", "LabelSettingsLibraryBookshelfView": "Koristi bookshelf pogled za biblioteku", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Parsaj podnapise", "LabelSettingsParseSubtitlesHelp": "Izvadi podnapise iz imena od audiobook foldera.
Podnapis mora biti odvojen sa \" - \"
npr. \"Ime knjige - Podnapis ovdje\" ima podnapis \"Podnapis ovdje\"", "LabelSettingsPreferMatchedMetadata": "Preferiraj matchane metapodatke", diff --git a/client/strings/hu.json b/client/strings/hu.json index 1829916a..f7e2abd8 100644 --- a/client/strings/hu.json +++ b/client/strings/hu.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "A csak egy könyvet tartalmazó sorozatok el lesznek rejtve a sorozatok oldalról és a kezdőlap polcairól.", "LabelSettingsHomePageBookshelfView": "Kezdőlap használja a könyvespolc nézetet", "LabelSettingsLibraryBookshelfView": "Könyvtár használja a könyvespolc nézetet", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Feliratok elemzése", "LabelSettingsParseSubtitlesHelp": "Feliratok kinyerése a hangoskönyv mappaneveiből.
A feliratnak el kell különülnie egy \" - \" jellel
például: \"Könyv címe - Egy felirat itt\" esetén a felirat \"Egy felirat itt\"", "LabelSettingsPreferMatchedMetadata": "Preferált egyeztetett metaadatok", diff --git a/client/strings/it.json b/client/strings/it.json index f4e97048..8924a28b 100644 --- a/client/strings/it.json +++ b/client/strings/it.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Le serie che hanno un solo libro saranno nascoste dalla pagina della serie e dagli scaffali della home page.", "LabelSettingsHomePageBookshelfView": "Home page con sfondo legno", "LabelSettingsLibraryBookshelfView": "Libreria con sfondo legno", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Analizza sottotitoli", "LabelSettingsParseSubtitlesHelp": "Estrai i sottotitoli dai nomi delle cartelle degli audiolibri.
I sottotitoli devono essere separati da \" - \"
Per esempio \"Il signore degli anelli - Le due Torri \" avrà il sottotitolo \"Le due Torri\"", "LabelSettingsPreferMatchedMetadata": "Preferisci i metadata trovati", diff --git a/client/strings/lt.json b/client/strings/lt.json index 4d97ab47..d36861a4 100644 --- a/client/strings/lt.json +++ b/client/strings/lt.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Serijos, turinčios tik vieną knygą, bus paslėptos nuo serijų puslapio ir pagrindinio puslapio lentynų.", "LabelSettingsHomePageBookshelfView": "Naudoti pagrindinio puslapio knygų lentynų vaizdą", "LabelSettingsLibraryBookshelfView": "Naudoti bibliotekos knygų lentynų vaizdą", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Analizuoti subtitrus", "LabelSettingsParseSubtitlesHelp": "Išskleisti subtitrus iš audioknygos aplanko pavadinimų.
Subtitrai turi būti atskirti brūkšniu \"-\"
pavyzdžiui, \"Knygos pavadinimas - Čia yra subtitrai\" turi subtitrą \"Čia yra subtitrai\"", "LabelSettingsPreferMatchedMetadata": "Pirmenybė atitaikytiems metaduomenis", diff --git a/client/strings/nl.json b/client/strings/nl.json index 858b3de6..b8d3f669 100644 --- a/client/strings/nl.json +++ b/client/strings/nl.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Series die slechts een enkel boek bevatten worden verborgen op de seriespagina en de homepagina-planken.", "LabelSettingsHomePageBookshelfView": "Boekenplank-view voor homepagina", "LabelSettingsLibraryBookshelfView": "Boekenplank-view voor bibliotheek", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Parseer subtitel", "LabelSettingsParseSubtitlesHelp": "Haal subtitels uit mapnaam van audioboek.
Subtitel moet gescheiden zijn met \" - \"
b.v. \"Boektitel - Een Subtitel Hier\" heeft als subtitel \"Een Subtitel Hier\"", "LabelSettingsPreferMatchedMetadata": "Prefereer gematchte metadata", diff --git a/client/strings/no.json b/client/strings/no.json index 065d28df..818ee0fa 100644 --- a/client/strings/no.json +++ b/client/strings/no.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Serier som har kun en bok vil bli gjemt på serie- og hjemmeside hyllen.", "LabelSettingsHomePageBookshelfView": "Hjemmeside bruk bokhyllevisning", "LabelSettingsLibraryBookshelfView": "Bibliotek bruk bokhyllevisning", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Analyser undertekster", "LabelSettingsParseSubtitlesHelp": "Trekk ut undertekster fra lydbok mappenavn.
undertekster må være separert med \" - \"
f.eks. \"Boktittel - Undertekst her\" har Undertekst \"Undertekst her\"", "LabelSettingsPreferMatchedMetadata": "Foretrekk funnet metadata", diff --git a/client/strings/pl.json b/client/strings/pl.json index 2d4141ba..cf4274cc 100644 --- a/client/strings/pl.json +++ b/client/strings/pl.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Series that have a single book will be hidden from the series page and home page shelves.", "LabelSettingsHomePageBookshelfView": "Widok półki z książkami na stronie głównej", "LabelSettingsLibraryBookshelfView": "Widok półki z książkami na stronie biblioteki", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Przetwarzaj podtytuły", "LabelSettingsParseSubtitlesHelp": "Opcja pozwala na pobranie podtytułu z nazwy folderu z audiobookiem.
Podtytuł musi być rozdzielony za pomocą separatora \" - \"
Przykład: \"Book Title - A Subtitle Here\" podtytuł \"A Subtitle Here\"", "LabelSettingsPreferMatchedMetadata": "Preferowanie dopasowanych metadanych", diff --git a/client/strings/pt-br.json b/client/strings/pt-br.json index 0f0b0f06..7a5a1eec 100644 --- a/client/strings/pt-br.json +++ b/client/strings/pt-br.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Séries com um só livro serão ocultadas na página de séries e na prateleira de séries na página principal.", "LabelSettingsHomePageBookshelfView": "Usar visão estante na página principal", "LabelSettingsLibraryBookshelfView": "Usar visão estante na página da biblioteca", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Analisar subtítulos", "LabelSettingsParseSubtitlesHelp": "Extrair subtítulos do nome da pasta do audiobook.
Subtítulo deve estar separado por \" - \"
ex: \"Título do Livro - Um Subtítulo Aqui\" tem o subtítulo \"Um Subtítulo Aqui\"", "LabelSettingsPreferMatchedMetadata": "Preferir metadados consultados", @@ -776,4 +778,4 @@ "ToastSocketFailedToConnect": "Falha na conexão do socket", "ToastUserDeleteFailed": "Falha ao apagar usuário", "ToastUserDeleteSuccess": "Usuário apagado" -} +} \ No newline at end of file diff --git a/client/strings/ru.json b/client/strings/ru.json index 6d690ee6..a55e4668 100644 --- a/client/strings/ru.json +++ b/client/strings/ru.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Серии, в которых всего одна книга, будут скрыты со страницы серий и полок домашней страницы.", "LabelSettingsHomePageBookshelfView": "Вид книжной полки на Домашней странице", "LabelSettingsLibraryBookshelfView": "Вид книжной полки в Библиотеке", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Разбор подзаголовков", "LabelSettingsParseSubtitlesHelp": "Извлечение подзаголовков из имен папок аудиокниг.
Подзаголовок должны быть отделен \" - \"
например \"Название Книги - Тут Подзаголовок\" подзаголовок будет \"Тут Подзаголовок\"", "LabelSettingsPreferMatchedMetadata": "Предпочитать метаданные поиска", diff --git a/client/strings/sv.json b/client/strings/sv.json index 55e92be4..820fe18a 100644 --- a/client/strings/sv.json +++ b/client/strings/sv.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Serier som har en enda bok kommer att döljas från seriesidan och hyllsidan på startsidan.", "LabelSettingsHomePageBookshelfView": "Startsida använd bokhyllvy", "LabelSettingsLibraryBookshelfView": "Bibliotek använd bokhyllvy", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Analysera undertexter", "LabelSettingsParseSubtitlesHelp": "Extrahera undertexter från mappnamn för ljudböcker.
Undertext måste vara åtskilda av \" - \"
t.ex. \"Boktitel - En undertitel här\" har undertiteln \"En undertitel här\"", "LabelSettingsPreferMatchedMetadata": "Föredra matchad metadata", diff --git a/client/strings/vi-vn.json b/client/strings/vi-vn.json index 8c84a8c0..bddfd647 100644 --- a/client/strings/vi-vn.json +++ b/client/strings/vi-vn.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "Các loạt sách chỉ có một cuốn sách sẽ được ẩn khỏi trang loạt sách và kệ trang chủ.", "LabelSettingsHomePageBookshelfView": "Trang chủ sử dụng chế độ xem kệ sách", "LabelSettingsLibraryBookshelfView": "Thư viện sử dụng chế độ xem kệ sách", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "Phân tích phụ đề", "LabelSettingsParseSubtitlesHelp": "Trích xuất phụ đề từ tên thư mục sách nói.
Phụ đề phải được tách bằng \" - \"
i.e. \"Book Title - A Subtitle Here\" có phụ đề \"A Subtitle Here\"", "LabelSettingsPreferMatchedMetadata": "Ưu tiên siêu dữ liệu phù hợp", @@ -776,4 +778,4 @@ "ToastSocketFailedToConnect": "Không thể kết nối socket", "ToastUserDeleteFailed": "Xóa người dùng thất bại", "ToastUserDeleteSuccess": "Người dùng đã được xóa" -} +} \ No newline at end of file diff --git a/client/strings/zh-cn.json b/client/strings/zh-cn.json index 0634c74f..bf816f89 100644 --- a/client/strings/zh-cn.json +++ b/client/strings/zh-cn.json @@ -466,6 +466,8 @@ "LabelSettingsHideSingleBookSeriesHelp": "只有一本书的系列将从系列页面和主页书架中隐藏.", "LabelSettingsHomePageBookshelfView": "首页使用书架视图", "LabelSettingsLibraryBookshelfView": "媒体库使用书架视图", + "LabelSettingsOnlyShowLaterBooksInContinueSeries": "Skip earlier books in Continue Series", + "LabelSettingsOnlyShowLaterBooksInContinueSeriesHelp": "The Continue Series home page shelf shows the first book not started in series that have at least one book finished and no books in progress. Enabling this setting will continue series from the furthest completed book instead of the first book not started.", "LabelSettingsParseSubtitles": "解析副标题", "LabelSettingsParseSubtitlesHelp": "从有声读物文件夹中提取副标题.
副标题必须用 \" - \" 分隔.
例: \"书名 - 这里是副标题\" 则显示副标题 \"这里是副标题\"", "LabelSettingsPreferMatchedMetadata": "首选匹配的元数据", diff --git a/server/utils/queries/libraryItemsBookFilters.js b/server/utils/queries/libraryItemsBookFilters.js index 0cb3ffc3..a9ae00ef 100644 --- a/server/utils/queries/libraryItemsBookFilters.js +++ b/server/utils/queries/libraryItemsBookFilters.js @@ -659,7 +659,7 @@ module.exports = { [Sequelize.literal('(SELECT max(mp.updatedAt) FROM bookSeries bs, mediaProgresses mp WHERE mp.mediaItemId = bs.bookId AND mp.userId = :userId AND bs.seriesId = series.id)'), 'recent_progress'], ] if (library.settings.onlyShowLaterBooksInContinueSeries) { - includeAttributes.push([Sequelize.literal('(SELECT CAST(max(bs.sequence) as FLOAT) FROM bookSeries bs, mediaProgresses mp WHERE mp.mediaItemId = bs.bookId AND mp.userId = :userId AND bs.seriesId = series.id)'), 'maxSequence']) + includeAttributes.push([Sequelize.literal('(SELECT CAST(max(bs.sequence) as FLOAT) FROM bookSeries bs, mediaProgresses mp WHERE mp.mediaItemId = bs.bookId AND mp.isFinished = 1 AND mp.userId = :userId AND bs.seriesId = series.id)'), 'maxSequence']) } const { rows: series, count } = await Database.seriesModel.findAndCountAll({ From 521db90ae0873efacaf91e88c3f3db98580b80dd Mon Sep 17 00:00:00 2001 From: advplyr Date: Thu, 14 Mar 2024 14:37:24 -0500 Subject: [PATCH 6/6] Update JSDocs, remove unused libraryId replacement --- server/utils/queries/libraryFilters.js | 6 +++--- server/utils/queries/libraryItemsBookFilters.js | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/server/utils/queries/libraryFilters.js b/server/utils/queries/libraryFilters.js index 9a5dc658..288ee6db 100644 --- a/server/utils/queries/libraryFilters.js +++ b/server/utils/queries/libraryFilters.js @@ -75,7 +75,7 @@ module.exports = { /** * Get library items for most recently added shelf - * @param {oldLibrary} library + * @param {import('../../objects/Library')} library * @param {oldUser} user * @param {string[]} include * @param {number} limit @@ -120,7 +120,7 @@ module.exports = { /** * Get library items for continue series shelf - * @param {string} library + * @param {import('../../objects/Library')} library * @param {oldUser} user * @param {string[]} include * @param {number} limit @@ -145,7 +145,7 @@ module.exports = { /** * Get library items or podcast episodes for the "Listen Again" and "Read Again" shelf - * @param {oldLibrary} library + * @param {import('../../objects/Library')} library * @param {oldUser} user * @param {string[]} include * @param {number} limit diff --git a/server/utils/queries/libraryItemsBookFilters.js b/server/utils/queries/libraryItemsBookFilters.js index a9ae00ef..07a8458d 100644 --- a/server/utils/queries/libraryItemsBookFilters.js +++ b/server/utils/queries/libraryItemsBookFilters.js @@ -633,12 +633,12 @@ module.exports = { * 2. Has no books in progress * 3. Has at least 1 unfinished book * TODO: Reduce queries - * @param {string} libraryId - * @param {oldUser} user + * @param {import('../../objects/Library')} library + * @param {import('../../objects/user/User')} user * @param {string[]} include * @param {number} limit * @param {number} offset - * @returns {object} { libraryItems:LibraryItem[], count:number } + * @returns {{ libraryItems:import('../../models/LibraryItem')[], count:number }} */ async getContinueSeriesLibraryItems(library, user, include, limit, offset) { const libraryId = library.id @@ -687,7 +687,6 @@ module.exports = { }, replacements: { userId: user.id, - libraryId: libraryId, ...userPermissionBookWhere.replacements }, include: {