diff --git a/client/pages/config/users/_id.vue b/client/pages/config/users/_id.vue
index e9e052ba..84917ce7 100644
--- a/client/pages/config/users/_id.vue
+++ b/client/pages/config/users/_id.vue
@@ -43,7 +43,7 @@
-
+
|
{{ ab.book ? ab.book.title : ab.audiobookTitle || 'Unknown' }}
@@ -87,6 +87,12 @@ export default {
}
},
computed: {
+ coverAspectRatio() {
+ return this.$store.getters['getServerSetting']('coverAspectRatio')
+ },
+ bookCoverAspectRatio() {
+ return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
+ },
showExperimentalFeatures() {
return this.$store.state.showExperimentalFeatures
},
diff --git a/client/pages/library/_library/authors/index.vue b/client/pages/library/_library/authors/index.vue
new file mode 100644
index 00000000..b9553e33
--- /dev/null
+++ b/client/pages/library/_library/authors/index.vue
@@ -0,0 +1,61 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/client/pages/library/_library/bookshelf/_id.vue b/client/pages/library/_library/bookshelf/_id.vue
index 99ecf2e9..78b183b4 100644
--- a/client/pages/library/_library/bookshelf/_id.vue
+++ b/client/pages/library/_library/bookshelf/_id.vue
@@ -23,11 +23,6 @@ export default {
if (query.filter) {
store.dispatch('user/updateUserSettings', { filterBy: query.filter })
}
-
- // if (libraryPage === 'collections') {
- // store.dispatch('user/loadUserCollections')
- // }
-
return {
id: params.id || '',
libraryId
diff --git a/client/store/index.js b/client/store/index.js
index 1f49dd61..35622679 100644
--- a/client/store/index.js
+++ b/client/store/index.js
@@ -32,6 +32,10 @@ export const getters = {
if (!state.serverSettings) return null
return state.serverSettings[key]
},
+ getBookCoverAspectRatio: state => {
+ if (!state.serverSettings || !state.serverSettings.coverAspectRatio) return 1.6
+ return state.serverSettings.coverAspectRatio === 0 ? 1.6 : 1
+ },
getNumAudiobooksSelected: state => state.selectedAudiobooks.length,
getAudiobookIdStreaming: state => {
return state.streamAudiobook ? state.streamAudiobook.id : null
diff --git a/server/ApiController.js b/server/ApiController.js
index f161e589..c23a787e 100644
--- a/server/ApiController.js
+++ b/server/ApiController.js
@@ -62,6 +62,7 @@ class ApiController {
this.router.get('/libraries/:id/filters', LibraryController.middleware.bind(this), LibraryController.getLibraryFilters.bind(this))
this.router.get('/libraries/:id/search', LibraryController.middleware.bind(this), LibraryController.search.bind(this))
this.router.get('/libraries/:id/stats', LibraryController.middleware.bind(this), LibraryController.stats.bind(this))
+ this.router.get('/libraries/:id/authors', LibraryController.middleware.bind(this), LibraryController.getAuthors.bind(this))
this.router.patch('/libraries/order', LibraryController.reorder.bind(this))
// TEMP: Support old syntax for mobile app
diff --git a/server/controllers/LibraryController.js b/server/controllers/LibraryController.js
index 71a5f1ef..99e0d563 100644
--- a/server/controllers/LibraryController.js
+++ b/server/controllers/LibraryController.js
@@ -191,7 +191,7 @@ class LibraryController {
return ab.book.volumeNumber
})
res.json({
- results: audiobooks,
+ results: audiobooks.map(ab => ab.toJSONExpanded()),
total: audiobooks.length
})
}
@@ -319,7 +319,7 @@ class LibraryController {
var queryResult = ab.searchQuery(req.query.q)
if (queryResult.book) {
var bookMatchObj = {
- audiobook: ab,
+ audiobook: ab.toJSONExpanded(),
matchKey: queryResult.book,
matchText: queryResult.bookMatchText
}
@@ -329,8 +329,11 @@ class LibraryController {
queryResult.authors.forEach((author) => {
if (!authorMatches[author]) {
authorMatches[author] = {
- author: author
+ author: author,
+ numBooks: 1
}
+ } else {
+ authorMatches[author].numBooks++
}
})
}
@@ -338,10 +341,10 @@ class LibraryController {
if (!seriesMatches[queryResult.series]) {
seriesMatches[queryResult.series] = {
series: queryResult.series,
- audiobooks: [ab]
+ audiobooks: [ab.toJSONExpanded()]
}
} else {
- seriesMatches[queryResult.series].audiobooks.push(ab)
+ seriesMatches[queryResult.series].audiobooks.push(ab.toJSONExpanded())
}
}
if (queryResult.tags && queryResult.tags.length) {
@@ -349,10 +352,10 @@ class LibraryController {
if (!tagMatches[tag]) {
tagMatches[tag] = {
tag,
- audiobooks: [ab]
+ audiobooks: [ab.toJSONExpanded()]
}
} else {
- tagMatches[tag].audiobooks.push(ab)
+ tagMatches[tag].audiobooks.push(ab.toJSONExpanded())
}
})
}
@@ -383,6 +386,27 @@ class LibraryController {
res.json(stats)
}
+ async getAuthors(req, res) {
+ var audiobooksInLibrary = this.db.audiobooks.filter(ab => ab.libraryId === req.library.id)
+ var authors = {}
+ audiobooksInLibrary.forEach((ab) => {
+ if (ab.book._authorsList.length) {
+ ab.book._authorsList.forEach((author) => {
+ if (!author) return
+ if (!authors[author]) {
+ authors[author] = {
+ name: author,
+ numBooks: 1
+ }
+ } else {
+ authors[author].numBooks++
+ }
+ })
+ }
+ })
+ res.json(Object.values(authors))
+ }
+
middleware(req, res, next) {
var library = this.db.libraries.find(lib => lib.id === req.params.id)
if (!library) {
|