mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-23 12:25:04 +02:00
Refactor Feed model to create new feed for series
This commit is contained in:
parent
d576625cb7
commit
e50bd93958
6 changed files with 130 additions and 91 deletions
|
@ -216,21 +216,19 @@ class FeedEpisode extends Model {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param {import('./Collection')} collectionExpanded
|
||||
* @param {import('./Book')[]} books
|
||||
* @param {import('./Feed')} feed
|
||||
* @param {string} slug
|
||||
* @param {import('sequelize').Transaction} transaction
|
||||
* @returns {Promise<FeedEpisode[]>}
|
||||
*/
|
||||
static async createFromCollectionBooks(collectionExpanded, feed, slug, transaction) {
|
||||
const booksWithTracks = collectionExpanded.books.filter((book) => book.includedAudioFiles.length)
|
||||
|
||||
const earliestLibraryItemCreatedAt = collectionExpanded.books.reduce((earliest, book) => {
|
||||
static async createFromBooks(books, feed, slug, transaction) {
|
||||
const earliestLibraryItemCreatedAt = books.reduce((earliest, book) => {
|
||||
return book.libraryItem.createdAt < earliest.libraryItem.createdAt ? book : earliest
|
||||
}).libraryItem.createdAt
|
||||
|
||||
const feedEpisodeObjs = []
|
||||
for (const book of booksWithTracks) {
|
||||
for (const book of books) {
|
||||
const useChapterTitles = this.checkUseChapterTitlesForEpisodes(book)
|
||||
for (const track of book.trackList) {
|
||||
feedEpisodeObjs.push(this.getFeedEpisodeObjFromAudiobookTrack(book, earliestLibraryItemCreatedAt, feed, slug, track, useChapterTitles))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue