mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-03 05:55:06 +02:00
Update:Podcast library item covers show number of episodes incomplete #782
This commit is contained in:
parent
ddc54c8811
commit
ec998dc1ac
6 changed files with 45 additions and 8 deletions
|
@ -416,5 +416,23 @@ class User {
|
|||
if (!progress) return false
|
||||
return progress.removeFromContinueListening()
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of podcast episodes not finished for library item
|
||||
* Note: libraryItem passed in from libraryHelpers is not a LibraryItem class instance
|
||||
* @param {LibraryItem|object} libraryItem
|
||||
* @returns {number}
|
||||
*/
|
||||
getNumEpisodesIncompleteForPodcast(libraryItem) {
|
||||
if (!libraryItem?.media.episodes) return 0
|
||||
let numEpisodesIncomplete = 0
|
||||
for (const episode of libraryItem.media.episodes) {
|
||||
const mediaProgress = this.getMediaProgress(libraryItem.id, episode.id)
|
||||
if (!mediaProgress?.isFinished) {
|
||||
numEpisodesIncomplete++
|
||||
}
|
||||
}
|
||||
return numEpisodesIncomplete
|
||||
}
|
||||
}
|
||||
module.exports = User
|
Loading…
Add table
Add a link
Reference in a new issue