mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-08 00:08:14 +01:00
Update:Some logs to include library item id #3440
This commit is contained in:
parent
1dec8ae122
commit
decde230aa
@ -480,7 +480,7 @@ class LibraryItemController {
|
|||||||
const libraryId = itemsToDelete[0].libraryId
|
const libraryId = itemsToDelete[0].libraryId
|
||||||
for (const libraryItem of itemsToDelete) {
|
for (const libraryItem of itemsToDelete) {
|
||||||
const libraryItemPath = libraryItem.path
|
const libraryItemPath = libraryItem.path
|
||||||
Logger.info(`[LibraryItemController] Deleting Library Item "${libraryItem.media.metadata.title}"`)
|
Logger.info(`[LibraryItemController] Deleting Library Item "${libraryItem.media.metadata.title}" with id "${libraryItem.id}"`)
|
||||||
const mediaItemIds = libraryItem.mediaType === 'podcast' ? libraryItem.media.episodes.map((ep) => ep.id) : [libraryItem.media.id]
|
const mediaItemIds = libraryItem.mediaType === 'podcast' ? libraryItem.media.episodes.map((ep) => ep.id) : [libraryItem.media.id]
|
||||||
await this.handleDeleteLibraryItem(libraryItem.mediaType, libraryItem.id, mediaItemIds)
|
await this.handleDeleteLibraryItem(libraryItem.mediaType, libraryItem.id, mediaItemIds)
|
||||||
if (hardDelete) {
|
if (hardDelete) {
|
||||||
|
@ -15,12 +15,12 @@ const LibraryFile = require('../objects/files/LibraryFile')
|
|||||||
const SocketAuthority = require('../SocketAuthority')
|
const SocketAuthority = require('../SocketAuthority')
|
||||||
|
|
||||||
class LibraryItemScanner {
|
class LibraryItemScanner {
|
||||||
constructor() { }
|
constructor() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan single library item
|
* Scan single library item
|
||||||
*
|
*
|
||||||
* @param {string} libraryItemId
|
* @param {string} libraryItemId
|
||||||
* @param {{relPath:string, path:string}} [updateLibraryItemDetails] used by watcher when item folder was renamed
|
* @param {{relPath:string, path:string}} [updateLibraryItemDetails] used by watcher when item folder was renamed
|
||||||
* @returns {number} ScanResult
|
* @returns {number} ScanResult
|
||||||
*/
|
*/
|
||||||
@ -76,8 +76,8 @@ class LibraryItemScanner {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove empty authors and series
|
* Remove empty authors and series
|
||||||
* @param {string} libraryId
|
* @param {string} libraryId
|
||||||
* @param {ScanLogger} scanLogger
|
* @param {ScanLogger} scanLogger
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
async checkAuthorsAndSeriesRemovedFromBooks(libraryId, scanLogger) {
|
async checkAuthorsAndSeriesRemovedFromBooks(libraryId, scanLogger) {
|
||||||
@ -90,11 +90,11 @@ class LibraryItemScanner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} libraryItemPath
|
* @param {string} libraryItemPath
|
||||||
* @param {import('../models/Library')} library
|
* @param {import('../models/Library')} library
|
||||||
* @param {import('../models/LibraryFolder')} folder
|
* @param {import('../models/LibraryFolder')} folder
|
||||||
* @param {boolean} isSingleMediaItem
|
* @param {boolean} isSingleMediaItem
|
||||||
* @returns {Promise<LibraryItemScanData>}
|
* @returns {Promise<LibraryItemScanData>}
|
||||||
*/
|
*/
|
||||||
async getLibraryItemScanData(libraryItemPath, library, folder, isSingleMediaItem) {
|
async getLibraryItemScanData(libraryItemPath, library, folder, isSingleMediaItem) {
|
||||||
@ -105,7 +105,8 @@ class LibraryItemScanner {
|
|||||||
|
|
||||||
let fileItems = []
|
let fileItems = []
|
||||||
|
|
||||||
if (isSingleMediaItem) { // Single media item in root of folder
|
if (isSingleMediaItem) {
|
||||||
|
// Single media item in root of folder
|
||||||
fileItems = [
|
fileItems = [
|
||||||
{
|
{
|
||||||
fullpath: libraryItemPath,
|
fullpath: libraryItemPath,
|
||||||
@ -151,9 +152,9 @@ class LibraryItemScanner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import('../models/LibraryItem')} existingLibraryItem
|
* @param {import('../models/LibraryItem')} existingLibraryItem
|
||||||
* @param {LibraryItemScanData} libraryItemData
|
* @param {LibraryItemScanData} libraryItemData
|
||||||
* @param {import('../models/Library').LibrarySettingsObject} librarySettings
|
* @param {import('../models/Library').LibrarySettingsObject} librarySettings
|
||||||
* @param {LibraryScan} libraryScan
|
* @param {LibraryScan} libraryScan
|
||||||
* @returns {Promise<{libraryItem:LibraryItem, wasUpdated:boolean}>}
|
* @returns {Promise<{libraryItem:LibraryItem, wasUpdated:boolean}>}
|
||||||
@ -167,8 +168,8 @@ class LibraryItemScanner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {LibraryItemScanData} libraryItemData
|
* @param {LibraryItemScanData} libraryItemData
|
||||||
* @param {import('../models/Library').LibrarySettingsObject} librarySettings
|
* @param {import('../models/Library').LibrarySettingsObject} librarySettings
|
||||||
* @param {LibraryScan} libraryScan
|
* @param {LibraryScan} libraryScan
|
||||||
* @returns {Promise<LibraryItem>}
|
* @returns {Promise<LibraryItem>}
|
||||||
@ -181,17 +182,17 @@ class LibraryItemScanner {
|
|||||||
newLibraryItem = await PodcastScanner.scanNewPodcastLibraryItem(libraryItemData, librarySettings, libraryScan)
|
newLibraryItem = await PodcastScanner.scanNewPodcastLibraryItem(libraryItemData, librarySettings, libraryScan)
|
||||||
}
|
}
|
||||||
if (newLibraryItem) {
|
if (newLibraryItem) {
|
||||||
libraryScan.addLog(LogLevel.INFO, `Created new library item "${newLibraryItem.relPath}"`)
|
libraryScan.addLog(LogLevel.INFO, `Created new library item "${newLibraryItem.relPath}" with id "${newLibraryItem.id}"`)
|
||||||
}
|
}
|
||||||
return newLibraryItem
|
return newLibraryItem
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan library item folder coming from Watcher
|
* Scan library item folder coming from Watcher
|
||||||
* @param {string} libraryItemPath
|
* @param {string} libraryItemPath
|
||||||
* @param {import('../models/Library')} library
|
* @param {import('../models/Library')} library
|
||||||
* @param {import('../models/LibraryFolder')} folder
|
* @param {import('../models/LibraryFolder')} folder
|
||||||
* @param {boolean} isSingleMediaItem
|
* @param {boolean} isSingleMediaItem
|
||||||
* @returns {Promise<LibraryItem>} ScanResult
|
* @returns {Promise<LibraryItem>} ScanResult
|
||||||
*/
|
*/
|
||||||
async scanPotentialNewLibraryItem(libraryItemPath, library, folder, isSingleMediaItem) {
|
async scanPotentialNewLibraryItem(libraryItemPath, library, folder, isSingleMediaItem) {
|
||||||
@ -204,4 +205,4 @@ class LibraryItemScanner {
|
|||||||
return this.scanNewLibraryItem(libraryItemScanData, library.settings, scanLogger)
|
return this.scanNewLibraryItem(libraryItemScanData, library.settings, scanLogger)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = new LibraryItemScanner()
|
module.exports = new LibraryItemScanner()
|
||||||
|
@ -618,7 +618,7 @@ class LibraryScanner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Scan library item for updates
|
// Scan library item for updates
|
||||||
Logger.debug(`[LibraryScanner] Folder update for relative path "${itemDir}" is in library item "${existingLibraryItem.media.metadata.title}" - scan for updates`)
|
Logger.debug(`[LibraryScanner] Folder update for relative path "${itemDir}" is in library item "${existingLibraryItem.media.metadata.title}" with id "${existingLibraryItem.id}" - scan for updates`)
|
||||||
itemGroupingResults[itemDir] = await LibraryItemScanner.scanLibraryItem(existingLibraryItem.id, updatedLibraryItemDetails)
|
itemGroupingResults[itemDir] = await LibraryItemScanner.scanLibraryItem(existingLibraryItem.id, updatedLibraryItemDetails)
|
||||||
continue
|
continue
|
||||||
} else if (library.settings.audiobooksOnly && !hasAudioFiles(fileUpdateGroup, itemDir)) {
|
} else if (library.settings.audiobooksOnly && !hasAudioFiles(fileUpdateGroup, itemDir)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user