Add keep local media progress and playback sessions, update data models to support syncing local progress and support for podcast episodes

This commit is contained in:
advplyr
2022-04-09 12:03:37 -05:00
parent 526fca98b9
commit d9e4469089
23 changed files with 295 additions and 118 deletions
+7
View File
@@ -26,6 +26,7 @@ export default {
isSleepTimerRunning: false,
sleepTimerEndTime: 0,
sleepTimeRemaining: 0,
onLocalMediaProgressUpdateListener: null,
onSleepTimerEndedListener: null,
onSleepTimerSetListener: null,
sleepInterval: null,
@@ -174,9 +175,14 @@ export default {
.catch((error) => {
console.error('Failed', error)
})
},
onLocalMediaProgressUpdate(localMediaProgress) {
console.log('Got local media progress update', localMediaProgress.progress, JSON.stringify(localMediaProgress))
this.$store.commit('globals/updateLocalMediaProgress', localMediaProgress)
}
},
mounted() {
this.onLocalMediaProgressUpdateListener = AbsAudioPlayer.addListener('onLocalMediaProgressUpdate', this.onLocalMediaProgressUpdate)
this.onSleepTimerEndedListener = AbsAudioPlayer.addListener('onSleepTimerEnded', this.onSleepTimerEnded)
this.onSleepTimerSetListener = AbsAudioPlayer.addListener('onSleepTimerSet', this.onSleepTimerSet)
@@ -189,6 +195,7 @@ export default {
this.$store.commit('user/addSettingsListener', { id: 'streamContainer', meth: this.settingsUpdated })
},
beforeDestroy() {
if (this.onLocalMediaProgressUpdateListener) this.onLocalMediaProgressUpdateListener.remove()
if (this.onSleepTimerEndedListener) this.onSleepTimerEndedListener.remove()
if (this.onSleepTimerSetListener) this.onSleepTimerSetListener.remove()
+1
View File
@@ -207,6 +207,7 @@ export default {
return null
},
userProgress() {
if (this.isLocal) return this.store.getters['globals/getLocalMediaProgressById'](this.libraryItemId)
return this.store.getters['user/getUserMediaProgress'](this.libraryItemId)
},
userProgressPercent() {
@@ -123,6 +123,7 @@ export default {
this.error = null
this.serverConfig = {
address: null,
userId: null,
username: null
}
},
@@ -160,6 +161,7 @@ export default {
this.deviceData.serverConnectionConfigs = this.deviceData.serverConnectionConfigs.filter((scc) => scc.id != this.serverConfig.id)
this.serverConfig = {
address: null,
userId: null,
username: null
}
this.password = null
@@ -266,6 +268,7 @@ export default {
this.$store.commit('libraries/setCurrentLibrary', userDefaultLibraryId)
}
this.serverConfig.userId = user.id
this.serverConfig.token = user.token
var serverConnectionConfig = await this.$db.setServerConnectionConfig(this.serverConfig)