12-28-2012, 11:19 AM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: Dec 2012
Device: Kindle
|
Programmatically adding/editing metadata
I have a large number of text files that I have imported into Calibre, and then converted to .mobi format. Within each text file is the title and author's name.
What would be a possible approach to extracting this information, and then adding to the metadata? Would I need to first add metadata to the associated .opf file? Can I use Calibre, or will I need to use something like Visual Basic? |
12-28-2012, 11:26 AM | #2 | |
Well trained by Cats
Posts: 29,782
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
|
|
12-28-2012, 03:20 PM | #3 |
Handy Elephant
Posts: 1,736
Karma: 26785668
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Thinkpad E595, Ubuntu Mate, Huawei Mediapad 5, Bouye Likebook Plus
|
One easy way could be to import the text files again, but first rename them using the metadata inside the files. A script or small program would be needed. I assume that the book titles and author is easy to find inside the text files, using grep or something similar?
|
12-28-2012, 03:40 PM | #4 |
Junior Member
Posts: 3
Karma: 10
Join Date: Dec 2012
Device: Kindle
|
Yes, Adoby, the title and author could be parsed from the text. So would I add both title and author to the renamed file, then Calibre would use the filename to populate the metadata? Would I use the CLI to do the import?
|
12-28-2012, 09:23 PM | #5 |
Handy Elephant
Posts: 1,736
Karma: 26785668
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Thinkpad E595, Ubuntu Mate, Huawei Mediapad 5, Bouye Likebook Plus
|
You can read the title and author from the filenames when you add books using the normal gui.
http://manual.calibre-ebook.com/gui....ename-metadata That is the easy part. Getting the metadata from inside the text files into the filenames is the slightly less easy part. |
12-28-2012, 09:33 PM | #6 |
Junior Member
Posts: 3
Karma: 10
Join Date: Dec 2012
Device: Kindle
|
Thanks for the advice! Now to work on figuring out GREP and regular expressions.
|
12-29-2012, 05:59 PM | #7 |
eWanderer
Posts: 523
Karma: 1441998
Join Date: Jul 2010
Location: NC, USA
Device: iMac,iPad3,iPhone5-Kindle Fire,Touch,PaperWhite
|
You don't mention the format of your text files. Make sure you search the web for answers.. I recently had to change meta data on a large number of pdf's and web searches provided several ways of doing this.. from Applescript (I use Mac) to Acrobat Pro to scripts on the web (load the files to web space and run an existing cgi script.).
I know that doesn't apply to your text files.... my only point is to search for existing answers before you spend hours on your own script. My 1500 pdf files were modified in no time. I saved hours and hours of work. |
Tags |
metadata |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Metadata editing | myrtsbnye | Calibre | 4 | 01-20-2012 02:23 AM |
Metadata editing | Hrafn | ePub | 1 | 08-05-2011 02:33 AM |
editing metadata | sovre | Sony Reader | 1 | 03-15-2011 08:47 AM |
editing OPF on sigil and adding flash file | shlomof | Sigil | 5 | 02-23-2011 02:39 PM |
Question about metatag editing and then adding titles to the Connect library | gorham09 | Sony Reader | 7 | 08-16-2007 03:39 PM |