View Single Post
Old 05-20-2013, 05:11 AM   #1
simobk
Junior Member
simobk began at the beginning.
 
Posts: 3
Karma: 10
Join Date: May 2013
Device: Asus TF201; Asus Nexus 7; HTC Droid DNA
Filename to Metadata

Hi all,

OK, I've been using PDF as my ebook format until now. I read a bit and decided to start using ePub from now on.

I name ALL my ebooks : Author - Title (year).pdf

Is there anyway to generate the metadata from the file?

For example, I had written this little script to do this with my PDF's :
Code:
// Get the current filename
var fullName = this.documentFileName;
// Extract author, title and year
var author = fullName.slice(0,fullName.indexOf(" - "));
var title = fullName.slice(fullName.indexOf(" - ")+3, fullName.indexOf(" ("));
var year = fullName.slice(fullName.indexOf(" (")+2, fullName.indexOf(").pdf"));
// Insert metadata
this.info.Author = author;
this.info.Title = title;
In case there is no such tool, I played a bit with the files and realized they are actually ZIP file. After extracting them, I found the content.opf file which is actually an XML file.

I should be able to write me a little script that changes the metadata for me, I just want confirmation from the more experienced users about this :
  1. Is content.opf the only file to edit?
  2. Is all the metadata contained in the <metadata> tag?
  3. I am under the impression that the only "standard" tags are the ones starting with <dc:...> and everything else is editor specific. Please confirm?
  4. Is there always a cover.jpg inside the files?

Thanks for any and all help!

Simo

Last edited by simobk; 05-20-2013 at 05:17 AM.
simobk is offline   Reply With Quote