@@ -49,7 +56,8 @@ export default {
book: {
type: Object,
default: () => {}
- }
+ },
+ isDragging: Boolean
},
data() {
return {
@@ -64,6 +72,13 @@ export default {
handler(newVal) {
this.isRead = newVal
}
+ },
+ isDragging: {
+ handler(newVal) {
+ if (newVal) {
+ this.isHovering = false
+ }
+ }
}
},
computed: {
@@ -79,6 +94,21 @@ export default {
bookDuration() {
return this.$secondsToTimestamp(this.book.duration)
},
+ isMissing() {
+ return this.book.isMissing
+ },
+ isIncomplete() {
+ return this.book.isIncomplete
+ },
+ numTracks() {
+ return this.book.numTracks
+ },
+ isStreaming() {
+ return this.$store.getters['getAudiobookIdStreaming'] === this.book.id
+ },
+ showPlayBtn() {
+ return !this.isMissing && !this.isIncomplete && !this.isStreaming && this.numTracks
+ },
userAudiobooks() {
return this.$store.state.user.user ? this.$store.state.user.user.audiobooks || {} : {}
},
@@ -91,12 +121,16 @@ export default {
},
methods: {
mouseover() {
+ if (this.isDragging) return
this.isHovering = true
},
mouseleave() {
this.isHovering = false
},
- clickRemove() {},
+ playClick() {
+ this.$store.commit('setStreamAudiobook', this.book)
+ this.$root.socket.emit('open_stream', this.book.id)
+ },
clickEdit() {
this.$emit('edit', this.book)
},
diff --git a/client/middleware/routed.js b/client/middleware/routed.js
index abd9cf77..c5eac0be 100644
--- a/client/middleware/routed.js
+++ b/client/middleware/routed.js
@@ -11,8 +11,14 @@ export default function (context) {
return
}
+ if (store.state.isRoutingBack) {
+ // pressing back button in appbar do not add to route history
+ store.commit('setIsRoutingBack', false)
+ return
+ }
+
if (route.name.startsWith('config') || route.name === 'upload' || route.name === 'account' || route.name.startsWith('audiobook-id') || route.name.startsWith('collection-id')) {
- if (from.name !== route.name && from.name !== 'audiobook-id-edit' && from.name !== 'collection-id' && !from.name.startsWith('config') && from.name !== 'upload' && from.name !== 'account') {
+ if (from.name !== route.name && from.name !== 'audiobook-id-edit' && !from.name.startsWith('config') && from.name !== 'upload' && from.name !== 'account') {
var _history = [...store.state.routeHistory]
if (!_history.length || _history[_history.length - 1] !== from.fullPath) {
_history.push(from.fullPath)
diff --git a/client/package.json b/client/package.json
index 5793a3e3..8cad2fc1 100644
--- a/client/package.json
+++ b/client/package.json
@@ -1,6 +1,6 @@
{
"name": "audiobookshelf-client",
- "version": "1.6.10",
+ "version": "1.6.11",
"description": "Audiobook manager and player",
"main": "index.js",
"scripts": {
diff --git a/client/pages/collection/_id.vue b/client/pages/collection/_id.vue
index d619e175..5d447918 100644
--- a/client/pages/collection/_id.vue
+++ b/client/pages/collection/_id.vue
@@ -14,6 +14,11 @@
+
+ play_arrow
+ {{ streaming ? 'Streaming' : 'Play' }}
+
+
@@ -75,6 +80,20 @@ export default {
},
collection() {
return this.$store.getters['user/getCollection'](this.collectionId)
+ },
+ playableBooks() {
+ return this.bookItems.filter((book) => {
+ return !book.isMissing && !book.isIncomplete && book.numTracks
+ })
+ },
+ streaming() {
+ return !!this.playableBooks.find((b) => b.id === this.$store.getters['getAudiobookIdStreaming'])
+ },
+ showPlayButton() {
+ return this.playableBooks.length
+ },
+ userAudiobooks() {
+ return this.$store.state.user.user ? this.$store.state.user.user.audiobooks || {} : {}
}
},
methods: {
@@ -98,13 +117,15 @@ export default {
})
}
},
- collectionsUpdated() {
- // this.collectionCopy = { ...this.collection }
+ clickPlay() {
+ var nextBookNotRead = this.playableBooks.find((pb) => !this.userAudiobooks[pb.id] || !this.userAudiobooks[pb.id].isRead)
+ if (nextBookNotRead) {
+ this.$store.commit('setStreamAudiobook', nextBookNotRead)
+ this.$root.socket.emit('open_stream', nextBookNotRead.id)
+ }
}
},
- mounted() {
- // this.$store.commit('user/addCollectionsListener', { meth: this.collectionsUpdated, key: 'collection-page' })
- },
+ mounted() {},
beforeDestroy() {}
}
\ 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 f7cfb741..06abf99e 100644
--- a/client/pages/library/_library/bookshelf/_id.vue
+++ b/client/pages/library/_library/bookshelf/_id.vue
@@ -98,7 +98,6 @@ export default {
})
this.searchQuery = query
}
- },
- mounted() {}
+ }
}
\ No newline at end of file
diff --git a/client/store/index.js b/client/store/index.js
index 9810c1fb..958379ea 100644
--- a/client/store/index.js
+++ b/client/store/index.js
@@ -16,6 +16,7 @@ export const state = () => ({
processingBatch: false,
previousPath: '/',
routeHistory: [],
+ isRoutingBack: false,
showExperimentalFeatures: false,
backups: [],
bookshelfBookIds: [],
@@ -78,6 +79,9 @@ export const mutations = {
setRouteHistory(state, val) {
state.routeHistory = val
},
+ setIsRoutingBack(state, val) {
+ state.isRoutingBack = val
+ },
setPreviousPath(state, val) {
state.previousPath = val
},
diff --git a/client/store/user.js b/client/store/user.js
index 67e65a08..ba6aaa86 100644
--- a/client/store/user.js
+++ b/client/store/user.js
@@ -136,6 +136,7 @@ export const mutations = {
setCollections(state, collections) {
state.collectionsLoaded = true
state.collections = collections
+ state.collectionsListeners.forEach((listener) => listener.meth())
},
addUpdateCollection(state, collection) {
var index = state.collections.findIndex(c => c.id === collection.id)
diff --git a/package.json b/package.json
index e0003dfd..b126d8b5 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "audiobookshelf",
- "version": "1.6.10",
+ "version": "1.6.11",
"description": "Self-hosted audiobook server for managing and playing audiobooks",
"main": "index.js",
"scripts": {