From 335bbac81d88ada522cf4de0d56073c21207be2b Mon Sep 17 00:00:00 2001 From: advplyr Date: Sun, 24 Oct 2021 15:53:51 -0500 Subject: [PATCH] Add: Filter and side rail button to show books with issues #132, Add: realtime updates for audiobook progress --- client/components/AudioPlayer.vue | 9 ++++++- client/components/app/BookShelf.vue | 2 ++ client/components/app/SideRail.vue | 27 +++++++++++++++++++-- client/components/app/StreamContainer.vue | 3 --- client/components/controls/FilterSelect.vue | 5 ++++ client/layouts/default.vue | 4 +++ client/pages/audiobook/_id/index.vue | 10 -------- client/store/audiobooks.js | 10 ++++++++ client/store/user.js | 9 +++++++ server/Server.js | 15 +++++++++--- server/StreamManager.js | 9 ++++++- server/objects/Audiobook.js | 12 ++++----- server/objects/Stream.js | 6 ++--- server/objects/User.js | 5 ++++ 14 files changed, 96 insertions(+), 30 deletions(-) diff --git a/client/components/AudioPlayer.vue b/client/components/AudioPlayer.vue index cf3e8e96..5152bf39 100644 --- a/client/components/AudioPlayer.vue +++ b/client/components/AudioPlayer.vue @@ -232,6 +232,7 @@ export default { }, restart() { this.seek(0) + this.$nextTick(this.sendStreamUpdate) }, backward10() { var newTime = this.audioEl.currentTime - 10 @@ -372,7 +373,13 @@ export default { } this.updateTimestamp() - this.sendStreamUpdate() + + // Send update to server when currentTime > 0 + // this prevents errors when seeking to position not yet transcoded + // seeking to position not yet transcoded will cause audio element to set currentTime to 0 + if (this.audioEl.currentTime) { + this.sendStreamUpdate() + } this.currentTime = this.audioEl.currentTime diff --git a/client/components/app/BookShelf.vue b/client/components/app/BookShelf.vue index 6b0d2039..8cc07c03 100644 --- a/client/components/app/BookShelf.vue +++ b/client/components/app/BookShelf.vue @@ -89,6 +89,8 @@ export default { '$route.query.filter'() { if (this.$route.query.filter && this.$route.query.filter !== this.filterBy) { this.$store.dispatch('user/updateUserSettings', { filterBy: this.$route.query.filter }) + } else if (!this.$route.query.filter && this.filterBy) { + this.$store.dispatch('user/updateUserSettings', { filterBy: 'all' }) } } }, diff --git a/client/components/app/SideRail.vue b/client/components/app/SideRail.vue index f8e24c24..bd503655 100644 --- a/client/components/app/SideRail.vue +++ b/client/components/app/SideRail.vue @@ -11,14 +11,14 @@
- +

Library

-
+
@@ -31,6 +31,16 @@
+ + warning + +

Issues

+ +
+
+

{{ numIssues }}

+
+