Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 12-28-2012, 11:19 AM   #1
northernbio
Junior Member
northernbio began at the beginning.
 
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?
northernbio is offline   Reply With Quote
Old 12-28-2012, 11:26 AM   #2
theducks
Well trained by Cats
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: 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:
Originally Posted by northernbio View Post
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?
Look in the Help file: Command line Interface section (CLI) for what can be done that way (possibly with a BAT file)
theducks is offline   Reply With Quote
Old 12-28-2012, 03:20 PM   #3
Adoby
Handy Elephant
Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.
 
Adoby's Avatar
 
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?
Adoby is offline   Reply With Quote
Old 12-28-2012, 03:40 PM   #4
northernbio
Junior Member
northernbio began at the beginning.
 
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?
northernbio is offline   Reply With Quote
Old 12-28-2012, 09:23 PM   #5
Adoby
Handy Elephant
Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.
 
Adoby's Avatar
 
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.
Adoby is offline   Reply With Quote
Old 12-28-2012, 09:33 PM   #6
northernbio
Junior Member
northernbio began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2012
Device: Kindle
Thanks for the advice! Now to work on figuring out GREP and regular expressions.
northernbio is offline   Reply With Quote
Old 12-29-2012, 05:59 PM   #7
1611mac
eWanderer
1611mac ought to be getting tired of karma fortunes by now.1611mac ought to be getting tired of karma fortunes by now.1611mac ought to be getting tired of karma fortunes by now.1611mac ought to be getting tired of karma fortunes by now.1611mac ought to be getting tired of karma fortunes by now.1611mac ought to be getting tired of karma fortunes by now.1611mac ought to be getting tired of karma fortunes by now.1611mac ought to be getting tired of karma fortunes by now.1611mac ought to be getting tired of karma fortunes by now.1611mac ought to be getting tired of karma fortunes by now.1611mac ought to be getting tired of karma fortunes by now.
 
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.
1611mac is offline   Reply With Quote
Reply

Tags
metadata


Forum Jump

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


All times are GMT -4. The time now is 08:20 PM.


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