mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-27 05:43:58 +02:00
Add podcast pages, android download podcast, scan podcast folders
This commit is contained in:
+5
-2
@@ -6,8 +6,11 @@ export const state = () => ({
|
||||
})
|
||||
|
||||
export const getters = {
|
||||
getDownloadItem: state => libraryItemId => {
|
||||
return state.itemDownloads.find(i => i.id == libraryItemId)
|
||||
getDownloadItem: state => (libraryItemId, episodeId = null) => {
|
||||
return state.itemDownloads.find(i => {
|
||||
if (episodeId && !i.episodes.some(e => e.id == episodeId)) return false
|
||||
return i.id == libraryItemId
|
||||
})
|
||||
},
|
||||
getLibraryItemCoverSrc: (state, getters, rootState, rootGetters) => (libraryItem, placeholder = '/book_placeholder.jpg') => {
|
||||
if (!libraryItem) return placeholder
|
||||
|
||||
+17
-44
@@ -1,16 +1,14 @@
|
||||
import Vue from 'vue'
|
||||
import { Network } from '@capacitor/network'
|
||||
|
||||
export const state = () => ({
|
||||
streamAudiobook: null,
|
||||
playingDownload: null,
|
||||
playOnLoad: false,
|
||||
serverUrl: null,
|
||||
playerLibraryItemId: null,
|
||||
playerEpisodeId: null,
|
||||
playerIsLocal: false,
|
||||
playerIsPlaying: false,
|
||||
appUpdateInfo: null,
|
||||
socketConnected: false,
|
||||
networkConnected: false,
|
||||
networkConnectionType: null,
|
||||
streamListener: null,
|
||||
isFirstLoad: true,
|
||||
hasStoragePermission: false,
|
||||
selectedBook: null,
|
||||
@@ -22,16 +20,13 @@ export const state = () => ({
|
||||
|
||||
export const getters = {
|
||||
playerIsOpen: (state) => {
|
||||
return state.streamAudiobook || state.playingDownload
|
||||
return state.streamAudiobook
|
||||
},
|
||||
isAudiobookStreaming: (state) => id => {
|
||||
return (state.streamAudiobook && state.streamAudiobook.id === id)
|
||||
getIsItemStreaming: state => libraryItemId => {
|
||||
return state.playerLibraryItemId == libraryItemId
|
||||
},
|
||||
isAudiobookPlaying: (state) => id => {
|
||||
return (state.playingDownload && state.playingDownload.id === id) || (state.streamAudiobook && state.streamAudiobook.id === id)
|
||||
},
|
||||
getAudiobookIdStreaming: state => {
|
||||
return state.streamAudiobook ? state.streamAudiobook.id : null
|
||||
getIsEpisodeStreaming: state => (libraryItemId, episodeId) => {
|
||||
return state.playerLibraryItemId == libraryItemId && state.playerEpisodeId == episodeId
|
||||
},
|
||||
getServerSetting: state => key => {
|
||||
if (!state.serverSettings) return null
|
||||
@@ -61,6 +56,14 @@ export const actions = {
|
||||
}
|
||||
|
||||
export const mutations = {
|
||||
setPlayerItem(state, playbackSession) {
|
||||
state.playerLibraryItemId = playbackSession ? playbackSession.libraryItemId || null : null
|
||||
state.playerEpisodeId = playbackSession ? playbackSession.episodeId || null : null
|
||||
state.playerIsLocal = playbackSession ? playbackSession.playMethod == this.$constants.PlayMethod.LOCAL : false
|
||||
},
|
||||
setPlayerPlaying(state, val) {
|
||||
state.playerIsPlaying = val
|
||||
},
|
||||
setHasStoragePermission(state, val) {
|
||||
state.hasStoragePermission = val
|
||||
},
|
||||
@@ -70,36 +73,6 @@ export const mutations = {
|
||||
setAppUpdateInfo(state, info) {
|
||||
state.appUpdateInfo = info
|
||||
},
|
||||
closeStream(state, audiobookId) {
|
||||
if (state.streamAudiobook && state.streamAudiobook.id !== audiobookId) {
|
||||
return
|
||||
}
|
||||
state.streamAudiobook = null
|
||||
},
|
||||
setPlayOnLoad(state, val) {
|
||||
state.playOnLoad = val
|
||||
},
|
||||
setStreamAudiobook(state, audiobook) {
|
||||
if (audiobook) {
|
||||
state.playingDownload = null
|
||||
}
|
||||
Vue.set(state, 'streamAudiobook', audiobook)
|
||||
if (state.streamListener) {
|
||||
state.streamListener('stream', audiobook)
|
||||
}
|
||||
},
|
||||
setPlayingDownload(state, download) {
|
||||
if (download) {
|
||||
state.streamAudiobook = null
|
||||
}
|
||||
Vue.set(state, 'playingDownload', download)
|
||||
if (state.streamListener) {
|
||||
state.streamListener('download', download)
|
||||
}
|
||||
},
|
||||
setServerUrl(state, url) {
|
||||
state.serverUrl = url
|
||||
},
|
||||
setSocketConnected(state, val) {
|
||||
state.socketConnected = val
|
||||
},
|
||||
|
||||
+9
-34
@@ -1,11 +1,8 @@
|
||||
export const state = () => ({
|
||||
libraries: [],
|
||||
lastLoad: 0,
|
||||
listeners: [],
|
||||
currentLibraryId: '',
|
||||
showModal: false,
|
||||
folders: [],
|
||||
folderLastUpdate: 0,
|
||||
issues: 0,
|
||||
filterData: null
|
||||
})
|
||||
@@ -66,13 +63,13 @@ export const actions = {
|
||||
return this.$axios
|
||||
.$get(`/api/libraries`)
|
||||
.then((data) => {
|
||||
// Set current library
|
||||
if (data.length) {
|
||||
// Set current library if not already set or was not returned in results
|
||||
if (data.length && (!state.currentLibraryId || !data.find(li => li.id == state.currentLibraryId))) {
|
||||
commit('setCurrentLibrary', data[0].id)
|
||||
}
|
||||
|
||||
commit('set', data)
|
||||
commit('setLastLoad')
|
||||
commit('setLastLoad', Date.now())
|
||||
return true
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -85,27 +82,21 @@ export const actions = {
|
||||
}
|
||||
|
||||
export const mutations = {
|
||||
setFolders(state, folders) {
|
||||
state.folders = folders
|
||||
},
|
||||
setFoldersLastUpdate(state) {
|
||||
state.folderLastUpdate = Date.now()
|
||||
},
|
||||
setShowModal(state, val) {
|
||||
state.showModal = val
|
||||
},
|
||||
setLastLoad(state) {
|
||||
state.lastLoad = Date.now()
|
||||
setLastLoad(state, val) {
|
||||
state.lastLoad = val
|
||||
},
|
||||
reset(state) {
|
||||
state.lastLoad = 0
|
||||
state.libraries = []
|
||||
},
|
||||
setCurrentLibrary(state, val) {
|
||||
state.currentLibraryId = val
|
||||
},
|
||||
set(state, libraries) {
|
||||
console.log('set libraries', libraries)
|
||||
state.libraries = libraries
|
||||
state.listeners.forEach((listener) => {
|
||||
listener.meth()
|
||||
})
|
||||
},
|
||||
addUpdate(state, library) {
|
||||
var index = state.libraries.findIndex(a => a.id === library.id)
|
||||
@@ -114,25 +105,9 @@ export const mutations = {
|
||||
} else {
|
||||
state.libraries.push(library)
|
||||
}
|
||||
|
||||
state.listeners.forEach((listener) => {
|
||||
listener.meth()
|
||||
})
|
||||
},
|
||||
remove(state, library) {
|
||||
state.libraries = state.libraries.filter(a => a.id !== library.id)
|
||||
|
||||
state.listeners.forEach((listener) => {
|
||||
listener.meth()
|
||||
})
|
||||
},
|
||||
addListener(state, listener) {
|
||||
var index = state.listeners.findIndex(l => l.id === listener.id)
|
||||
if (index >= 0) state.listeners.splice(index, 1, listener)
|
||||
else state.listeners.push(listener)
|
||||
},
|
||||
removeListener(state, listenerId) {
|
||||
state.listeners = state.listeners.filter(l => l.id !== listenerId)
|
||||
},
|
||||
setLibraryIssues(state, val) {
|
||||
state.issues = val
|
||||
|
||||
Reference in New Issue
Block a user