mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-02 17:24:57 +02:00
Change: Using posix file paths, Change: njodb version bump, Change: Ignore directories and files starting with . #169
This commit is contained in:
parent
36d7c04d21
commit
28ccd4e568
13 changed files with 201 additions and 196 deletions
|
@ -119,6 +119,7 @@ class FolderWatcher extends EventEmitter {
|
|||
}
|
||||
|
||||
addFileUpdate(libraryId, path, type) {
|
||||
path = path.replace(/\\/g, '/')
|
||||
if (this.pendingFilePaths.includes(path)) return
|
||||
|
||||
// Get file library
|
||||
|
@ -129,20 +130,28 @@ class FolderWatcher extends EventEmitter {
|
|||
}
|
||||
|
||||
// Get file folder
|
||||
var folder = libwatcher.folders.find(fold => path.startsWith(fold.fullPath))
|
||||
var folder = libwatcher.folders.find(fold => path.startsWith(fold.fullPath.replace(/\\/g, '/')))
|
||||
if (!folder) {
|
||||
Logger.error(`[Watcher] New file folder not found in library "${libwatcher.name}" with path "${path}"`)
|
||||
return
|
||||
}
|
||||
var folderFullPath = folder.fullPath.replace(/\\/g, '/')
|
||||
|
||||
// Check if file was added to root directory
|
||||
var dir = Path.dirname(path)
|
||||
if (dir === folder.fullPath) {
|
||||
if (dir === folderFullPath) {
|
||||
Logger.warn(`[Watcher] New file "${Path.basename(path)}" added to folder root - ignoring it`)
|
||||
return
|
||||
}
|
||||
|
||||
var relPath = path.replace(folder.fullPath, '')
|
||||
var relPath = path.replace(folderFullPath, '')
|
||||
|
||||
var hasDotPath = relPath.split('/').find(p => p.startsWith('.'))
|
||||
if (hasDotPath) {
|
||||
Logger.debug(`[Watcher] Ignoring dot path "${relPath}" | Piece "${hasDotPath}"`)
|
||||
return
|
||||
}
|
||||
|
||||
Logger.debug(`[Watcher] Modified file in library "${libwatcher.name}" and folder "${folder.id}" with relPath "${relPath}"`)
|
||||
|
||||
this.pendingFileUpdates.push({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue