Audiobookshelf - Folder/File Format

Support for unRAID and docker container users
Post Reply
IncomDis
Posts: 9
Joined: 11 Sep 2023, 02:57

Audiobookshelf - Folder/File Format

Post by IncomDis »

I really hope FileBot is the fix to my problem. I have a bunch of audiobook files that I need to hardlink and create a folder system for Audiobookshelf to read them correctly.

Right now my original files are either single m4b/mp3 files or they are folders with m4b/mp3, jpg, nfo and cue files.

The way I would like to organize these is -

-Shirtaloon (Author(folder))
--He Who Fights With Monsters (Series(folder))
---2021 - Book 1 - He Who Fights with Monsters (Title(folder)Is
----Hardlinked Files

I have found that the name of the hardlinked files does not matter as much as the folder system.
is this something FileBot can do for me?
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Audiobookshelf - Folder/File Format

Post by rednoah »

:?: Do files have ID3 Tags? What are the current file paths? Please read How to Request Help.

:idea: If yes, then you can use Music Mode.

:idea: If no, maybe you can use Plain File Mode to rewrite file paths based on information in the file path and nearby files.

:idea: The target file path is entirely up to your custom format expression.
:idea: Please read the FAQ and How to Request Help.
IncomDis
Posts: 9
Joined: 11 Sep 2023, 02:57

Re: Audiobookshelf - Folder/File Format

Post by IncomDis »

Yes all the files have ID3 tags but not all of them are perfectly accurate.

I have figured out a file path and format expression that gets me close but because of some of the inaccurate ID3 tags like {artist} will create different artist folder for the same artist. While in the hardlink setting when I click on the destination file and try and change just that single format it changes all the formats to that expression.

Is there a way to change the expression just for one file while working with multiple files?
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Audiobookshelf - Folder/File Format

Post by rednoah »

IncomDis wrote: 12 Sep 2023, 04:17 I have figured out a file path and format expression that gets me close but because of some of the inaccurate ID3 tags like {artist} will create different artist folder for the same artist.
:?: Please share your format expression for the benefit of all readers including your future self.

IncomDis wrote: 12 Sep 2023, 04:17 Is there a way to change the expression just for one file while working with multiple files?
:idea: No, but you can use Edit Name (i.e. F2 keyboard shortcut) to edit a New Names item before renaming.

:idea: Yes, your format can yield different results for different files. But baking special logic for one individual file into your custom format is probably not very smart. Might make sense if there's a pattern though.
:idea: Please read the FAQ and How to Request Help.
IncomDis
Posts: 9
Joined: 11 Sep 2023, 02:57

Re: Audiobookshelf - Folder/File Format

Post by IncomDis »

rednoah wrote: 12 Sep 2023, 05:01 :?: Please share your format expression for the benefit of all readers including your future self.
I am using Audiobookshelf and following their Directory Structure

Using ID3 tags in music mode
/storage/data/media/audiobooks/{artist}/{album}/{y} - {t} - Book#/{y} - {artist} - {t}
( ^ change this path as desired ^ ) -------------------(Change book #^)---(^file name^)

There will be a lot of manual "edit file" but I think it will be worth it in the end

Thanks for your help!
IncomDis
Posts: 9
Joined: 11 Sep 2023, 02:57

Re: Audiobookshelf - Folder/File Format

Post by IncomDis »

Another question...

After I hardlink these, Audiobookshelf lets me change tagging to help with identifying the book. If I change any of this in the hardlinked file will this sever the link?
IncomDis
Posts: 9
Joined: 11 Sep 2023, 02:57

Re: Audiobookshelf - Folder/File Format

Post by IncomDis »

I want to edit my post above, After messing around with naming some more I found a better way that is more mobile frendliy as that is what the majority of my listeners use.

Format Expression -
/storage/data/media/audiobooks/{artist}/{album}/Book # - {t}({y})/Book # - {t}

Format Description -
/Desired/File/Path/Here/Author/Series/Book # - Title(year)/Book # - Title

Example :arrow: :arrow: :arrow:

Original File -
Defiance of the Fall 4_A LitRPG Adventure

New Names -
/storage/data/media/audiobooks/TheFirstDefier, JF Brink/Defiance of the Fall 4: A LitRPG Adventure (Unabridged)/Book # - Defiance of the Fall 4: A LitRPG Adventure (Unabridged)(2022)/Book # - Defiance of the Fall 4: A LitRPG Adventure (Unabridged)

Edit Name - This is were I make sure the Author and Series match to the rest of the books, everything else is preference.
/storage/data/media/audiobooks/TheFirstDefier, JF Brink/Defiance of the Fall/Book 4 - Defiance of the Fall(2022)/Book 4 - Defiance of the Fall

---------------------------------------

:idea: If there is not a series of books I would lay it out like
/Desired/File/Path/Here/Author/Title(year)/Title
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Audiobookshelf - Folder/File Format

Post by rednoah »

1.
Looks like you might want to match the Book # from the file name if you can't get it from the ID3 Tags.

e.g. match the first number from the current file name:

Format: Select all

{ fn.match(/\d+/) }
** you may need to adjust the regex pattern to your needs since the "first number in the file name" may not necessarily always be the Book # depending on your files

:arrow: Match information from the file path



2.
IncomDis wrote: 12 Sep 2023, 21:52 :idea: If there is not a series of books I would lay it out like
/Desired/File/Path/Here/Author/Title(year)/Title
Possible. But how do you know if a book is part of a series of books? Based on ID3 Tags? Based on file name patterns? Based on other files in the same folder? Anything is possible, if you can express the condition in code.

:arrow: Conditional Structures (if-then-else)
:idea: Please read the FAQ and How to Request Help.
IncomDis
Posts: 9
Joined: 11 Sep 2023, 02:57

Re: Audiobookshelf - Folder/File Format

Post by IncomDis »

Hardlink does not seem to be working, These files should be linked and when I `ls -i` to find the inode they come back different.

Image
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Audiobookshelf - Folder/File Format

Post by rednoah »

:?: What is the command you are using and what does the console output say?

:idea: If you use --action hardlink then it'll either create a hardlink or fail. There is no other possibility.



IncomDis wrote: 12 Sep 2023, 17:48 After I hardlink these, Audiobookshelf lets me change tagging to help with identifying the book. If I change any of this in the hardlinked file will this sever the link?
Every file is a hardlink, because every file is just a "link" to the physical data on disk. You can have multiple "links" that refer to the same physical data on disk, i.e. you can have the same file at multiple file paths, which means modifying one file is the same as modifying the other file, since both files are "links" to the same physical data on disk.

Screenshot
:idea: Please read the FAQ and How to Request Help.
IncomDis
Posts: 9
Joined: 11 Sep 2023, 02:57

Re: Audiobookshelf - Folder/File Format

Post by IncomDis »

I just did another,

Matched with ID3 Tags and renamed
Image

Clicked Hardlink
Image

Original File
Image

"Hardlinked" File
Image

Both should share the same inode number, correct?

This is all in the same share of /data
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Audiobookshelf - Folder/File Format

Post by rednoah »

:?: Can you provide more context? Linux? Desktop? Docker? Local files? Remote network share?


:idea: If FileBot confirms the hardlink operation, then it worked, as far as FileBot knows. Keep in mind that FileBot merely asks the OS to "hardlink A to B" and then the OS / file system driver does the work. If remote file system are involved, the local OS may not necessarily know what the remote OS does. You'll want to run your ls -li checks on the local file system on the OS that hosts the files locally. If you do ls -li on a remote SMB share, then that might hide native file system details.


:idea: You can run a test like this to do some trial & error testing for yourself:

Console Output: Select all

$ ls -li
50173353 -rw-r-----@ 1 ... Alias.1x01.mp4
$ filebot -rename Alias.1x01.mp4 --action hardlink --log INFO
[HARDLINK] from [Alias.1x01.mp4] to [Alias - 1x01 - Truth Be Told.mp4]
$ ls -li
50173353 -rw-r-----@ 2 ... Alias - 1x01 - Truth Be Told.mp4
50173353 -rw-r-----@ 2 ... Alias.1x01.mp4
** after hardlinking the file, we have the inode twice, and the link count goes from 1 to 2
:idea: Please read the FAQ and How to Request Help.
IncomDis
Posts: 9
Joined: 11 Sep 2023, 02:57

Re: Audiobookshelf - Folder/File Format

Post by IncomDis »

This is on Unraid in docker, All local on the server.

here is the ls -li from yesterday and it looks like the permissions on the folder changed the permissions on the file.
Image

Just did this one and kept it in the same folder and the permissions stayed the same and the inode numbers stayed the same.
Image

could the permissions be what is messing it up?
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Audiobookshelf - Folder/File Format

Post by rednoah »

IncomDis wrote: 15 Sep 2023, 14:54 Image
This screenshot shows 1 directory (see d in permissions) and 1 file, and confirms that the file is one of 2 (see 2 after permissions) hardlinks. The screenshot notably does not show the other hardlink. You seem to be comparing the inode number of a subdirectory with the inode number of a file? Those would be different of course.
:idea: Please read the FAQ and How to Request Help.
IncomDis
Posts: 9
Joined: 11 Sep 2023, 02:57

Re: Audiobookshelf - Folder/File Format

Post by IncomDis »

Thanks you for explaing that to me!

A am still newish to Linux and sometimes don't really understand what i am looking at or know the right commands.

after running ls -li in the correct directory they do match.
Image

Thank you again!
Post Reply