mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-26 21:34:05 +02:00
Merge
This commit is contained in:
+4
-2
@@ -9,7 +9,7 @@ export const getters = {
|
||||
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
|
||||
return i.libraryItemId == libraryItemId
|
||||
})
|
||||
},
|
||||
getLibraryItemCoverSrc: (state, getters, rootState, rootGetters) => (libraryItem, placeholder = '/book_placeholder.jpg') => {
|
||||
@@ -32,7 +32,7 @@ export const getters = {
|
||||
},
|
||||
getLocalMediaProgressById: (state) => (localLibraryItemId, episodeId = null) => {
|
||||
return state.localMediaProgress.find(lmp => {
|
||||
if (episodeId != null && lmp.episodeId != episodeId) return false
|
||||
if (episodeId != null && lmp.localEpisodeId != episodeId) return false
|
||||
return lmp.localLibraryItemId == localLibraryItemId
|
||||
})
|
||||
}
|
||||
@@ -73,8 +73,10 @@ export const mutations = {
|
||||
}
|
||||
var index = state.localMediaProgress.findIndex(lmp => lmp.id == prog.id)
|
||||
if (index >= 0) {
|
||||
console.log('UpdateLocalMediaProgress updating', prog.id, prog.progress)
|
||||
state.localMediaProgress.splice(index, 1, prog)
|
||||
} else {
|
||||
console.log('updateLocalMediaProgress inserting new progress', prog.id, prog.progress)
|
||||
state.localMediaProgress.push(prog)
|
||||
}
|
||||
},
|
||||
|
||||
+10
-2
@@ -57,9 +57,17 @@ 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
|
||||
|
||||
if (state.playerIsLocal) {
|
||||
state.playerLibraryItemId = playbackSession ? playbackSession.localLibraryItem.id || null : null
|
||||
state.playerEpisodeId = playbackSession ? playbackSession.localEpisodeId || null : null
|
||||
} else {
|
||||
state.playerLibraryItemId = playbackSession ? playbackSession.libraryItemId || null : null
|
||||
state.playerEpisodeId = playbackSession ? playbackSession.episodeId || null : null
|
||||
}
|
||||
|
||||
console.log('setPlayerItem', state.playerLibraryItemId, state.playerEpisodeId, state.playerIsLocal)
|
||||
},
|
||||
setPlayerPlaying(state, val) {
|
||||
state.playerIsPlaying = val
|
||||
|
||||
@@ -74,6 +74,15 @@ export const mutations = {
|
||||
if (!state.user) return
|
||||
state.user.mediaProgress = state.user.mediaProgress.filter(mp => mp.id != id)
|
||||
},
|
||||
updateUserMediaProgress(state, data) {
|
||||
if (!data || !state.user) return
|
||||
var mediaProgressIndex = state.user.mediaProgress.findIndex(mp => mp.id === data.id)
|
||||
if (mediaProgressIndex >= 0) {
|
||||
state.user.mediaProgress.splice(mediaProgressIndex, 1, data)
|
||||
} else {
|
||||
state.user.mediaProgress.push(data)
|
||||
}
|
||||
},
|
||||
setServerConnectionConfig(state, serverConnectionConfig) {
|
||||
state.serverConnectionConfig = serverConnectionConfig
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user