Merge branch 'master' of github.com:mx03/audiobookshelf

This commit is contained in:
mx03 2021-12-25 20:58:40 +01:00
commit 0581fb0547
23 changed files with 149 additions and 1300 deletions

View file

@ -85,7 +85,7 @@ export default {
},
async fetchCategories() {
var categories = await this.$axios
.$get(`/api/libraries/${this.currentLibraryId}/categories`)
.$get(`/api/libraries/${this.currentLibraryId}/categories?minified=1`)
.then((data) => {
return data
})

View file

@ -54,7 +54,7 @@ export default {
pageLoadQueue: [],
isFetchingEntities: false,
scrollTimeout: null,
booksPerFetch: 250,
booksPerFetch: 100,
totalShelves: 0,
bookshelfMarginLeft: 0,
isSelectionMode: false,
@ -220,7 +220,7 @@ export default {
var entityPath = this.entityName === 'books' ? `books/all` : this.entityName
if (this.entityName === 'series-books') entityPath = `series/${this.seriesId}`
var sfQueryString = this.currentSFQueryString ? this.currentSFQueryString + '&' : ''
var fullQueryString = this.entityName === 'series-books' ? '' : `?${sfQueryString}limit=${this.booksPerFetch}&page=${page}`
var fullQueryString = this.entityName === 'series-books' ? '' : `?${sfQueryString}limit=${this.booksPerFetch}&page=${page}&minified=1`
var payload = await this.$axios.$get(`/api/libraries/${this.currentLibraryId}/${entityPath}${fullQueryString}`).catch((error) => {
console.error('failed to fetch books', error)
return null
@ -438,7 +438,7 @@ export default {
var entitiesPerShelfBefore = this.entitiesPerShelf
var { clientHeight, clientWidth } = bookshelf
console.log('Init bookshelf width', clientWidth, 'window width', window.innerWidth)
// console.log('Init bookshelf width', clientWidth, 'window width', window.innerWidth)
this.mountWindowWidth = window.innerWidth
this.bookshelfHeight = clientHeight
this.bookshelfWidth = clientWidth

View file

@ -182,6 +182,8 @@ export default {
},
streamOpen(stream) {
this.stream = stream
this.$store.commit('updateStreamAudiobook', stream.audiobook)
if (this.$refs.audioPlayer) {
console.log('[StreamContainer] streamOpen', stream)
this.openStream()

View file

@ -6,7 +6,7 @@
<span class="material-icons text-4xl">close</span>
</div>
<slot name="outer" />
<div ref="content" style="min-width: 400px; min-height: 200px" class="relative text-white" :style="{ height: modalHeight, width: modalWidth, marginTop: contentMarginTop + 'px' }" v-click-outside="clickBg">
<div ref="content" style="min-width: 400px; min-height: 200px" class="relative text-white" :style="{ height: modalHeight, width: modalWidth, marginTop: contentMarginTop + 'px' }" @mousedown="mousedownModal" @mouseup="mouseupModal" v-click-outside="clickBg">
<slot />
<div v-if="processing" class="absolute top-0 left-0 right-0 bottom-0 w-full h-full bg-black bg-opacity-60 rounded-lg flex items-center justify-center">
<ui-loading-indicator />
@ -49,7 +49,8 @@ export default {
data() {
return {
el: null,
content: null
content: null,
preventClickoutside: false
}
},
watch: {
@ -82,10 +83,20 @@ export default {
}
},
methods: {
mousedownModal() {
this.preventClickoutside = true
},
mouseupModal() {
this.preventClickoutside = false
},
clickClose() {
this.show = false
},
clickBg(ev) {
if (this.preventClickoutside) {
this.preventClickoutside = false
return
}
if (this.processing && this.persistent) return
if (ev.srcElement.classList.contains('modal-bg')) {
this.show = false

View file

@ -1,6 +1,6 @@
{
"name": "audiobookshelf-client",
"version": "1.6.46",
"version": "1.6.47",
"description": "Audiobook manager and player",
"main": "index.js",
"scripts": {

View file

@ -73,30 +73,6 @@
</li>
</transition-group>
</draggable>
<div v-if="showExperimentalFeatures" class="p-4">
<ui-btn :loading="checkingTrackNumbers" small @click="checkTrackNumbers">Check Track Numbers</ui-btn>
<div v-if="trackNumData && trackNumData.length" class="w-full max-w-4xl py-2">
<table class="tracksTable">
<tr>
<th class="text-left">Filename</th>
<th class="w-32">Index</th>
<th class="w-32"># From Metadata</th>
<th class="w-32"># From Filename</th>
<th class="w-32"># From Probe</th>
<th class="w-32">Raw Tags</th>
</tr>
<tr v-for="trackData in trackNumData" :key="trackData.filename">
<td class="text-xs">{{ trackData.filename }}</td>
<td class="text-center">{{ trackData.currentTrackNum }}</td>
<td class="text-center">{{ trackData.trackNumFromMeta }}</td>
<td class="text-center">{{ trackData.trackNumFromFilename }}</td>
<td class="text-center">{{ trackData.scanDataTrackNum }}</td>
<td class="text-left text-xs">{{ JSON.stringify(trackData.rawTags || '') }}</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</template>
@ -137,8 +113,6 @@ export default {
ghostClass: 'ghost'
},
saving: false,
checkingTrackNumbers: false,
trackNumData: [],
currentSort: 'current'
}
},
@ -252,19 +226,6 @@ export default {
})
this.currentSort = 'filename'
},
checkTrackNumbers() {
this.checkingTrackNumbers = true
this.$axios
.$get(`/api/scantracks/${this.audiobookId}`)
.then((res) => {
this.trackNumData = res
this.checkingTrackNumbers = false
})
.catch((error) => {
console.error('Failed', error)
this.checkingTrackNumbers = false
})
},
includeToggled(audio) {
var new_index = 0
if (audio.include) {

View file

@ -110,6 +110,9 @@ export const mutations = {
state.playOnLoad = true
state.streamAudiobook = audiobook
},
updateStreamAudiobook(state, audiobook) { // Initial stream audiobook is minified, on open audiobook is updated to full
state.streamAudiobook = audiobook
},
setStream(state, stream) {
state.playOnLoad = false
state.streamAudiobook = stream ? stream.audiobook : null