mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
Update cover url, audiobook player speed
This commit is contained in:
parent
4736fa1468
commit
033cc3ffe1
@ -27,8 +27,8 @@
|
|||||||
<div class="cursor-pointer flex items-center justify-center text-gray-300" @mousedown.prevent @mouseup.prevent @click.stop="forward10">
|
<div class="cursor-pointer flex items-center justify-center text-gray-300" @mousedown.prevent @mouseup.prevent @click.stop="forward10">
|
||||||
<span class="material-icons text-3xl">forward_10</span>
|
<span class="material-icons text-3xl">forward_10</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="cursor-pointer flex items-center justify-center text-gray-300 ml-8" @mousedown.prevent @mouseup.prevent>
|
<div class="flex items-center justify-center text-gray-300 ml-8" @mousedown.prevent @mouseup.prevent>
|
||||||
<span class="font-mono text-lg uppercase">2x</span>
|
<span class="font-mono text-lg uppercase text-gray-500">1x</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="bookshelf" ref="wrapper" class="w-full h-full overflow-y-auto">
|
<div id="bookshelf" ref="wrapper" class="w-full h-full overflow-y-auto">
|
||||||
|
<div v-if="!audiobooks.length" class="w-full flex flex-col items-center justify-center py-12">
|
||||||
|
<p class="text-center text-2xl font-book mb-4">Your Audiobookshelf is empty!</p>
|
||||||
|
<ui-btn color="success" @click="scan">Scan your Audiobooks</ui-btn>
|
||||||
|
</div>
|
||||||
<div class="w-full flex flex-col items-center">
|
<div class="w-full flex flex-col items-center">
|
||||||
<template v-for="(shelf, index) in groupedBooks">
|
<template v-for="(shelf, index) in groupedBooks">
|
||||||
<div :key="index" class="w-full bookshelfRow relative">
|
<div :key="index" class="w-full bookshelfRow relative">
|
||||||
@ -75,6 +79,9 @@ export default {
|
|||||||
audiobooksUpdated() {
|
audiobooksUpdated() {
|
||||||
console.log('[AudioBookshelf] Audiobooks Updated')
|
console.log('[AudioBookshelf] Audiobooks Updated')
|
||||||
this.setGroupedBooks()
|
this.setGroupedBooks()
|
||||||
|
},
|
||||||
|
scan() {
|
||||||
|
this.$root.socket.emit('scan')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="w-full h-full">
|
<div class="w-full h-full">
|
||||||
<!-- <img :src="cover" class="w-40 h-60" /> -->
|
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<cards-book-cover :audiobook="audiobook" />
|
<cards-book-cover :audiobook="audiobook" />
|
||||||
<div class="flex-grow px-8">
|
<div class="flex-grow px-8">
|
||||||
<ui-text-input-with-label v-model="imageUrl" label="Image URL" />
|
<form @submit.prevent="submitForm">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<ui-text-input-with-label v-model="imageUrl" label="Cover Image URL" />
|
||||||
|
<ui-btn color="success" type="submit" :padding-x="4" class="mt-5 ml-4">Update</ui-btn>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -13,6 +17,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
processing: Boolean,
|
||||||
audiobook: {
|
audiobook: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {}
|
default: () => {}
|
||||||
@ -20,7 +25,6 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
cover: null,
|
|
||||||
imageUrl: null
|
imageUrl: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -32,10 +36,41 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {
|
||||||
|
isProcessing: {
|
||||||
|
get() {
|
||||||
|
return this.processing
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.$emit('update:processing', val)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
book() {
|
||||||
|
return this.audiobook ? this.audiobook.book || {} : {}
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
this.cover = this.audiobook.cover || '/book_placeholder.jpg'
|
this.imageUrl = this.book.cover || ''
|
||||||
|
},
|
||||||
|
async submitForm() {
|
||||||
|
console.log('Submit form', this.details)
|
||||||
|
this.isProcessing = true
|
||||||
|
const updatePayload = {
|
||||||
|
book: {
|
||||||
|
cover: this.imageUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var updatedAudiobook = await this.$axios.$patch(`/api/audiobook/${this.audiobook.id}`, updatePayload).catch((error) => {
|
||||||
|
console.error('Failed to update', error)
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
this.isProcessing = false
|
||||||
|
if (updatedAudiobook) {
|
||||||
|
console.log('Update Successful', updatedAudiobook)
|
||||||
|
this.$toast.success('Update Successful')
|
||||||
|
this.$emit('close')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,18 +68,6 @@ class Auth {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAuth(req) {
|
|
||||||
if (req.signedCookies.user) {
|
|
||||||
var user = this.users.find(u => u.username = req.signedCookies.user)
|
|
||||||
if (user) {
|
|
||||||
delete user.pash
|
|
||||||
}
|
|
||||||
return user
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
generateAccessToken(payload) {
|
generateAccessToken(payload) {
|
||||||
return jwt.sign(payload, process.env.TOKEN_SECRET, { expiresIn: '1800s' });
|
return jwt.sign(payload, process.env.TOKEN_SECRET, { expiresIn: '1800s' });
|
||||||
}
|
}
|
||||||
|
@ -198,6 +198,11 @@ class Server {
|
|||||||
var client = this.clients[socket.id]
|
var client = this.clients[socket.id]
|
||||||
client.user = user
|
client.user = user
|
||||||
|
|
||||||
|
if (!client.user.toJSONForBrowser) {
|
||||||
|
Logger.error('Invalid user...', client.user)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Check if user has stream open
|
// Check if user has stream open
|
||||||
if (client.user.stream) {
|
if (client.user.stream) {
|
||||||
Logger.info('User has stream open already', client.user.stream)
|
Logger.info('User has stream open already', client.user.stream)
|
||||||
|
@ -111,6 +111,10 @@ class StreamManager {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
client.stream.updateClientCurrentTime(currentTime)
|
client.stream.updateClientCurrentTime(currentTime)
|
||||||
|
if (!client.user) {
|
||||||
|
Logger.error('No User for client', client)
|
||||||
|
return
|
||||||
|
}
|
||||||
client.user.updateAudiobookProgress(client.stream)
|
client.user.updateAudiobookProgress(client.stream)
|
||||||
this.db.updateEntity('user', client.user.toJSON())
|
this.db.updateEntity('user', client.user.toJSON())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user