Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 12-26-2011, 03:41 PM   #1
TuxGirl
Zealot
TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.
 
Posts: 105
Karma: 8670
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?
TuxGirl is offline   Reply With Quote
Old 12-26-2011, 04:38 PM   #2
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 14,645
Karma: 5629001
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by TuxGirl View Post
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?
calibredb add --help
lists what you can do
you can use multiple switches at the on the same commandline
theducks is offline   Reply With Quote
Old 12-27-2011, 01:08 AM   #3
TuxGirl
Zealot
TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.
 
Posts: 105
Karma: 8670
Join Date: Sep 2009
Device: kindle
Quote:
Originally Posted by theducks View Post
calibredb add --help
lists what you can do
you can use multiple switches at the on the same commandline
I understand that. I don't see any way to add tags or comments to a book from the command-line anywhere. I guess the issue is that I'm hoping that I'm missing some way to do this from the command-line.

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.
TuxGirl is offline   Reply With Quote
Old 12-27-2011, 01:20 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,948
Karma: 5036099
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.
kovidgoyal is online now   Reply With Quote
Old 12-27-2011, 01:23 AM   #5
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 2,232
Karma: 1958712
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Mini, iPhone, iPad, Kobo Aura, Galaxy Tab3 8
Not with calibre-add, but in some cases you can use edit-meta before, and there you can add tags and comments.
Terisa de morgan is offline   Reply With Quote
Old 12-27-2011, 01:35 AM   #6
TuxGirl
Zealot
TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.
 
Posts: 105
Karma: 8670
Join Date: Sep 2009
Device: kindle
Quote:
Originally Posted by kovidgoyal View Post
There's no way to do it if you aren't willing to work with OPF files.
Okay... I guess I'll have to look into OPF files, or maybe determine whether porting to a plugin will give me what I want...

Thanks!
~Erin
TuxGirl is offline   Reply With Quote
Old 12-27-2011, 01:45 AM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,948
Karma: 5036099
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
kovidgoyal is online now   Reply With Quote
Old 12-27-2011, 01:54 AM   #8
TuxGirl
Zealot
TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.
 
Posts: 105
Karma: 8670
Join Date: Sep 2009
Device: kindle
will do that.

this should be an interesting process... Trying to add around 1500 books programmatically.
TuxGirl is offline   Reply With Quote
Old 12-27-2011, 01:59 AM   #9
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 2,232
Karma: 1958712
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Mini, iPhone, iPad, Kobo Aura, Galaxy Tab3 8
The problem is not adding them (I usually add books in batch from command line, never UI), but getting the right metadata into them
Terisa de morgan is offline   Reply With Quote
Old 12-27-2011, 09:10 PM   #10
TuxGirl
Zealot
TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.
 
Posts: 105
Karma: 8670
Join Date: Sep 2009
Device: kindle
Quote:
Originally Posted by Terisa de morgan View Post
The problem is not adding them (I usually add books in batch from command line, never UI), but getting the right metadata into them
I'm writing a script that yanks all the metadata from amazon while adding the books. It's not pretty, but it should work...

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.
TuxGirl is offline   Reply With Quote
Old 12-28-2011, 01:40 AM   #11
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 2,232
Karma: 1958712
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Mini, iPhone, iPad, Kobo Aura, Galaxy Tab3 8
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.
Terisa de morgan is offline   Reply With Quote
Old 12-28-2011, 03:19 PM   #12
TuxGirl
Zealot
TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.
 
Posts: 105
Karma: 8670
Join Date: Sep 2009
Device: kindle
Quote:
Originally Posted by Terisa de morgan View Post
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.
Hmmm... I've got it adding the empty book, and then adding the metadata to the book. It's working so far in a couple of tests.. Once I've run it without needing any edits, I'll post it here in case anyone wants to mess with it.

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...
TuxGirl is offline   Reply With Quote
Old 12-28-2011, 04:12 PM   #13
TuxGirl
Zealot
TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.
 
Posts: 105
Karma: 8670
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."
Attached Files
File Type: txt calibre-book-import.rb.txt (3.2 KB, 118 views)

Last edited by TuxGirl; 12-28-2011 at 04:40 PM.
TuxGirl is offline   Reply With Quote
Old 12-28-2011, 04:38 PM   #14
TuxGirl
Zealot
TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.TuxGirl shines like a glazed doughnut.
 
Posts: 105
Karma: 8670
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.
TuxGirl is offline   Reply With Quote
Old 12-28-2011, 05:22 PM   #15
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 2,232
Karma: 1958712
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Mini, iPhone, iPad, Kobo Aura, Galaxy Tab3 8
Quote:
Originally Posted by TuxGirl View Post
Hmmm... I've got it adding the empty book, and then adding the metadata to the book. It's working so far in a couple of tests.. Once I've run it without needing any edits, I'll post it here in case anyone wants to mess with it.

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...
Yes, please, I'm more "plain", I add metadata and later the book with a bat file, but I give the params, I don't get them from internet.
Terisa de morgan is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 10:54 AM.


MobileRead.com is a privately owned, operated and funded community.