Skip to content

Commit

Permalink
Add:Ebook and supplementary ebook library filters
Browse files Browse the repository at this point in the history
  • Loading branch information
advplyr committed Jun 10, 2023
1 parent a9f5c64 commit aae9264
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 5 deletions.
18 changes: 15 additions & 3 deletions client/components/controls/LibraryFilterSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ export default {
sublist: true
},
{
text: this.$strings.LabelEbook,
value: 'ebook',
sublist: false
text: this.$strings.LabelEbooks,
value: 'ebooks',
sublist: true
},
{
text: this.$strings.LabelAbridged,
Expand Down Expand Up @@ -341,6 +341,18 @@ export default {
}
]
},
ebooks() {
return [
{
id: 'ebook',
name: this.$strings.LabelHasEbook
},
{
id: 'supplementary',
name: this.$strings.LabelHasSupplementaryEbook
}
]
},
missing() {
return [
{
Expand Down
2 changes: 1 addition & 1 deletion client/store/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const actions = {
if (state.settings.orderBy == 'media.metadata.publishedYear') {
settingsUpdate.orderBy = 'media.metadata.title'
}
const invalidFilters = ['series', 'authors', 'narrators', 'languages', 'progress', 'issues']
const invalidFilters = ['series', 'authors', 'narrators', 'languages', 'progress', 'issues', 'ebooks', 'abridged']
const filterByFirstPart = (state.settings.filterBy || '').split('.').shift()
if (invalidFilters.includes(filterByFirstPart)) {
settingsUpdate.filterBy = 'all'
Expand Down
3 changes: 3 additions & 0 deletions client/strings/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
"LabelDuration": "Laufzeit",
"LabelDurationFound": "Gefundene Laufzeit:",
"LabelEbook": "Ebook",
"LabelEbooks": "Ebooks",
"LabelEdit": "Bearbeiten",
"LabelEmail": "Email",
"LabelEmailSettingsFromAddress": "From Address",
Expand Down Expand Up @@ -251,6 +252,8 @@
"LabelGenre": "Kategorie",
"LabelGenres": "Kategorien",
"LabelHardDeleteFile": "Datei dauerhaft löschen",
"LabelHasEbook": "Has ebook",
"LabelHasSupplementaryEbook": "Has supplementary ebook",
"LabelHost": "Host",
"LabelHour": "Stunde",
"LabelIcon": "Symbol",
Expand Down
3 changes: 3 additions & 0 deletions client/strings/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
"LabelDuration": "Duration",
"LabelDurationFound": "Duration found:",
"LabelEbook": "Ebook",
"LabelEbooks": "Ebooks",
"LabelEdit": "Edit",
"LabelEmail": "Email",
"LabelEmailSettingsFromAddress": "From Address",
Expand Down Expand Up @@ -251,6 +252,8 @@
"LabelGenre": "Genre",
"LabelGenres": "Genres",
"LabelHardDeleteFile": "Hard delete file",
"LabelHasEbook": "Has ebook",
"LabelHasSupplementaryEbook": "Has supplementary ebook",
"LabelHost": "Host",
"LabelHour": "Hour",
"LabelIcon": "Icon",
Expand Down
3 changes: 3 additions & 0 deletions client/strings/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
"LabelDuration": "Duración",
"LabelDurationFound": "Duración Comprobada:",
"LabelEbook": "Ebook",
"LabelEbooks": "Ebooks",
"LabelEdit": "Editar",
"LabelEmail": "Email",
"LabelEmailSettingsFromAddress": "From Address",
Expand Down Expand Up @@ -251,6 +252,8 @@
"LabelGenre": "Genero",
"LabelGenres": "Géneros",
"LabelHardDeleteFile": "Eliminar Definitivamente",
"LabelHasEbook": "Has ebook",
"LabelHasSupplementaryEbook": "Has supplementary ebook",
"LabelHost": "Host",
"LabelHour": "Hora",
"LabelIcon": "Icono",
Expand Down
3 changes: 3 additions & 0 deletions client/strings/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
"LabelDuration": "Durée",
"LabelDurationFound": "Durée trouvée :",
"LabelEbook": "E-book",
"LabelEbooks": "Ebooks",
"LabelEdit": "Modifier",
"LabelEmail": "E-mail",
"LabelEmailSettingsFromAddress": "Expéditeur",
Expand Down Expand Up @@ -251,6 +252,8 @@
"LabelGenre": "Genre",
"LabelGenres": "Genres",
"LabelHardDeleteFile": "Suppression du fichier",
"LabelHasEbook": "Has ebook",
"LabelHasSupplementaryEbook": "Has supplementary ebook",
"LabelHost": "Hôte",
"LabelHour": "Heure",
"LabelIcon": "Icone",
Expand Down
3 changes: 3 additions & 0 deletions client/strings/gu.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
"LabelDuration": "Duration",
"LabelDurationFound": "Duration found:",
"LabelEbook": "Ebook",
"LabelEbooks": "Ebooks",
"LabelEdit": "Edit",
"LabelEmail": "Email",
"LabelEmailSettingsFromAddress": "From Address",
Expand Down Expand Up @@ -251,6 +252,8 @@
"LabelGenre": "Genre",
"LabelGenres": "Genres",
"LabelHardDeleteFile": "Hard delete file",
"LabelHasEbook": "Has ebook",
"LabelHasSupplementaryEbook": "Has supplementary ebook",
"LabelHost": "Host",
"LabelHour": "Hour",
"LabelIcon": "Icon",
Expand Down
3 changes: 3 additions & 0 deletions client/strings/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
"LabelDuration": "Duration",
"LabelDurationFound": "Duration found:",
"LabelEbook": "Ebook",
"LabelEbooks": "Ebooks",
"LabelEdit": "Edit",
"LabelEmail": "Email",
"LabelEmailSettingsFromAddress": "From Address",
Expand Down Expand Up @@ -251,6 +252,8 @@
"LabelGenre": "Genre",
"LabelGenres": "Genres",
"LabelHardDeleteFile": "Hard delete file",
"LabelHasEbook": "Has ebook",
"LabelHasSupplementaryEbook": "Has supplementary ebook",
"LabelHost": "Host",
"LabelHour": "Hour",
"LabelIcon": "Icon",
Expand Down
3 changes: 3 additions & 0 deletions client/strings/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
"LabelDuration": "Trajanje",
"LabelDurationFound": "Pronađeno trajanje:",
"LabelEbook": "Ebook",
"LabelEbooks": "Ebooks",
"LabelEdit": "Uredi",
"LabelEmail": "Email",
"LabelEmailSettingsFromAddress": "From Address",
Expand Down Expand Up @@ -251,6 +252,8 @@
"LabelGenre": "Genre",
"LabelGenres": "Žanrovi",
"LabelHardDeleteFile": "Obriši datoteku zauvijek",
"LabelHasEbook": "Has ebook",
"LabelHasSupplementaryEbook": "Has supplementary ebook",
"LabelHost": "Host",
"LabelHour": "Sat",
"LabelIcon": "Ikona",
Expand Down
3 changes: 3 additions & 0 deletions client/strings/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
"LabelDuration": "Durata",
"LabelDurationFound": "Durata Trovata:",
"LabelEbook": "Ebook",
"LabelEbooks": "Ebooks",
"LabelEdit": "Modifica",
"LabelEmail": "Email",
"LabelEmailSettingsFromAddress": "From Address",
Expand Down Expand Up @@ -251,6 +252,8 @@
"LabelGenre": "Genere",
"LabelGenres": "Generi",
"LabelHardDeleteFile": "Elimina Definitivamente",
"LabelHasEbook": "Has ebook",
"LabelHasSupplementaryEbook": "Has supplementary ebook",
"LabelHost": "Host",
"LabelHour": "Ora",
"LabelIcon": "Icona",
Expand Down
3 changes: 3 additions & 0 deletions client/strings/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
"LabelDuration": "Duur",
"LabelDurationFound": "Gevonden duur:",
"LabelEbook": "Ebook",
"LabelEbooks": "Ebooks",
"LabelEdit": "Wijzig",
"LabelEmail": "Email",
"LabelEmailSettingsFromAddress": "From Address",
Expand Down Expand Up @@ -251,6 +252,8 @@
"LabelGenre": "Genre",
"LabelGenres": "Genres",
"LabelHardDeleteFile": "Hard-delete bestand",
"LabelHasEbook": "Has ebook",
"LabelHasSupplementaryEbook": "Has supplementary ebook",
"LabelHost": "Host",
"LabelHour": "Uur",
"LabelIcon": "Icoon",
Expand Down
3 changes: 3 additions & 0 deletions client/strings/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
"LabelDuration": "Czas trwania",
"LabelDurationFound": "Znaleziona długość:",
"LabelEbook": "Ebook",
"LabelEbooks": "Ebooks",
"LabelEdit": "Edytuj",
"LabelEmail": "Email",
"LabelEmailSettingsFromAddress": "From Address",
Expand Down Expand Up @@ -251,6 +252,8 @@
"LabelGenre": "Gatunek",
"LabelGenres": "Gatunki",
"LabelHardDeleteFile": "Usuń trwale plik",
"LabelHasEbook": "Has ebook",
"LabelHasSupplementaryEbook": "Has supplementary ebook",
"LabelHost": "Host",
"LabelHour": "Godzina",
"LabelIcon": "Ikona",
Expand Down
3 changes: 3 additions & 0 deletions client/strings/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
"LabelDuration": "Длина",
"LabelDurationFound": "Найденная длина:",
"LabelEbook": "Ebook",
"LabelEbooks": "Ebooks",
"LabelEdit": "Редактировать",
"LabelEmail": "Email",
"LabelEmailSettingsFromAddress": "From Address",
Expand Down Expand Up @@ -251,6 +252,8 @@
"LabelGenre": "Жанр",
"LabelGenres": "Жанры",
"LabelHardDeleteFile": "Жесткое удаление файла",
"LabelHasEbook": "Has ebook",
"LabelHasSupplementaryEbook": "Has supplementary ebook",
"LabelHost": "Host",
"LabelHour": "Часы",
"LabelIcon": "Иконка",
Expand Down
3 changes: 3 additions & 0 deletions client/strings/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
"LabelDuration": "持续时间",
"LabelDurationFound": "找到持续时间:",
"LabelEbook": "Ebook",
"LabelEbooks": "Ebooks",
"LabelEdit": "编辑",
"LabelEmail": "Email",
"LabelEmailSettingsFromAddress": "From Address",
Expand Down Expand Up @@ -251,6 +252,8 @@
"LabelGenre": "流派",
"LabelGenres": "流派",
"LabelHardDeleteFile": "完全删除文件",
"LabelHasEbook": "Has ebook",
"LabelHasSupplementaryEbook": "Has supplementary ebook",
"LabelHost": "Host",
"LabelHour": "小时",
"LabelIcon": "图标",
Expand Down
5 changes: 4 additions & 1 deletion server/utils/libraryHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
getFilteredLibraryItems(libraryItems, filterBy, user, feedsArray) {
let filtered = libraryItems

const searchGroups = ['genres', 'tags', 'series', 'authors', 'progress', 'narrators', 'missing', 'languages', 'tracks']
const searchGroups = ['genres', 'tags', 'series', 'authors', 'progress', 'narrators', 'missing', 'languages', 'tracks', 'ebooks']
const group = searchGroups.find(_group => filterBy.startsWith(_group + '.'))
if (group) {
const filterVal = filterBy.replace(`${group}.`, '')
Expand Down Expand Up @@ -62,6 +62,9 @@ module.exports = {
} else if (group === 'tracks') {
if (filter === 'single') filtered = filtered.filter(li => li.isBook && li.media.numTracks === 1)
else if (filter === 'multi') filtered = filtered.filter(li => li.isBook && li.media.numTracks > 1)
} else if (group === 'ebooks') {
if (filter === 'ebook') filtered = filtered.filter(li => li.media.ebookFile)
else if (filter === 'supplementary') filtered = filtered.filter(li => li.libraryFiles.some(lf => lf.isEBookFile && lf.ino !== li.media.ebookFile?.ino))
}
} else if (filterBy === 'issues') {
filtered = filtered.filter(li => li.hasIssues)
Expand Down

0 comments on commit aae9264

Please sign in to comment.