Updates to downloader, audio track ordering, hard deleting from file system, UI updates and fixes

This commit is contained in:
advplyr
2022-04-08 18:07:31 -05:00
parent 105451ebf1
commit f309e1fcf2
27 changed files with 561 additions and 19031 deletions
+82
View File
@@ -56,6 +56,88 @@ class AbsDatabaseWeb extends WebPlugin {
deviceData.lastServerConnectionConfigId = null
localStorage.setItem('device', JSON.stringify(deviceData))
}
//
// For testing on web
//
async getLocalFolders() {
return {
folders: [
{
id: 'test1',
name: 'Audiobooks',
contentUrl: 'test',
absolutePath: '/audiobooks',
simplePath: 'audiobooks',
storageType: 'primary',
mediaType: 'book'
}
]
}
}
async getLocalFolder({ folderId }) {
return this.getLocalFolders().then((data) => data.folders[0])
}
async getLocalLibraryItems(payload) {
return {
localLibraryItems: [{
id: 'local_test',
libraryItemId: 'test34',
folderId: 'test1',
absolutePath: 'a',
contentUrl: 'c',
isInvalid: false,
mediaType: 'book',
media: {
metadata: {
title: 'Test Book',
authorName: 'Test Author Name'
},
coverPath: null,
tags: [],
audioFiles: [],
chapters: [],
tracks: [
{
index: 1,
startOffset: 0,
duration: 10000,
title: 'Track Title 1',
contentUrl: 'test',
mimeType: 'audio/mpeg',
metadata: null,
isLocal: true,
localFileId: 'lf1',
audioProbeResult: {}
}
]
},
localFiles: [
{
id: 'lf1',
filename: 'lf1.mp3',
contentUrl: 'test',
absolutePath: 'test',
simplePath: 'test',
mimeType: 'audio/mpeg',
size: 39048290
}
],
coverContentUrl: null,
coverAbsolutePath: null,
isLocal: true
}]
}
}
async getLocalLibraryItemsInFolder({ folderId }) {
return this.getLocalLibraryItems()
}
async getLocalLibraryItem({ id }) {
return this.getLocalLibraryItems().then((data) => data.localLibraryItems[0])
}
async getLocalLibraryItemByLLId({ libraryItemId }) {
return this.getLocalLibraryItems().then((data) => data.localLibraryItems.find(lli => lli.libraryItemId == libraryItemId))
}
}
const AbsDatabase = registerPlugin('AbsDatabase', {
+1 -7
View File
@@ -52,7 +52,6 @@ class DbService {
}
getLocalFolders() {
if (isWeb) return []
return AbsDatabase.getLocalFolders().then((data) => {
console.log('Loaded local folders', JSON.stringify(data))
if (data.folders && typeof data.folders == 'string') {
@@ -66,7 +65,6 @@ class DbService {
}
getLocalFolder(folderId) {
if (isWeb) return null
return AbsDatabase.getLocalFolder({ folderId }).then((data) => {
console.log('Got local folder', JSON.stringify(data))
return data
@@ -74,7 +72,6 @@ class DbService {
}
getLocalLibraryItemsInFolder(folderId) {
if (isWeb) return []
return AbsDatabase.getLocalLibraryItemsInFolder({ folderId }).then((data) => {
console.log('Loaded local library items in folder', JSON.stringify(data))
if (data.localLibraryItems && typeof data.localLibraryItems == 'string') {
@@ -85,8 +82,7 @@ class DbService {
}
getLocalLibraryItems(mediaType = null) {
if (isWeb) return []
return AbsDatabase.getLocalLibraryItems(mediaType).then((data) => {
return AbsDatabase.getLocalLibraryItems({ mediaType }).then((data) => {
console.log('Loaded all local media items', JSON.stringify(data))
if (data.localLibraryItems && typeof data.localLibraryItems == 'string') {
return JSON.parse(data.localLibraryItems)
@@ -96,12 +92,10 @@ class DbService {
}
getLocalLibraryItem(id) {
if (isWeb) return null
return AbsDatabase.getLocalLibraryItem({ id })
}
getLocalLibraryItemByLLId(libraryItemId) {
if (isWeb) return null
return AbsDatabase.getLocalLibraryItemByLLId({ libraryItemId })
}
}
+52
View File
@@ -0,0 +1,52 @@
import Vue from 'vue'
import { Haptics, ImpactStyle, NotificationType } from '@capacitor/haptics'
const hapticsImpactHeavy = async () => {
await Haptics.impact({ style: ImpactStyle.Heavy });
}
Vue.prototype.$hapticsImpactHeavy = hapticsImpactHeavy
const hapticsImpactMedium = async () => {
await Haptics.impact({ style: ImpactStyle.Medium });
}
Vue.prototype.$hapticsImpactMedium = hapticsImpactMedium
const hapticsImpactLight = async () => {
await Haptics.impact({ style: ImpactStyle.Light });
};
Vue.prototype.$hapticsImpactLight = hapticsImpactLight
const hapticsVibrate = async () => {
await Haptics.vibrate();
};
Vue.prototype.$hapticsVibrate = hapticsVibrate
const hapticsNotificationSuccess = async () => {
await Haptics.notification({ type: NotificationType.Success });
};
Vue.prototype.$hapticsNotificationSuccess = hapticsNotificationSuccess
const hapticsNotificationWarning = async () => {
await Haptics.notification({ type: NotificationType.Warning });
};
Vue.prototype.$hapticsNotificationWarning = hapticsNotificationWarning
const hapticsNotificationError = async () => {
await Haptics.notification({ type: NotificationType.Error });
};
Vue.prototype.$hapticsNotificationError = hapticsNotificationError
const hapticsSelectionStart = async () => {
await Haptics.selectionStart();
};
Vue.prototype.$hapticsSelectionStart = hapticsSelectionStart
const hapticsSelectionChanged = async () => {
await Haptics.selectionChanged();
};
Vue.prototype.$hapticsSelectionChanged = hapticsSelectionChanged
const hapticsSelectionEnd = async () => {
await Haptics.selectionEnd();
};
Vue.prototype.$hapticsSelectionEnd = hapticsSelectionEnd