mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-29 06:37:16 +02:00
Update:Android remove folder scanning and ffmpegkit
This commit is contained in:
@@ -11,10 +11,7 @@
|
||||
|
||||
<p class="mb-2 text-base text-white">Local Library Items ({{ localLibraryItems.length }})</p>
|
||||
|
||||
<div v-if="isScanning" class="w-full text-center p-4">
|
||||
<p>Scanning...</p>
|
||||
</div>
|
||||
<div v-else class="w-full media-item-container overflow-y-auto">
|
||||
<div class="w-full media-item-container overflow-y-auto">
|
||||
<template v-for="localLibraryItem in localLibraryItems">
|
||||
<nuxt-link :to="`/localMedia/item/${localLibraryItem.id}`" :key="localLibraryItem.id" class="flex my-1">
|
||||
<div class="w-12 h-12 min-w-12 min-h-12 bg-primary">
|
||||
@@ -43,15 +40,13 @@ import { AbsFileSystem } from '@/plugins/capacitor'
|
||||
export default {
|
||||
asyncData({ params, query }) {
|
||||
return {
|
||||
folderId: params.id,
|
||||
shouldScan: !!query.scan
|
||||
folderId: params.id
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
localLibraryItems: [],
|
||||
folder: null,
|
||||
isScanning: false,
|
||||
removingFolder: false,
|
||||
showDialog: false
|
||||
}
|
||||
@@ -68,20 +63,7 @@ export default {
|
||||
},
|
||||
dialogItems() {
|
||||
if (this.isInternalStorage) return []
|
||||
const items = [
|
||||
{
|
||||
text: 'Scan',
|
||||
value: 'scan'
|
||||
}
|
||||
]
|
||||
|
||||
if (this.localLibraryItems.length) {
|
||||
items.push({
|
||||
text: 'Force Re-Scan',
|
||||
value: 'rescan'
|
||||
})
|
||||
}
|
||||
|
||||
const items = []
|
||||
items.push({
|
||||
text: 'Remove',
|
||||
value: 'remove'
|
||||
@@ -107,11 +89,7 @@ export default {
|
||||
},
|
||||
dialogAction(action) {
|
||||
console.log('Dialog action', action)
|
||||
if (action == 'scan') {
|
||||
this.scanFolder()
|
||||
} else if (action == 'rescan') {
|
||||
this.scanFolder(true)
|
||||
} else if (action == 'remove') {
|
||||
if (action == 'remove') {
|
||||
this.removeFolder()
|
||||
}
|
||||
this.showDialog = false
|
||||
@@ -135,37 +113,6 @@ export default {
|
||||
play(mediaItem) {
|
||||
this.$eventBus.$emit('play-item', { libraryItemId: mediaItem.id })
|
||||
},
|
||||
async scanFolder(forceAudioProbe = false) {
|
||||
this.isScanning = true
|
||||
var response = await AbsFileSystem.scanFolder({ folderId: this.folderId, forceAudioProbe })
|
||||
|
||||
if (response && response.localLibraryItems) {
|
||||
var itemsAdded = response.itemsAdded
|
||||
var itemsUpdated = response.itemsUpdated
|
||||
var itemsRemoved = response.itemsRemoved
|
||||
var itemsUpToDate = response.itemsUpToDate
|
||||
var toastMessages = []
|
||||
if (itemsAdded) toastMessages.push(`${itemsAdded} Added`)
|
||||
if (itemsUpdated) toastMessages.push(`${itemsUpdated} Updated`)
|
||||
if (itemsRemoved) toastMessages.push(`${itemsRemoved} Removed`)
|
||||
if (itemsUpToDate) toastMessages.push(`${itemsUpToDate} Up-to-date`)
|
||||
this.$toast.info(`Folder scan complete:\n${toastMessages.join(' | ')}`)
|
||||
|
||||
// When all items are up-to-date then local media items are not returned
|
||||
if (response.localLibraryItems.length) {
|
||||
this.localLibraryItems = response.localLibraryItems.map((mi) => {
|
||||
if (mi.coverContentUrl) {
|
||||
mi.coverPathSrc = Capacitor.convertFileSrc(mi.coverContentUrl)
|
||||
}
|
||||
return mi
|
||||
})
|
||||
console.log('Set Local Media Items', this.localLibraryItems.length)
|
||||
}
|
||||
} else {
|
||||
console.log('No Local media items found')
|
||||
}
|
||||
this.isScanning = false
|
||||
},
|
||||
async init() {
|
||||
var folder = await this.$db.getLocalFolder(this.folderId)
|
||||
this.folder = folder
|
||||
@@ -179,10 +126,6 @@ export default {
|
||||
coverPathSrc: lmi.coverContentUrl ? Capacitor.convertFileSrc(lmi.coverContentUrl) : null
|
||||
}
|
||||
})
|
||||
|
||||
if (this.shouldScan) {
|
||||
this.scanFolder()
|
||||
}
|
||||
},
|
||||
newLocalLibraryItem(item) {
|
||||
if (item.folderId == this.folderId) {
|
||||
|
||||
@@ -86,8 +86,6 @@ export default {
|
||||
} else {
|
||||
this.$toast.success('Folder permission success')
|
||||
}
|
||||
|
||||
this.$router.push(`/localMedia/folders/${folderObj.id}?scan=1`)
|
||||
},
|
||||
async init() {
|
||||
const androidSdkVersion = await this.$getAndroidSDKVersion()
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
|
||||
<p class="px-2 mb-4 text-xs text-gray-400">{{ libraryItemId ? 'Linked to item on server ' + liServerAddress : 'Not linked to server item' }}</p>
|
||||
|
||||
<div v-if="isScanning" class="w-full text-center p-4">
|
||||
<p>Scanning...</p>
|
||||
</div>
|
||||
<div v-else class="w-full max-w-full media-item-container overflow-y-auto overflow-x-hidden relative pb-4" :class="{ 'media-order-changed': orderChanged }">
|
||||
<div class="w-full max-w-full media-item-container overflow-y-auto overflow-x-hidden relative pb-4" :class="{ 'media-order-changed': orderChanged }">
|
||||
<div v-if="!isPodcast && audioTracksCopy.length" class="w-full py-2">
|
||||
<p class="text-base mb-2">Audio Tracks ({{ audioTracks.length }})</p>
|
||||
|
||||
@@ -148,7 +145,6 @@ export default {
|
||||
removingItem: false,
|
||||
folderId: null,
|
||||
folder: null,
|
||||
isScanning: false,
|
||||
showDialog: false,
|
||||
selectedAudioTrack: null,
|
||||
selectedEpisode: null,
|
||||
@@ -229,19 +225,17 @@ export default {
|
||||
}
|
||||
]
|
||||
} else {
|
||||
var options = []
|
||||
if (!this.isIos && !this.isInternalStorage && !this.libraryItemId) {
|
||||
options.push({ text: 'Scan', value: 'scan' })
|
||||
options.push({ text: 'Force Re-Scan', value: 'rescan' })
|
||||
}
|
||||
options.push({ text: 'Delete local item', value: 'delete' })
|
||||
return options
|
||||
return [
|
||||
{
|
||||
text: 'Delete local item',
|
||||
value: 'delete'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
draggableUpdate() {
|
||||
console.log('Draggable Update')
|
||||
for (let i = 0; i < this.audioTracksCopy.length; i++) {
|
||||
var trackCopy = this.audioTracksCopy[i]
|
||||
var track = this.audioTracks[i]
|
||||
@@ -295,11 +289,7 @@ export default {
|
||||
console.log('Dialog action', action)
|
||||
await this.$hapticsImpact()
|
||||
|
||||
if (action == 'scan') {
|
||||
this.scanItem()
|
||||
} else if (action == 'rescan') {
|
||||
this.scanItem(true)
|
||||
} else if (action == 'delete') {
|
||||
if (action == 'delete') {
|
||||
this.deleteItem()
|
||||
} else if (action == 'track-delete') {
|
||||
if (this.isPodcast) this.deleteEpisode()
|
||||
@@ -377,25 +367,6 @@ export default {
|
||||
} else this.$toast.error('Failed to delete')
|
||||
}
|
||||
},
|
||||
async scanItem(forceAudioProbe = false) {
|
||||
if (this.isScanning) return
|
||||
|
||||
this.isScanning = true
|
||||
var response = await AbsFileSystem.scanLocalLibraryItem({ localLibraryItemId: this.localLibraryItemId, forceAudioProbe })
|
||||
|
||||
if (response && response.localLibraryItem) {
|
||||
if (response.updated) {
|
||||
this.$toast.success('Local item was updated')
|
||||
this.localLibraryItem = response.localLibraryItem
|
||||
} else {
|
||||
this.$toast.info('Local item was up to date')
|
||||
}
|
||||
} else {
|
||||
console.log('Failed')
|
||||
this.$toast.error('Something went wrong..')
|
||||
}
|
||||
this.isScanning = false
|
||||
},
|
||||
async init() {
|
||||
this.localLibraryItem = await this.$db.getLocalLibraryItem(this.localLibraryItemId)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user