mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Update cover url, audiobook player speed
This commit is contained in:
		
							parent
							
								
									8fbdc1523d
								
							
						
					
					
						commit
						dee7bcb2c2
					
				@ -27,8 +27,8 @@
 | 
			
		||||
          <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>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="cursor-pointer flex items-center justify-center text-gray-300 ml-8" @mousedown.prevent @mouseup.prevent>
 | 
			
		||||
            <span class="font-mono text-lg uppercase">2x</span>
 | 
			
		||||
          <div class="flex items-center justify-center text-gray-300 ml-8" @mousedown.prevent @mouseup.prevent>
 | 
			
		||||
            <span class="font-mono text-lg uppercase text-gray-500">1x</span>
 | 
			
		||||
          </div>
 | 
			
		||||
        </template>
 | 
			
		||||
        <template v-else>
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,9 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <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">
 | 
			
		||||
      <template v-for="(shelf, index) in groupedBooks">
 | 
			
		||||
        <div :key="index" class="w-full bookshelfRow relative">
 | 
			
		||||
@ -75,6 +79,9 @@ export default {
 | 
			
		||||
    audiobooksUpdated() {
 | 
			
		||||
      console.log('[AudioBookshelf] Audiobooks Updated')
 | 
			
		||||
      this.setGroupedBooks()
 | 
			
		||||
    },
 | 
			
		||||
    scan() {
 | 
			
		||||
      this.$root.socket.emit('scan')
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
 | 
			
		||||
@ -1,10 +1,14 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="w-full h-full">
 | 
			
		||||
    <!-- <img :src="cover" class="w-40 h-60" /> -->
 | 
			
		||||
    <div class="flex">
 | 
			
		||||
      <cards-book-cover :audiobook="audiobook" />
 | 
			
		||||
      <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>
 | 
			
		||||
@ -13,6 +17,7 @@
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
  props: {
 | 
			
		||||
    processing: Boolean,
 | 
			
		||||
    audiobook: {
 | 
			
		||||
      type: Object,
 | 
			
		||||
      default: () => {}
 | 
			
		||||
@ -20,7 +25,6 @@ export default {
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      cover: 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: {
 | 
			
		||||
    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) {
 | 
			
		||||
    return jwt.sign(payload, process.env.TOKEN_SECRET, { expiresIn: '1800s' });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -198,6 +198,11 @@ class Server {
 | 
			
		||||
    var client = this.clients[socket.id]
 | 
			
		||||
    client.user = user
 | 
			
		||||
 | 
			
		||||
    if (!client.user.toJSONForBrowser) {
 | 
			
		||||
      Logger.error('Invalid user...', client.user)
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Check if user has stream open
 | 
			
		||||
    if (client.user.stream) {
 | 
			
		||||
      Logger.info('User has stream open already', client.user.stream)
 | 
			
		||||
 | 
			
		||||
@ -111,6 +111,10 @@ class StreamManager {
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
    client.stream.updateClientCurrentTime(currentTime)
 | 
			
		||||
    if (!client.user) {
 | 
			
		||||
      Logger.error('No User for client', client)
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
    client.user.updateAudiobookProgress(client.stream)
 | 
			
		||||
    this.db.updateEntity('user', client.user.toJSON())
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user