![]() |
#1 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jan 2012
Device: Acer Android Tablet
|
Adding books recursively...
Calibre can add books recursively from a directory hierarchy, and this works
fine. However, during flattening out of the directories, directory information is lost. Say I have a book in a directory dirA/dirB/dirC/book.pdf. I would like dirA, dirB, dirC to be entered as tags while adding the book into the library. Later on searching the tags for dirA would list all books under the directory dirA. Searching for dirC would list only the books under the directory dirC. Is there an easy way to do this? I didn't see any feature that would allow me to do this. Would it be possible to do this with a plug-in? I am thinking that after adding all the books, perhaps adding entries into the tags table would accomplish this. Thanks for any help -Dave |
![]() |
![]() |
![]() |
#2 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,973
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Directory paths can not supply Metadata, only the title. Calibre can get those books, just not any path data |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
reader
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,977
Karma: 5183568
Join Date: Mar 2006
Location: Mississippi, USA
Device: Kindle 3, Kobo Glo HD
|
You can manually add the tags using Edit Metadata -> Edit Metadata in Bulk -> Add tags, providing you have a way to select the ebooks once in Calibre. Adding the folders one at a time would be one way to make selection easy.
|
![]() |
![]() |
![]() |
#4 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jan 2012
Device: Acer Android Tablet
|
Tags can be updated manually, but I think it will be tedious. There are tens of
nested directories with hundreds of books, already categorized nicely. Maybe it is possible to accomplish this automatically. I was looking at the simple HelloWorld plugin based on FileTypePlugin. I changed on_postprocess to on_import so that it gets called when a book is imported. However when I added a simple line print "Hello", I got a syntax error. I wanted to print path_to_ebook to see if that variable contains the path to the book BEFORE or AFTER the import. |
![]() |
![]() |
![]() |
#5 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 288
Karma: 1003542
Join Date: May 2011
Device: Google Nexus 7 16GB
|
I'm sure there is a way to do this,
probably involving a simple "folder to text" program that will give you a list of the folders and files in a directory. as a text file. Then some inport function with regular expression.. Anyway good luck |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jan 2012
Device: Acer Android Tablet
|
theducks, wallcraft, transmitthis: thank you for your comments.
There is some progress. The example plugin is called before the book is imported and contains the full file path to the book. Tags work like this. There is a tag table is defined as(id int, name text), each entry is a tag. Each book also has an entry in the books table with a unique id int. books_tags_link table links the two table with (id int, book int, tag int). I can update the tags and books_tags_link table from the plugin. But, here is the problem: when the plugin is called, the book has not been entered into the book table yet and therefore does not have an id. Without the book id, it is not possible to make an entry into the books_tags_link table. I thought of getting the max(id) from books table and incrementing it, but the system rejects the request because the book ID is not in the known books range. It also is not reliable that the next ID will always be exactly one more from the previous one. What is needed is that the calibre calls the plugin after the book is entered into the books table (as well as before). I don't know how to go from here. If the book titles are unique, then it is possible to build a file with two columns: path and book title. and then run an external program to generate tags and update books_tags_link table. |
![]() |
![]() |
![]() |
Tags |
adding books tags |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Adding books with same name, different language | magphil | Calibre | 2 | 11-22-2011 12:30 PM |
Adding books | RiotGrrl | Library Management | 4 | 05-01-2011 05:22 AM |
Adding Books | cityzen | Library Management | 3 | 04-15-2011 12:51 AM |
error adding books | Beau | Calibre | 5 | 11-02-2010 12:03 PM |
Help with adding books please | stustaff | Calibre | 12 | 10-27-2009 02:30 PM |