mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-30 18:48:55 +01:00
Update media progress object to use unique id for podcast episodes
This commit is contained in:
parent
3276b04256
commit
3a7cafbb95
@ -53,7 +53,7 @@ class MediaProgress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setData(libraryItemId, progress, episodeId = null) {
|
setData(libraryItemId, progress, episodeId = null) {
|
||||||
this.id = libraryItemId
|
this.id = episodeId ? `${libraryItemId}-${episodeId}` : libraryItemId
|
||||||
this.libraryItemId = libraryItemId
|
this.libraryItemId = libraryItemId
|
||||||
this.episodeId = episodeId
|
this.episodeId = episodeId
|
||||||
this.duration = progress.duration || 0
|
this.duration = progress.duration || 0
|
||||||
|
@ -247,14 +247,14 @@ class User {
|
|||||||
if (!this.mediaProgress) return null
|
if (!this.mediaProgress) return null
|
||||||
return this.mediaProgress.find(lip => {
|
return this.mediaProgress.find(lip => {
|
||||||
if (episodeId && lip.episodeId !== episodeId) return false
|
if (episodeId && lip.episodeId !== episodeId) return false
|
||||||
return lip.id === libraryItemId
|
return lip.libraryItemId === libraryItemId
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
createUpdateMediaProgress(libraryItem, updatePayload, episodeId = null) {
|
createUpdateMediaProgress(libraryItem, updatePayload, episodeId = null) {
|
||||||
var itemProgress = this.mediaProgress.find(li => {
|
var itemProgress = this.mediaProgress.find(li => {
|
||||||
if (episodeId && li.episodeId !== episodeId) return false
|
if (episodeId && li.episodeId !== episodeId) return false
|
||||||
return li.id === libraryItem.id
|
return li.libraryItemId === libraryItem.id
|
||||||
})
|
})
|
||||||
if (!itemProgress) {
|
if (!itemProgress) {
|
||||||
var newItemProgress = new MediaProgress()
|
var newItemProgress = new MediaProgress()
|
||||||
@ -269,7 +269,7 @@ class User {
|
|||||||
|
|
||||||
removeMediaProgress(libraryItemId) {
|
removeMediaProgress(libraryItemId) {
|
||||||
if (!this.mediaProgress.some(lip => lip.id == libraryItemId)) return false
|
if (!this.mediaProgress.some(lip => lip.id == libraryItemId)) return false
|
||||||
this.mediaProgress = this.mediaProgress.filter(lip => lip.id != libraryItemId)
|
this.mediaProgress = this.mediaProgress.filter(lip => lip.libraryItemId != libraryItemId)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user