Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Watcher fails to add single audio file to library if library is audiobooks-only #2282

Closed
mikiher opened this issue Nov 4, 2023 · 1 comment · Fixed by #2283
Closed
Labels
bug Something isn't working

Comments

@mikiher
Copy link
Contributor

mikiher commented Nov 4, 2023

Describe the issue

When adding a single audio file to the library's root folder, watcher detects the change but fails to add the book.

Relevant log lines:

[2023-11-04 10:29:00] DEBUG: [Watcher] File Added /torrents/2BR02B - librivox.m4b (Watcher.js:151)
[2023-11-04 10:29:00] DEBUG: [Watcher] Modified file in library "Torrents" and folder "7574feec-eebc-4858-a01e-7613f1eac121" with relPath "/2BR02B - librivox.m4b" (Watcher.js:256)
[2023-11-04 10:29:00] DEBUG: [Watcher] Waiting to add file at "/torrents/2BR02B - librivox.m4b". mtimeMs=1696863726581.3113 lastMTimeMs=0 (loop 0) (Watcher.js:209)
[2023-11-04 10:29:01] DEBUG: [Watcher] File finished adding at "/torrents/2BR02B - librivox.m4b" (Watcher.js:205)
[2023-11-04 10:29:04] DEBUG: [Scanner] Scanning file update groups in folder "7574feec-eebc-4858-a01e-7613f1eac121" of library "Torrents" (LibraryScanner.js:459)
[2023-11-04 10:29:04] DEBUG: [Scanner] scanFolderUpdates fileUpdateGroup { '2BR02B - librivox.m4b': '2BR02B - librivox.m4b' } (LibraryScanner.js:460)
[2023-11-04 10:29:05] DEBUG: [LibraryScanner] Folder update for relative path "2BR02B - librivox.m4b" has no audio files (LibraryScanner.js:563)
[2023-11-04 10:29:05] DEBUG: [LibraryScanner] Folder scan results {} (LibraryScanner.js:386)

Note that this line is unexpected:

[2023-11-04 10:29:05] DEBUG: [LibraryScanner] Folder update for relative path "2BR02B - librivox.m4b" has no audio files (LibraryScanner.js:563)

Steps to reproduce the issue

  1. Add an audio file to the an audiobooks-only library root folder.

Expected: New book is added to library.
Actual: New book not added to library.

Audiobookshelf version

v2.5.0

How are you running audiobookshelf?

Docker

@mikiher mikiher added the bug Something isn't working label Nov 4, 2023
@mikiher
Copy link
Contributor Author

mikiher commented Nov 4, 2023

The issue is due to this line in libraryScanner.js:

} else if (library.settings.audiobooksOnly && !fileUpdateGroup[itemDir].some?.(scanUtils.checkFilepathIsAudioFile)) {

For single items added to the root folder, fileUpdateGroup[itemDir] is not an array, and does not have a some method, so this condition evaluates to true (this issue is a side effect of this commit)

I'm on it...

@advplyr advplyr added the awaiting release Issue is resolved and will be in the next release label Nov 6, 2023
@advplyr advplyr removed the awaiting release Issue is resolved and will be in the next release label Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants