From d9d34e87e0b034005d5c8182c9ab99d075ae9b30 Mon Sep 17 00:00:00 2001 From: advplyr Date: Tue, 5 Oct 2021 21:10:49 -0500 Subject: [PATCH] Support multi library 1.4.0 --- client/components/app/BookShelfToolbar.vue | 7 +- client/components/app/StreamContainer.vue | 5 +- client/components/controls/GlobalSearch.vue | 5 +- client/components/modals/edit-tabs/Cover.vue | 14 +- .../components/modals/edit-tabs/Details.vue | 13 +- client/components/modals/edit-tabs/Tracks.vue | 21 +- .../modals/libraries/LibraryItem.vue | 4 +- client/components/tables/TracksTable.vue | 29 ++- client/components/ui/Dropdown.vue | 15 +- client/components/ui/Tooltip.vue | 14 +- client/layouts/default.vue | 12 +- client/package.json | 2 +- client/pages/audiobook/_id/index.vue | 6 +- client/pages/config/index.vue | 25 +-- client/pages/config/log.vue | 4 +- client/pages/login.vue | 2 +- client/pages/upload/index.vue | 81 +++++++- client/store/index.js | 3 +- package.json | 2 +- server/ApiController.js | 2 +- server/BookFinder.js | 20 +- server/CoverController.js | 4 +- server/Scanner.js | 190 ++++++++++++++---- server/Server.js | 51 ++--- server/Watcher.js | 30 +-- server/objects/Audiobook.js | 35 ++-- server/objects/Book.js | 35 +++- server/objects/Library.js | 7 + server/utils/scandir.js | 2 + 29 files changed, 452 insertions(+), 188 deletions(-) diff --git a/client/components/app/BookShelfToolbar.vue b/client/components/app/BookShelfToolbar.vue index 7b6a6c02..c9dcbed9 100644 --- a/client/components/app/BookShelfToolbar.vue +++ b/client/components/app/BookShelfToolbar.vue @@ -81,14 +81,17 @@ export default { set(val) { this.$store.commit('audiobooks/setKeywordFilter', val) } + }, + currentLibraryId() { + return this.$store.state.libraries.currentLibraryId } }, methods: { searchBackArrow() { - this.$router.replace('/library') + this.$router.replace(`/library/${this.currentLibraryId}/bookshelf`) }, seriesBackArrow() { - this.$router.replace('/library/series') + this.$router.replace(`/library/${this.currentLibraryId}/bookshelf/series`) this.$emit('update:selectedSeries', null) }, updateOrder() { diff --git a/client/components/app/StreamContainer.vue b/client/components/app/StreamContainer.vue index 6a8dd596..04e5b69d 100644 --- a/client/components/app/StreamContainer.vue +++ b/client/components/app/StreamContainer.vue @@ -63,12 +63,15 @@ export default { }, playlistUrl() { return this.stream ? this.stream.clientPlaylistUri : null + }, + libraryId() { + return this.streamAudiobook ? this.streamAudiobook.libraryId : null } }, methods: { filterByAuthor() { if (this.$route.name !== 'index') { - this.$router.push('/library') + this.$router.push(`/library/${this.libraryId || this.$store.state.libraries.currentLibraryId}/bookshelf`) } var settingsUpdate = { filterBy: `authors.${this.$encode(this.author)}` diff --git a/client/components/controls/GlobalSearch.vue b/client/components/controls/GlobalSearch.vue index 58ceb275..3bd346df 100644 --- a/client/components/controls/GlobalSearch.vue +++ b/client/components/controls/GlobalSearch.vue @@ -50,12 +50,15 @@ export default { computed: { audiobooks() { return this.$store.state.audiobooks.audiobooks + }, + currentLibraryId() { + return this.$store.state.libraries.currentLibraryId } }, methods: { submitSearch() { if (!this.search) return - this.$router.push(`/library/search?query=${this.search}`) + this.$router.push(`/library/${this.currentLibraryId}/bookshelf/search?query=${this.search}`) this.search = null this.items = [] diff --git a/client/components/modals/edit-tabs/Cover.vue b/client/components/modals/edit-tabs/Cover.vue index 40d189fc..97cf9deb 100644 --- a/client/components/modals/edit-tabs/Cover.vue +++ b/client/components/modals/edit-tabs/Cover.vue @@ -33,7 +33,7 @@ @@ -124,21 +124,31 @@ export default { this.$emit('update:processing', val) } }, + audiobookId() { + return this.audiobook ? this.audiobook.id : null + }, book() { return this.audiobook ? this.audiobook.book || {} : {} }, + audiobookPath() { + return this.audiobook ? this.audiobook.path : null + }, otherFiles() { return this.audiobook ? this.audiobook.otherFiles || [] : [] }, userCanUpload() { return this.$store.getters['user/getUserCanUpload'] }, + userToken() { + return this.$store.getters['user/getToken'] + }, localCovers() { return this.otherFiles .filter((f) => f.filetype === 'image') .map((file) => { var _file = { ...file } - _file.localPath = Path.join('local', _file.path) + var imgRelPath = _file.path.replace(this.audiobookPath, '') + _file.localPath = `/s/book/${this.audiobookId}${imgRelPath}` return _file }) } diff --git a/client/components/modals/edit-tabs/Details.vue b/client/components/modals/edit-tabs/Details.vue index 3448e829..8a43f32c 100644 --- a/client/components/modals/edit-tabs/Details.vue +++ b/client/components/modals/edit-tabs/Details.vue @@ -60,8 +60,8 @@ Save Metadata - - Re-Scan + + Re-Scan
@@ -138,6 +138,13 @@ export default { }, series() { return this.$store.state.audiobooks.series + }, + libraryId() { + return this.audiobook ? this.audiobook.libraryId : null + }, + libraryScan() { + if (!this.libraryId) return null + return this.$store.getters['scanners/getLibraryScan'](this.libraryId) } }, methods: { @@ -207,6 +214,8 @@ export default { this.details.volumeNumber = this.book.volumeNumber this.details.publishYear = this.book.publishYear + console.log('INIT', this.details) + this.newTags = this.audiobook.tags || [] }, resetProgress() { diff --git a/client/components/modals/edit-tabs/Tracks.vue b/client/components/modals/edit-tabs/Tracks.vue index 5f1df561..dd88a0a6 100644 --- a/client/components/modals/edit-tabs/Tracks.vue +++ b/client/components/modals/edit-tabs/Tracks.vue @@ -13,7 +13,7 @@ Duration Download - diff --git a/client/components/tables/TracksTable.vue b/client/components/tables/TracksTable.vue index 72bf1d43..96cf9686 100644 --- a/client/components/tables/TracksTable.vue +++ b/client/components/tables/TracksTable.vue @@ -21,7 +21,7 @@ Duration Download -