advplyr / audiobookshelf

Self-hosted audiobook and podcast server
https://audiobookshelf.org
GNU General Public License v3.0
5.75k stars 395 forks source link

[Bug] Audiobook files are listed twice or more #3034

Open JakobTischler opened 1 month ago

JakobTischler commented 1 month ago

What happened?

Some books (not all) have their library audio files listed twice or more. This is also represented in the audio tracks listing, where the same file is listed multiple times. It's also affecting (accumulatively) the stats.

Example 1

ABS

image

OS

image

Example 2

image

When downloading the audiobook using the app (Android 14, v0.9.74-beta), it actually tries to download each listed audio file (in example 1 above: 2 files). After the file is downloaded the first time, the process never completes.

I tried both rescanning the library and the individual items, to no avail.


As a side note, I think both the audiobooks in the examples are ones where I've changed the file path and/or name previously (after they were already added to the library), and then updated the library.

What did you expect to happen?

The audio file should be recognized only once.

Steps to reproduce the issue

  1. Add audiobooks to library
  2. (Possible related) rename and/or move files on OS

Audiobookshelf version

v2.10.1

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Linux

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Other (list in "Additional Notes" box)

Logs

[2024-06-01 08:46:59.489] DEBUG: [Scan] "Howey, Hugh/Silo Saga #2 - Shift Omnibus Edition": Library file "metadata.json" for library item "/audiobooks/Howey, Hugh/Silo Saga #2 - Shift Omnibus Edition" key "birthtimeMs" changed from "1717184994186" to "1717210836321" (ScanLogger.js:65)
[2024-06-01 08:46:59.491] DEBUG: [Scan] "Howey, Hugh/Silo Saga #2 - Shift Omnibus Edition": Library item "Howey, Hugh/Silo Saga #2 - Shift Omnibus Edition" changed: [size,lastScan] (ScanLogger.js:65)
[2024-06-01 08:47:00.251] DEBUG: [ApiCacheManager] libraryItem.afterUpdate: Clearing cache (ApiCacheManager.js:21)
[2024-06-01 08:47:00.310] DEBUG: [AudioFileScanner] Smart track order for "Howey, Hugh/Silo Saga #2 - Shift Omnibus Edition" using track key trackNumFromFilename (AudioFileScanner.js:94)
[2024-06-01 08:47:00.311] DEBUG: [Scan] "Howey, Hugh/Silo Saga #2 - Shift Omnibus Edition": "Silo Saga #2 - Shift Omnibus Edition" Getting metadata with precedence [folderStructure, txtFiles, opfFile, absMetadata, audioMetatags] (ScanLogger.js:65)
[2024-06-01 08:47:00.343] DEBUG: [Scan] "Howey, Hugh/Silo Saga #2 - Shift Omnibus Edition": Found metadata file "/audiobooks/Howey, Hugh/Silo Saga #2 - Shift Omnibus Edition/metadata.json" (ScanLogger.js:65)
[2024-06-01 08:47:00.350] DEBUG: [Scan] "Howey, Hugh/Silo Saga #2 - Shift Omnibus Edition": setChapters: Using embedded chapters in first audio file /audiobooks/Howey, Hugh/Silo Saga #2 - Shift Omnibus Edition/Hugh Howey - The Silo Saga #2 - 2013 - Shift Omnibus Edition.m4b (ScanLogger.js:65)
[2024-06-01 08:47:00.859] DEBUG: [ApiCacheManager] book.afterUpdate: Clearing cache (ApiCacheManager.js:21)
[2024-06-01 08:47:00.863] DEBUG: [Scan] "Howey, Hugh/Silo Saga #2 - Shift Omnibus Edition": Success saving abmetadata to "/audiobooks/Howey, Hugh/Silo Saga #2 - Shift Omnibus Edition/metadata.json" (ScanLogger.js:65)
[2024-06-01 08:47:01.201] DEBUG: [ApiCacheManager] libraryItem.afterUpdate: Clearing cache (ApiCacheManager.js:21)

Additional Notes

advplyr commented 1 month ago

Are you able to reproduce this again?

JakobTischler commented 1 month ago

Are you able to reproduce this again?

Not on first try (renaming both file path and file name). As I mentioned in my initial post, I'm not sure if it only affects renamed files, thus I can't be sure it would be the actual reason.

I tried removing and re-adding one of the books to the library to solve the problem, which it did (audio file is only read once). But I'd obviously lose any progress/history for the affected books. No biggie, but rather unfortunate.