diff --git a/server/controllers/LibraryItemController.js b/server/controllers/LibraryItemController.js index 498398f72..2b25474e5 100644 --- a/server/controllers/LibraryItemController.js +++ b/server/controllers/LibraryItemController.js @@ -259,7 +259,6 @@ class LibraryItemController { // Check if library item media has a cover path if (!libraryItem.media.coverPath || !await fs.pathExists(libraryItem.media.coverPath)) { - Logger.debug(`[LibraryItemController] getCover: Library item "${req.params.id}" has no cover path`) return res.sendStatus(404) } @@ -280,12 +279,6 @@ class LibraryItemController { return CacheManager.handleCoverCache(res, libraryItem.id, libraryItem.media.coverPath, options) } - // GET: api/items/:id/stream - openStream(req, res) { - // this.streamManager.openStreamApiRequest(res, req.user, req.libraryItem) - res.sendStatus(500) - } - // POST: api/items/:id/play startPlaybackSession(req, res) { if (!req.libraryItem.media.numTracks && req.libraryItem.mediaType !== 'video') { diff --git a/server/controllers/SearchController.js b/server/controllers/SearchController.js index 2749016c3..93587bc4f 100644 --- a/server/controllers/SearchController.js +++ b/server/controllers/SearchController.js @@ -26,7 +26,7 @@ class SearchController { let results = null if (podcast) results = await PodcastFinder.findCovers(query.title) - else results = await BookFinder.findCovers(query.provider || 'google', query.title, query.author || null) + else results = await BookFinder.findCovers(query.provider || 'google', query.title, query.author || '') res.json({ results }) diff --git a/server/finders/BookFinder.js b/server/finders/BookFinder.js index 96735cc95..bcf8ea068 100644 --- a/server/finders/BookFinder.js +++ b/server/finders/BookFinder.js @@ -234,7 +234,7 @@ class BookFinder { if (!books.length && maxFuzzySearches > 0) { // normalize title and author title = title.trim().toLowerCase() - author = author.trim().toLowerCase() + author = author?.trim().toLowerCase() || '' // Now run up to maxFuzzySearches fuzzy searches let candidates = new Set() diff --git a/server/objects/PlaybackSession.js b/server/objects/PlaybackSession.js index 4fe3d8fd5..20b50009c 100644 --- a/server/objects/PlaybackSession.js +++ b/server/objects/PlaybackSession.js @@ -168,7 +168,13 @@ class PlaybackSession { this.currentTime = session.currentTime || 0 this.startedAt = session.startedAt - this.updatedAt = session.updatedAt || null + this.updatedAt = session.updatedAt || session.startedAt + + // Local playback sessions dont set this date field so set using updatedAt + if (!this.date && session.updatedAt) { + this.date = date.format(new Date(session.updatedAt), 'YYYY-MM-DD') + this.dayOfWeek = date.format(new Date(session.updatedAt), 'dddd') + } } get mediaItemId() { diff --git a/server/objects/Stream.js b/server/objects/Stream.js index c8452ac39..115bb96e6 100644 --- a/server/objects/Stream.js +++ b/server/objects/Stream.js @@ -339,9 +339,9 @@ class Stream extends EventEmitter { } else { Logger.error('Ffmpeg Err', '"' + err.message + '"') - // Temporary workaround for https://github.com/advplyr/audiobookshelf/issues/172 - const aacErrorMsg = 'ffmpeg exited with code 1: Could not write header for output file #0 (incorrect codec parameters ?)' - if (audioCodec === 'copy' && this.isAACEncodable && err.message && err.message.startsWith(aacErrorMsg)) { + // Temporary workaround for https://github.com/advplyr/audiobookshelf/issues/172 and https://github.com/advplyr/audiobookshelf/issues/2157 + const aacErrorMsg = 'ffmpeg exited with code 1:' + if (audioCodec === 'copy' && this.isAACEncodable && err.message?.startsWith(aacErrorMsg)) { Logger.info(`[Stream] Re-attempting stream with AAC encode`) this.transcodeOptions.forceAAC = true this.reset(this.startTime) @@ -435,4 +435,4 @@ class Stream extends EventEmitter { return newAudioTrack } } -module.exports = Stream \ No newline at end of file +module.exports = Stream diff --git a/server/scanner/BookScanner.js b/server/scanner/BookScanner.js index f8e959bde..187ecac1d 100644 --- a/server/scanner/BookScanner.js +++ b/server/scanner/BookScanner.js @@ -1111,7 +1111,7 @@ class BookScanner { const result = await CoverManager.downloadCoverFromUrlNew(results[i], libraryItemId, libraryItemPath) if (result.error) { - Logger.error(`[Scanner] Failed to download cover from url "${results[i]}" | Attempt ${i + 1}`, result.error) + libraryScan.addLog(LogLevel.ERROR, `Failed to download cover from url "${results[i]}" | Attempt ${i + 1}`, result.error) } else if (result.cover) { return result.cover }