mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-22 19:59:37 +00:00
Add check for copied files
This commit is contained in:
parent
736a939284
commit
63a97b3c40
1 changed files with 10 additions and 1 deletions
|
|
@ -718,6 +718,15 @@ async function findLibraryItemByItemToMetadata(fullPath, isSingleMedia) {
|
||||||
const abMetadata = abmetadataGenerator.parseJson(metadataText) || {}
|
const abMetadata = abmetadataGenerator.parseJson(metadataText) || {}
|
||||||
// check if metadata id exists in the database
|
// check if metadata id exists in the database
|
||||||
const existingLibraryItem = await Database.libraryItemModel.getExpandedById(abMetadata.absId)
|
const existingLibraryItem = await Database.libraryItemModel.getExpandedById(abMetadata.absId)
|
||||||
if (existingLibraryItem) Logger.debug(`[LibraryScanner] Found library item with metadata id matching one of "${abMetadata.absId}" at path "${existingLibraryItem.path}"`)
|
|
||||||
|
if (existingLibraryItem) {
|
||||||
|
Logger.debug(`[LibraryScanner] Found library item with metadata id matching one of "${abMetadata.absId}" at path "${existingLibraryItem.path}"`)
|
||||||
|
|
||||||
|
for (const { metadata } of existingLibraryItem.getLibraryFiles())
|
||||||
|
if (await fs.pathExists(metadata.path)) {
|
||||||
|
Logger.debug(`[LibraryScanner] Conflicting library files exist "${metadata.path}"`)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
return existingLibraryItem
|
return existingLibraryItem
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue