audiobookshelf
audiobookshelf copied to clipboard
Added functionality to rename book folders.
Added a defaultRenameFormat setting on the server. This item is returned when fetching server settings to be displayed by clients and updated as appropriate. Two api endpoints added:
/api/tools/item/[ID]/renameFolder?includeSampleTemplate=1&strFormat=$bookName. includeSampleTemplate(optional) will return a object with each supported format string, and what it would process to for the existing entity.
the GET method for the above endpoint will just return what would happen if you did rename, without actually altering anything. the POST of the method will execute the rename. Logic exists to check if target folder exists, or is a subfolder of another book. Will fail gracefully if so.
Added client code to interact with the above endpoints.
Is it possible to move items from one directory to another?
For example I currently use /audiobooks/temp and /audiobooks/clean. Could this tool move from one to the other, or can it only change the immediate directory?
Is it possible to move items from one directory to another?
For example I currently use /audiobooks/temp and /audiobooks/clean. Could this tool move from one to the other, or can it only change the immediate directory?
Yes and no. Copying answer from discord:
If your setup is like this, then no. The process will not move a book to a new parent folder:
If your setup is like this then yes you can, as they are all subfolders of the single parent folder:
@advplyr Is there any chance this will be merged in the near future? I very much need something to clean up my folder structure. I starting writing code using the API but then realized the API doesn't provide the means of changing the storage path which means I'd have to look at hitting the DB directly which makes me cringe somewhat.
This would be a great addition. Any chance for it being approved?
I agree, it would be a great addition, been subscribed for some time now waiting to see if it will be approved, any updated on it's status would be appreciated!
That feature would make this project for incredible to Perfect! I too would need something like that for my folder structure
Would love this!!! I was going to set up readarr to accomplish the same thing, but it doesn't integrate with Audiobookshelf metadata.
Please please please :)
I'm going to hop in and say I agree with those above. I haven't yet found a good way to keep my library organized (Reader and LazyLibrarian have their issues), and so this would be a great step in that goal.
So please give us an update when you have time, even if it's to let us know why you're not accepting this PR, and the steps needed to make it acceptable.
Regardless, Thanks for the great work!
Whether reorganizing files should be a part of the core ABS functionality or left to external scripts/plugins/tools is still up in the air.
Possibly nothing advanced, but some basic moving/renaming would still be great if you modify some metadata or need to change your directory structure.
The issue is that if an external tool is used for moving files, it must also transfer all the metadata and image files. Additionally, it should read the metadata file to understand the desired folder structure. Then, you'll need to resync the Audiobookshelf library and hope it detects the changes, instead of causing errors with the books.
It would be more efficient if ABS managed the renaming and library updates in a single action.
The issue is that if an external tool is used for moving files, it must also transfer all the metadata and image files. Additionally, it should read the metadata file to understand the desired folder structure. Then, you'll need to resync the Audiobookshelf library and hope it detects the changes, instead of causing errors with the books.
It would be more efficient if ABS managed the renaming and library updates in a single action.
It has been a long time since I wrote this, but as I recall I move the files using the system move function, but also update the audiobook shelf of the new location so no re-scan is needed.
I have also done a move, then done a clean import of the moved files and as long as the metadata file is written in the folder, ABS loads that data and imports successfully. I didn't do many tests if the file was not written IIRC, but it was a long time ago :P
I have chatted with the author about the change in discord and he seems to like the idea, but isint sure when he is going to tackle the change - i dont think his plan is to import this PR but re-code it in his own style (but I could be wrong)
Are there any updates regarding the 'new' implementation or accepting this PR ? I would REALLY like this feature being added.
If there are things missing, let me know and i can probably contribute as well.
@advplyr Any chance of an update or potential merge?
I have created a basic terminal utility that can help create a new directory structure based on the metadata.json file, until a more permanent solution can be rolled into the application or some official utility to do it. It doesn't actually move the files itself but generates the bash to do so. https://github.com/austinsr1/ab_mover/
I have created a basic terminal utility that can help create a new directory structure based on the metadata.json file, until a more permanent solution can be rolled into the application or some official utility to do it. It doesn't actually move the files itself but generates the bash to do so. https://github.com/austinsr1/ab_mover/
Looks great - thanks for the effort! Only thing it does not do well is handle in-between books. Books with the number of e.g. 2.5 get put as book 2. Example:
mv '/Path/Example Author/ Example Book 2.50'/* '/Path/Example Author/Example Series/Book 2/'
Thanks for the bug report! Its been fixed on github.
On Fri, Jun 7, 2024 at 10:51 PM Elsu @.***> wrote:
I have created a basic terminal utility that can help create a new directory structure based on the metadata.json file, until a more permanent solution can be rolled into the application or some official utility to do it. It doesn't actually move the files itself but generates the bash to do so. https://github.com/austinsr1/ab_mover/
Looks great - thanks for the effort! Only thing it does not do well is handle in-between books. Books with the number of e.g. 2.5 get put as book 2. Example:
mv '/Path/Example Author/ Example Book 2.50'/* '/Path/Example Author/Example Series/Book 2/'
— Reply to this email directly, view it on GitHub https://github.com/advplyr/audiobookshelf/pull/1521#issuecomment-2155776490, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXQP63M76V2OOVEC52QQ5G3ZGJWUPAVCNFSM6AAAAAAVCA4LVSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJVG43TMNBZGA . You are receiving this because you commented.Message ID: @.***>
Thanks for the bug report! Its been fixed on github. …
Thanks mate. Sent you a suggestion for avoding listing already aligned files.
Another issue I found is that ' in e.g. the authors name breaks it script. Have not tested whether there are any more.
The issue is that if an external tool is used for moving files, it must also transfer all the metadata and image files. Additionally, it should read the metadata file to understand the desired folder structure. Then, you'll need to resync the Audiobookshelf library and hope it detects the changes, instead of causing errors with the books. It would be more efficient if ABS managed the renaming and library updates in a single action.
It has been a long time since I wrote this, but as I recall I move the files using the system move function, but also update the audiobook shelf of the new location so no re-scan is needed.
I have also done a move, then done a clean import of the moved files and as long as the metadata file is written in the folder, ABS loads that data and imports successfully. I didn't do many tests if the file was not written IIRC, but it was a long time ago :P
I have chatted with the author about the change in discord and he seems to like the idea, but isint sure when he is going to tackle the change - i dont think his plan is to import this PR but re-code it in his own style (but I could be wrong)
Could you bring this topic up again ?
This is one of the features I'm missing. Been doing this with Mp3Tag for my Plex audiobook library.