[Bug]: ePub books, in unique folders combined into single entry #2425

Closed
opened 2026-04-25 00:06:58 +02:00 by adam · 9 comments
Owner

Originally created by @andrewlow on GitHub (Dec 15, 2024).

What happened?

I'm primarily using audiobookshelf to manage ePub books.

I recently grabbed the Humble Bundle of John Scalzi books - 21 of them.

They initially came with not very friendly names.

$ find . -type f
./oldmanswar_johnscalzi.epub
./lastemperox_johnscalzi.epub
./kaijupreservationsociety_johnscalzi.epub
./shadowwarofthenightdragons_bookone_thedeadcity_prologue_johnscalzi.epub
./zoestale_johnscalzi.epub
./lockin_johnscalzi.epub
./redshirts_johnscalzi.epub
./ghostbrigades_johnscalzi.epub
./presidentsbrainismissing_johnscalzi.epub
./consumingfire_johnscalzi.epub
./headon_johnscalzi.epub
./unlocked_johnscalzi.epub
./lastcolony_johnscalzi.epub
./yourhatemailwillbegraded_johnscalzi.epub
./humandivision_johnscalzi.epub
./fuzzynation_johnscalzi.epub
./agenttothestars_johnscalzi.epub
./androidsdream_johnscalzi.epub
./collapsingempire_johnscalzi.epub
./endofallthings_johnscalzi.epub
./afterthecoup_johnscalzi.epub

Ok - so I don't expect the matching to work nicely here - so of course I took the time to rename all of the files to a sensible "directory" per book.

$ find . -type f
./Shadow War of the Night Dragons, Book One_ The Dead City_ Prologue/Shadow War of the Night Dragons, Book One_ - John Scalzi.epub
./The Kaiju Preservation Society/The Kaiju Preservation Society - John Scalzi.epub
./Your Hate Mail Will Be Graded/Your Hate Mail Will Be Graded - John Scalzi.epub
./The Ghost Brigades/The Ghost Brigades - John Scalzi.epub
./Agent to the Stars/Agent to the Stars - John Scalzi.epub
./The Android's Dream/The Android's Dream - John Scalzi.epub
./Redshirts/Redshirts - John Scalzi.epub
./Head On/Head On - John Scalzi.epub
./Zoe's Tale/Zoe's Tale - John Scalzi.epub
./The Last Colony/The Last Colony - John Scalzi.epub
./Lock In/Lock In - John Scalzi.epub
./Unlocked/Unlocked An Oral History of Haden's Syndrome - John Scalzi.epub
./The Last Emperox/The Last Emperox - John Scalzi.epub
./The Human Division/The Human Division - John Scalzi.epub
./The Consuming Fire/The Consuming Fire - John Scalzi.epub
./The End of All Things/The End of All Things - John Scalzi.epub
./Old Man's War/Old Man's War - John Scalzi.epub
./The Collapsing Empire/The Collapsing Empire - John Scalzi.epub
./The President's Brain is Missing/The President's Brain is Missing - John Scalzi.epub
./After The Coup/After the Coup - John Scalzi.epub
./Fuzzy Nation/Fuzzy Nation - John Scalzi.epub

I will note - Starter Villain was already in my library ..

Now, I also got here via iteration - I first tested the Redshirts would work ok - and it did. So I had a Library with Redshirts and Starter Villain

However, after copying the nicely named directories into the location that audiobookshelf is watching.. I got this

image

What did you expect to happen?

I expected to see my library have all 21 new books listed individually.

This has worked for other authors - but I have a small library, and limited test cases.

Steps to reproduce the issue

  1. An ePub centric folder
  2. With sub-folders - one per book
  3. File structure {Book name as folder name}/{Book name} - {Author name}.epub
  4. Add to library via file copy
  5. Let audiobookshelf do it's magic

Audiobookshelf version

2.17.5

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?

Firefox

Logs

No response

Additional Notes

No response

Originally created by @andrewlow on GitHub (Dec 15, 2024). ### What happened? I'm primarily using audiobookshelf to manage ePub books. I recently grabbed the Humble Bundle of John Scalzi books - 21 of them. They initially came with not very friendly names. ``` $ find . -type f ./oldmanswar_johnscalzi.epub ./lastemperox_johnscalzi.epub ./kaijupreservationsociety_johnscalzi.epub ./shadowwarofthenightdragons_bookone_thedeadcity_prologue_johnscalzi.epub ./zoestale_johnscalzi.epub ./lockin_johnscalzi.epub ./redshirts_johnscalzi.epub ./ghostbrigades_johnscalzi.epub ./presidentsbrainismissing_johnscalzi.epub ./consumingfire_johnscalzi.epub ./headon_johnscalzi.epub ./unlocked_johnscalzi.epub ./lastcolony_johnscalzi.epub ./yourhatemailwillbegraded_johnscalzi.epub ./humandivision_johnscalzi.epub ./fuzzynation_johnscalzi.epub ./agenttothestars_johnscalzi.epub ./androidsdream_johnscalzi.epub ./collapsingempire_johnscalzi.epub ./endofallthings_johnscalzi.epub ./afterthecoup_johnscalzi.epub ``` Ok - so I don't expect the matching to work nicely here - so of course I took the time to rename all of the files to a sensible "directory" per book. ``` $ find . -type f ./Shadow War of the Night Dragons, Book One_ The Dead City_ Prologue/Shadow War of the Night Dragons, Book One_ - John Scalzi.epub ./The Kaiju Preservation Society/The Kaiju Preservation Society - John Scalzi.epub ./Your Hate Mail Will Be Graded/Your Hate Mail Will Be Graded - John Scalzi.epub ./The Ghost Brigades/The Ghost Brigades - John Scalzi.epub ./Agent to the Stars/Agent to the Stars - John Scalzi.epub ./The Android's Dream/The Android's Dream - John Scalzi.epub ./Redshirts/Redshirts - John Scalzi.epub ./Head On/Head On - John Scalzi.epub ./Zoe's Tale/Zoe's Tale - John Scalzi.epub ./The Last Colony/The Last Colony - John Scalzi.epub ./Lock In/Lock In - John Scalzi.epub ./Unlocked/Unlocked An Oral History of Haden's Syndrome - John Scalzi.epub ./The Last Emperox/The Last Emperox - John Scalzi.epub ./The Human Division/The Human Division - John Scalzi.epub ./The Consuming Fire/The Consuming Fire - John Scalzi.epub ./The End of All Things/The End of All Things - John Scalzi.epub ./Old Man's War/Old Man's War - John Scalzi.epub ./The Collapsing Empire/The Collapsing Empire - John Scalzi.epub ./The President's Brain is Missing/The President's Brain is Missing - John Scalzi.epub ./After The Coup/After the Coup - John Scalzi.epub ./Fuzzy Nation/Fuzzy Nation - John Scalzi.epub ``` I will note - Starter Villain was already in my library .. Now, I also got here via iteration - I first tested the Redshirts would work ok - and it did. So I had a Library with Redshirts and Starter Villain However, after copying the nicely named directories into the location that audiobookshelf is watching.. I got this ![image](https://github.com/user-attachments/assets/72cfcd2e-2eea-41cc-a714-2f80edc5f640) ### What did you expect to happen? I expected to see my library have all 21 new books listed individually. This has worked for other authors - but I have a small library, and limited test cases. ### Steps to reproduce the issue 1. An ePub centric folder 2. With sub-folders - one per book 3. File structure `{Book name as folder name}/{Book name} - {Author name}.epub` 4. Add to library via file copy 5. Let audiobookshelf do it's magic ### Audiobookshelf version 2.17.5 ### 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? Firefox ### Logs _No response_ ### Additional Notes _No response_
adam added the bug label 2026-04-25 00:06:58 +02:00
adam closed this issue 2026-04-25 00:06:58 +02:00
Author
Owner

@andrewlow commented on GitHub (Dec 15, 2024):

Exploring the 'multi entry' version of Starter Villain, I can see that it has somehow combined many epubs into a single entry

image

@andrewlow commented on GitHub (Dec 15, 2024): Exploring the 'multi entry' version of Starter Villain, I can see that it has somehow combined many epubs into a single entry ![image](https://github.com/user-attachments/assets/a28af8f4-3f88-420d-ac40-c0643033558b)
Author
Owner

@andrewlow commented on GitHub (Dec 15, 2024):

I did find an old bug (close) like this - https://github.com/advplyr/audiobookshelf/issues/834 but it wasn't helpful.

@andrewlow commented on GitHub (Dec 15, 2024): I did find an old bug (close) like this - https://github.com/advplyr/audiobookshelf/issues/834 but it wasn't helpful.
Author
Owner

@andrewlow commented on GitHub (Dec 15, 2024):

I can't seem to find the 'Book Scanner' settings in the web app https://www.audiobookshelf.org/guides/book-scanner

Did this go away (and the doc is old?) - or am I just not finding it?

@andrewlow commented on GitHub (Dec 15, 2024): I can't seem to find the 'Book Scanner' settings in the web app https://www.audiobookshelf.org/guides/book-scanner Did this go away (and the doc is old?) - or am I just not finding it?
Author
Owner

@nichwall commented on GitHub (Dec 15, 2024):

This can happen if you have the watcher enabled and the book is created/updated in the database automatically. If you scroll through all of the files in the table in ABS, do you see any books which are not in a folder correctly? Once the files are attached to the book, there isn't really a good way to remove them from the book due to ABS alerting users of "missing files" in case something gets deleted on accident.

To force the database to fix the library item, you can delete the problem book from ABS (make sure the checkbox is unmarked to not delete the files from your file system) and scan the library again.

The "metadata order of precedence" is in the settings for the library. Settings -> Libraries -> Edit -> Scanner tab.

@nichwall commented on GitHub (Dec 15, 2024): This can happen if you have the watcher enabled and the book is created/updated in the database automatically. If you scroll through all of the files in the table in ABS, do you see any books which are not in a folder correctly? Once the files are attached to the book, there isn't really a good way to remove them from the book due to ABS alerting users of "missing files" in case something gets deleted on accident. To force the database to fix the library item, you can delete the problem book from ABS (make sure the checkbox is unmarked to not delete the files from your file system) and scan the library again. The "metadata order of precedence" is in the settings for the library. Settings -> Libraries -> Edit -> Scanner tab.
Author
Owner

@andrewlow commented on GitHub (Dec 15, 2024):

Thanks for the reply.

I do have the watcher enabled.

If you scroll through all of the files in the table in ABS, do you see any books which are not in a folder correctly?

I'm do not understand this comment.

I know exactly what the filesystem looks like - every book is a single .epub file, and each of those .epub files are in a unique directory (one per book).

Selecting the 2nd copy of 'Starter Villain' which was the messed up entry - and NOT allowing the deletion of the files - then deleting the entry. Then manually re-scanning the library resulted in all of the 'new' books being found and added correctly. [This fixed my problem]

I've disabled the watcher - as it seems like it was my root problem here. I can live with manually scanning to find new books, I rarely add them.

The "metadata order of precedence" is in the settings for the library. Settings -> Libraries -> Edit -> Scanner tab.

Thank you for pointing this out. I was able to find this.

It is unclear if this is a bug with the "Watcher" or if I'm doing things in a weird way. If there is more data I can gather to help identify the issue I'm willing to dig around, otherwise we can close this as my problem is solved.

@andrewlow commented on GitHub (Dec 15, 2024): Thanks for the reply. I do have the watcher enabled. > If you scroll through all of the files in the table in ABS, do you see any books which are not in a folder correctly? I'm do not understand this comment. I know exactly what the filesystem looks like - every book is a single .epub file, and each of those .epub files are in a unique directory (one per book). **Selecting the 2nd copy of 'Starter Villain' which was the messed up entry - and NOT allowing the deletion of the files - then deleting the entry. Then manually re-scanning the library resulted in all of the 'new' books being found and added correctly.** [This fixed my problem] I've disabled the watcher - as it seems like it was my root problem here. I can live with manually scanning to find new books, I rarely add them. > The "metadata order of precedence" is in the settings for the library. Settings -> Libraries -> Edit -> Scanner tab. Thank you for pointing this out. I was able to find this. It is unclear if this is a bug with the "Watcher" or if I'm doing things in a weird way. If there is more data I can gather to help identify the issue I'm willing to dig around, otherwise we can close this as my problem is solved.
Author
Owner

@advplyr commented on GitHub (Dec 21, 2024):

If I'm understanding this correctly the steps you mentioned to reproduce the issue is missing the most important step.
Let me know if this is incorrect.

When you first added those epubs in your file system they were all under a single subfolder.
The watcher will scan those in as a single book.
Then you moved the epubs into separate folders.
The watcher will detect the file path changed on those files and update the file paths.

Does that sound right?

@advplyr commented on GitHub (Dec 21, 2024): If I'm understanding this correctly the steps you mentioned to reproduce the issue is missing the most important step. Let me know if this is incorrect. When you first added those epubs in your file system they were all under a single subfolder. The watcher will scan those in as a single book. Then you moved the epubs into separate folders. The watcher will detect the file path changed on those files and update the file paths. Does that sound right?
Author
Owner

@andrewlow commented on GitHub (Dec 23, 2024):

Darn - I did initially have them all as a single sub-folder.. but with different names.

When I moved them to unique sub-folders - I changed the names of each of them. Yes - it was a mv operation to move

mv shortname.epub folder-bookname/bookname.epub

but yes - if the system was able to identify the file by something other than the name.. it could have all been a single ebook...

@andrewlow commented on GitHub (Dec 23, 2024): Darn - I did initially have them all as a single sub-folder.. but with different names. When I moved them to unique sub-folders - I changed the names of each of them. Yes - it was a `mv` operation to move ``` mv shortname.epub folder-bookname/bookname.epub ``` but yes - if the system was able to identify the file by something other than the name.. it could have all been a single ebook...
Author
Owner

@advplyr commented on GitHub (Dec 23, 2024):

Abs uses the filesystems inode value so that if you rename the file Abs knows it is the same file.
This case is specific to the ebooks already being in a subfolder and already being scanned into the system. Since you can have a book in a folder that has subfolders like "CD01" to break out the files Abs allows you to move ebook/audio files into subfolders of the existing book.
I'm not sure if that makes sense. We don't necessarily want to remove the existing book that was scanned in and create separate books anytime an ebook/audio file is moved into a subfolder

@advplyr commented on GitHub (Dec 23, 2024): Abs uses the filesystems inode value so that if you rename the file Abs knows it is the same file. This case is specific to the ebooks already being in a subfolder and already being scanned into the system. Since you can have a book in a folder that has subfolders like "CD01" to break out the files Abs allows you to move ebook/audio files into subfolders of the existing book. I'm not sure if that makes sense. We don't necessarily want to remove the existing book that was scanned in and create separate books anytime an ebook/audio file is moved into a subfolder
Author
Owner

@andrewlow commented on GitHub (Dec 23, 2024):

Well - if it's using the inode, yeah - renaming the file doesn't change that. I clearly just got confused initially when I bulk added the files - then didn't 'reset' things by deleting them - and re-creating them as a new thing.

Let's close this issue.

@andrewlow commented on GitHub (Dec 23, 2024): Well - if it's using the inode, yeah - renaming the file doesn't change that. I clearly just got confused initially when I bulk added the files - then didn't 'reset' things by deleting them - and re-creating them as a new thing. Let's close this issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2425