12-26-2011, 03:41 PM | #1 |
Groupie
Posts: 179
Karma: 141378
Join Date: Sep 2009
Device: kindle
|
calibredb add -- how to add additional metadata?
I'm trying to figure out how to an empty ebook from the command-line while adding fields such as tags and comments. Is that possible? If not, is that something I can do somehow without having to write out opf files for each book that I'm doing it with?
|
12-26-2011, 04:38 PM | #2 | |
Well trained by Cats
Posts: 30,397
Karma: 58055234
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
lists what you can do you can use multiple switches at the on the same commandline |
|
Advert | |
|
12-27-2011, 01:08 AM | #3 | |
Groupie
Posts: 179
Karma: 141378
Join Date: Sep 2009
Device: kindle
|
Quote:
I'm trying to write a script that can import all my kindle books into the calibre db as empty books. Perhaps writing this as a plugin would work better, but I have no python experience, so I'm working on this in a ruby script. |
|
12-27-2011, 01:20 AM | #4 |
creator of calibre
Posts: 44,381
Karma: 23766374
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
There's no way to do it if you aren't willing to work with OPF files.
|
12-27-2011, 01:23 AM | #5 |
Grand Sorcerer
Posts: 6,359
Karma: 12117217
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Not with calibre-add, but in some cases you can use edit-meta before, and there you can add tags and comments.
|
Advert | |
|
12-27-2011, 01:35 AM | #6 |
Groupie
Posts: 179
Karma: 141378
Join Date: Sep 2009
Device: kindle
|
|
12-27-2011, 01:45 AM | #7 |
creator of calibre
Posts: 44,381
Karma: 23766374
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Its not that hard, OPF is just a simple XML file. Use
calibredb show_metadata --as-opf to generate the OPF file, then edit it, and use set_metadata |
12-27-2011, 01:54 AM | #8 |
Groupie
Posts: 179
Karma: 141378
Join Date: Sep 2009
Device: kindle
|
will do that.
this should be an interesting process... Trying to add around 1500 books programmatically. |
12-27-2011, 01:59 AM | #9 |
Grand Sorcerer
Posts: 6,359
Karma: 12117217
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
The problem is not adding them (I usually add books in batch from command line, never UI), but getting the right metadata into them
|
12-27-2011, 09:10 PM | #10 | |
Groupie
Posts: 179
Karma: 141378
Join Date: Sep 2009
Device: kindle
|
Quote:
I'm grabbing the categorization that Amazon lists for tags, and sticking the item description in the comments field. Hopefully that should handle most of the hard work of adding the books. |
|
12-28-2011, 01:40 AM | #11 |
Grand Sorcerer
Posts: 6,359
Karma: 12117217
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
If you're doing that, you can have two steps: the first one updates metadata (edit-meta) and the second one adds the book (calibre-add). I'm doing it in that way and it works.
|
12-28-2011, 03:19 PM | #12 | |
Groupie
Posts: 179
Karma: 141378
Join Date: Sep 2009
Device: kindle
|
Quote:
It's not super user-friendly, and requires ruby and some rubygems libraries, along with an amazon AWS account, but it does appear to work so far... |
|
12-28-2011, 04:12 PM | #13 |
Groupie
Posts: 179
Karma: 141378
Join Date: Sep 2009
Device: kindle
|
Okay... It's imported around 120 books so far, with no errors, so here it is... (you will have to pull the .txt off the end of the file)
I'm not responsible if this causes problems, so make sure you back up your existing library before using it. If you hit an error, I may or may not be able to fix it. It's currently set up for use on a mac. If you have a PC, you may have to change settings like the location of ruby. Either way, you need to make an amazon config file (on mac or linux, it's ~/.amazonrc) with your AWS account info, install ruby, install rubygems, and then install the fastercsv and ruby-aaws gems. You will also want to add a metadata field called "ASIN" to your calibre setup. From there, it can take a tab-delimited csv file (with headers) that has at least 'Binding' and 'ASIN'. I use the shelfari export csv, with no modifications to it. If you want different functionality, I probably won't be willing to modify it myself, but you'll have the code, so you can either modify it yourself, or find someone to modify it for you. It's an ugly script, and not commented... I know that. I probably won't be making many/any improvements to it, since it's doing what I need it for... I guess the summary of the above is "I'm throwing this script over the wall and if you want it, you can make it work for what you need, but I'm not going to be heavily supporting it. If you get a specific error, you can try asking in this thread, and if I know immediately what's causing it, I'll try to help, but I'm not going to put lots of effort into making it better right now, since I've got other things on my plate these days." Last edited by TuxGirl; 12-28-2011 at 04:40 PM. |
12-28-2011, 04:38 PM | #14 |
Groupie
Posts: 179
Karma: 141378
Join Date: Sep 2009
Device: kindle
|
oh... just a warning... the script is pretty chatty. i've been running it with the output piping to a file, but you could just pipe it to /dev/null (although if you then have problems, it'll be hard to find the source unless you re-run it with the output going to a file or to stdout.
|
12-28-2011, 05:22 PM | #15 | |
Grand Sorcerer
Posts: 6,359
Karma: 12117217
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Quote:
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Defining Metadata with "calibredb add" command line function. | macr0t0r | Calibre | 3 | 03-01-2012 07:36 PM |
Slow calibredb add on huge ebooks directory | ternyk | Library Management | 8 | 05-17-2011 04:39 AM |
Can I add additional formats? | tinjaw | Calibre | 2 | 02-07-2011 11:09 PM |
Calibredb add after ebook-convert fails | spullar | Calibre | 5 | 03-04-2010 01:14 PM |
Way to add additional information with Calibre? | MidknytOwl | Sony Reader | 5 | 09-11-2009 01:53 PM |