mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-30 23:27:17 +02:00
Merge pull request #967 from tonyedwardspz/master
Feature - Add a low feedback mode
This commit is contained in:
@@ -388,7 +388,6 @@ export default {
|
|||||||
if (value) {
|
if (value) {
|
||||||
const res = await AbsFileSystem.deleteTrackFromItem({ id: this.localLibraryItemId, trackLocalFileId: localFile.id, trackContentUrl: localEpisodeAudioTrack.contentUrl })
|
const res = await AbsFileSystem.deleteTrackFromItem({ id: this.localLibraryItemId, trackLocalFileId: localFile.id, trackContentUrl: localEpisodeAudioTrack.contentUrl })
|
||||||
if (res?.id) {
|
if (res?.id) {
|
||||||
this.$toast.success('Deleted episode successfully')
|
|
||||||
if (this.isLocal) {
|
if (this.isLocal) {
|
||||||
// If this is local episode then redirect to server episode when available
|
// If this is local episode then redirect to server episode when available
|
||||||
if (this.serverEpisodeId) {
|
if (this.serverEpisodeId) {
|
||||||
@@ -414,7 +413,6 @@ export default {
|
|||||||
if (value) {
|
if (value) {
|
||||||
const res = await AbsFileSystem.deleteItem(this.localLibraryItem)
|
const res = await AbsFileSystem.deleteItem(this.localLibraryItem)
|
||||||
if (res?.success) {
|
if (res?.success) {
|
||||||
this.$toast.success('Deleted successfully')
|
|
||||||
if (this.isLocal) {
|
if (this.isLocal) {
|
||||||
// If local then redirect to server version when available
|
// If local then redirect to server version when available
|
||||||
if (this.serverLibraryItemId) {
|
if (this.serverLibraryItemId) {
|
||||||
|
|||||||
@@ -58,7 +58,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Dialog } from '@capacitor/dialog'
|
|
||||||
import { AbsFileSystem, AbsDownloader } from '@/plugins/capacitor'
|
import { AbsFileSystem, AbsDownloader } from '@/plugins/capacitor'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -210,14 +209,7 @@ export default {
|
|||||||
|
|
||||||
console.log('Local folder', JSON.stringify(localFolder))
|
console.log('Local folder', JSON.stringify(localFolder))
|
||||||
|
|
||||||
var startDownloadMessage = `Start download for "${this.title}" to folder ${localFolder.name}?`
|
this.startDownload(localFolder)
|
||||||
const { value } = await Dialog.confirm({
|
|
||||||
title: 'Confirm',
|
|
||||||
message: startDownloadMessage
|
|
||||||
})
|
|
||||||
if (value) {
|
|
||||||
this.startDownload(localFolder)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async startDownload(localFolder) {
|
async startDownload(localFolder) {
|
||||||
var payload = {
|
var payload = {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
<div v-if="userCanDownload">
|
<div v-if="userCanDownload">
|
||||||
<span v-if="isLocal" class="material-icons-outlined px-2 text-success text-lg">audio_file</span>
|
<span v-if="isLocal" class="material-icons-outlined px-2 text-success text-lg">audio_file</span>
|
||||||
<span v-else-if="!localEpisode" class="material-icons mx-1.5 mt-2 text-xl" :class="downloadItem ? 'animate-bounce text-warning text-opacity-75' : ''" @click.stop="downloadClick">{{ downloadItem ? 'downloading' : 'download' }}</span>
|
<span v-else-if="!localEpisode" class="material-icons mx-1.5 mt-2 text-xl" :class="downloadItem || pendingDownload ? 'animate-bounce text-warning text-opacity-75' : ''" @click.stop="downloadClick">{{ downloadItem || pendingDownload ? 'downloading' : 'download' }}</span>
|
||||||
<span v-else class="material-icons px-2 text-success text-xl">download_done</span>
|
<span v-else class="material-icons px-2 text-success text-xl">download_done</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -58,7 +58,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Dialog } from '@capacitor/dialog'
|
|
||||||
import { AbsFileSystem, AbsDownloader } from '@/plugins/capacitor'
|
import { AbsFileSystem, AbsDownloader } from '@/plugins/capacitor'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -78,6 +77,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isProcessingReadUpdate: false,
|
isProcessingReadUpdate: false,
|
||||||
|
pendingDownload: false,
|
||||||
processing: false
|
processing: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -175,14 +175,16 @@ export default {
|
|||||||
return folderObj
|
return folderObj
|
||||||
},
|
},
|
||||||
async downloadClick() {
|
async downloadClick() {
|
||||||
if (this.downloadItem) return
|
if (this.downloadItem || this.pendingDownload) return
|
||||||
|
this.pendingDownload = true
|
||||||
await this.$hapticsImpact()
|
await this.$hapticsImpact()
|
||||||
if (this.isIos) {
|
if (this.isIos) {
|
||||||
// no local folders on iOS
|
// no local folders on iOS
|
||||||
this.startDownload()
|
await this.startDownload()
|
||||||
} else {
|
} else {
|
||||||
this.download()
|
await this.download()
|
||||||
}
|
}
|
||||||
|
this.pendingDownload = false
|
||||||
},
|
},
|
||||||
async download(selectedLocalFolder = null) {
|
async download(selectedLocalFolder = null) {
|
||||||
let localFolder = selectedLocalFolder
|
let localFolder = selectedLocalFolder
|
||||||
@@ -216,14 +218,7 @@ export default {
|
|||||||
|
|
||||||
console.log('Local folder', JSON.stringify(localFolder))
|
console.log('Local folder', JSON.stringify(localFolder))
|
||||||
|
|
||||||
var startDownloadMessage = `Start download for "${this.title}" to folder ${localFolder.name}?`
|
return this.startDownload(localFolder)
|
||||||
const { value } = await Dialog.confirm({
|
|
||||||
title: 'Confirm',
|
|
||||||
message: startDownloadMessage
|
|
||||||
})
|
|
||||||
if (value) {
|
|
||||||
this.startDownload(localFolder)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async startDownload(localFolder) {
|
async startDownload(localFolder) {
|
||||||
var payload = {
|
var payload = {
|
||||||
@@ -238,6 +233,8 @@ export default {
|
|||||||
var errorMsg = downloadRes.error || 'Unknown error'
|
var errorMsg = downloadRes.error || 'Unknown error'
|
||||||
console.error('Download error', errorMsg)
|
console.error('Download error', errorMsg)
|
||||||
this.$toast.error(errorMsg)
|
this.$toast.error(errorMsg)
|
||||||
|
} else {
|
||||||
|
console.log('Download completed', JSON.stringify(downloadRes))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async playClick() {
|
async playClick() {
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ export default {
|
|||||||
if (!data.localLibraryItem) {
|
if (!data.localLibraryItem) {
|
||||||
this.$toast.error(this.$strings.MessageItemDownloadCompleteFailedToCreate)
|
this.$toast.error(this.$strings.MessageItemDownloadCompleteFailedToCreate)
|
||||||
} else {
|
} else {
|
||||||
this.$toast.success(`Item "${data.localLibraryItem.media.metadata.title}" download finished`)
|
|
||||||
this.$eventBus.$emit('new-local-library-item', data.localLibraryItem)
|
this.$eventBus.$emit('new-local-library-item', data.localLibraryItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export default {
|
|||||||
recentEpisodes: [],
|
recentEpisodes: [],
|
||||||
totalEpisodes: 0,
|
totalEpisodes: 0,
|
||||||
currentPage: 0,
|
currentPage: 0,
|
||||||
localEpisodeMap: {},
|
localLibraryItems: [],
|
||||||
isLocal: false,
|
isLocal: false,
|
||||||
loadedLibraryId: null
|
loadedLibraryId: null
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,24 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
currentLibraryId() {
|
currentLibraryId() {
|
||||||
return this.$store.state.libraries.currentLibraryId
|
return this.$store.state.libraries.currentLibraryId
|
||||||
|
},
|
||||||
|
localEpisodes() {
|
||||||
|
const episodes = []
|
||||||
|
this.localLibraryItems.forEach((li) => {
|
||||||
|
if (li.media.episodes?.length) {
|
||||||
|
episodes.push(...li.media.episodes)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return episodes
|
||||||
|
},
|
||||||
|
localEpisodeMap() {
|
||||||
|
var epmap = {}
|
||||||
|
this.localEpisodes.forEach((localEp) => {
|
||||||
|
if (localEp.serverEpisodeId) {
|
||||||
|
epmap[localEp.serverEpisodeId] = localEp
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return epmap
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -61,14 +79,31 @@ export default {
|
|||||||
this.$router.replace('/bookshelf')
|
this.$router.replace('/bookshelf')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
async loadLocalPodcastLibraryItems() {
|
||||||
|
this.localLibraryItems = await this.$db.getLocalLibraryItems('podcast')
|
||||||
|
},
|
||||||
|
newLocalLibraryItem(item) {
|
||||||
|
if (item.mediaType !== 'podcast') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const matchingLocalLibraryItem = this.localLibraryItems.find((lli) => lli.id === item.id)
|
||||||
|
if (matchingLocalLibraryItem) {
|
||||||
|
matchingLocalLibraryItem.media.episodes = item.media.episodes
|
||||||
|
} else {
|
||||||
|
this.localLibraryItems.push(item)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadRecentEpisodes()
|
this.loadRecentEpisodes()
|
||||||
|
this.loadLocalPodcastLibraryItems()
|
||||||
this.$eventBus.$on('library-changed', this.libraryChanged)
|
this.$eventBus.$on('library-changed', this.libraryChanged)
|
||||||
|
this.$eventBus.$on('new-local-library-item', this.newLocalLibraryItem)
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.$eventBus.$off('library-changed', this.libraryChanged)
|
this.$eventBus.$off('library-changed', this.libraryChanged)
|
||||||
|
this.$eventBus.$off('new-local-library-item', this.newLocalLibraryItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -316,7 +316,6 @@ export default {
|
|||||||
if (value) {
|
if (value) {
|
||||||
const res = await AbsFileSystem.deleteTrackFromItem({ id: this.localLibraryItemId, trackLocalFileId: localFile.id, trackContentUrl: localEpisodeAudioTrack.contentUrl })
|
const res = await AbsFileSystem.deleteTrackFromItem({ id: this.localLibraryItemId, trackLocalFileId: localFile.id, trackContentUrl: localEpisodeAudioTrack.contentUrl })
|
||||||
if (res?.id) {
|
if (res?.id) {
|
||||||
this.$toast.success('Deleted episode successfully')
|
|
||||||
if (this.isLocal) {
|
if (this.isLocal) {
|
||||||
// If this is local episode then redirect to server episode when available
|
// If this is local episode then redirect to server episode when available
|
||||||
if (this.serverEpisodeId) {
|
if (this.serverEpisodeId) {
|
||||||
@@ -398,14 +397,7 @@ export default {
|
|||||||
|
|
||||||
console.log('Local folder', JSON.stringify(localFolder))
|
console.log('Local folder', JSON.stringify(localFolder))
|
||||||
|
|
||||||
const startDownloadMessage = `Start download for "${this.title}" to folder ${localFolder.name}?`
|
this.startDownload(localFolder)
|
||||||
const { value } = await Dialog.confirm({
|
|
||||||
title: 'Confirm',
|
|
||||||
message: startDownloadMessage
|
|
||||||
})
|
|
||||||
if (value) {
|
|
||||||
this.startDownload(localFolder)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async selectFolder() {
|
async selectFolder() {
|
||||||
const folderObj = await AbsFileSystem.selectFolder({ mediaType: this.mediaType })
|
const folderObj = await AbsFileSystem.selectFolder({ mediaType: this.mediaType })
|
||||||
@@ -518,7 +510,6 @@ export default {
|
|||||||
this.$nativeHttp
|
this.$nativeHttp
|
||||||
.delete(`/api/podcasts/${this.serverLibraryItemId}/episode/${this.serverEpisodeId}?hard=1`)
|
.delete(`/api/podcasts/${this.serverLibraryItemId}/episode/${this.serverEpisodeId}?hard=1`)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$toast.success('Episode deleted from server')
|
|
||||||
this.$router.replace(`/item/${this.serverLibraryItemId}`)
|
this.$router.replace(`/item/${this.serverLibraryItemId}`)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
@@ -40,12 +40,6 @@
|
|||||||
<div v-else-if="currentServerConnectionConfigId && !isLocalMatchingConnectionConfig" class="w-full rounded-md bg-warning/10 border border-warning p-4">
|
<div v-else-if="currentServerConnectionConfigId && !isLocalMatchingConnectionConfig" class="w-full rounded-md bg-warning/10 border border-warning p-4">
|
||||||
<p class="text-sm">Media is linked to a different server connection config. Downloaded User Id: {{ localLibraryItem.serverUserId }}. Downloaded Server Address: {{ localLibraryItem.serverAddress }}. Currently connected User Id: {{ user.id }}. Currently connected server address: {{ currentServerAddress }}.</p>
|
<p class="text-sm">Media is linked to a different server connection config. Downloaded User Id: {{ localLibraryItem.serverUserId }}. Downloaded Server Address: {{ localLibraryItem.serverAddress }}. Currently connected User Id: {{ user.id }}. Currently connected server address: {{ currentServerAddress }}.</p>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="isLocalMatchingConnectionConfig" class="w-full rounded-md bg-success/10 border border-success p-4">
|
|
||||||
<p class="text-sm">{{ $strings.MessageMediaLinkedToThisServer }}</p>
|
|
||||||
</div>
|
|
||||||
<div v-else-if="isLocal && libraryItem.serverAddress" class="w-full rounded-md bg-slate-300/10 border border-slate-300 p-4">
|
|
||||||
<p class="text-sm">{{ $getString('MessageMediaLinkedToServer', [libraryItem.serverAddress]) }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- action buttons -->
|
<!-- action buttons -->
|
||||||
@@ -615,7 +609,6 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log('Local folder', JSON.stringify(localFolder))
|
console.log('Local folder', JSON.stringify(localFolder))
|
||||||
|
|
||||||
let startDownloadMessage = `Start download for "${this.title}" with ${this.numTracks} audio track${this.numTracks == 1 ? '' : 's'} to folder ${localFolder.name}?`
|
let startDownloadMessage = `Start download for "${this.title}" with ${this.numTracks} audio track${this.numTracks == 1 ? '' : 's'} to folder ${localFolder.name}?`
|
||||||
if (!this.isIos && this.showRead) {
|
if (!this.isIos && this.showRead) {
|
||||||
if (this.numTracks > 0) {
|
if (this.numTracks > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user