Calibre commonly used command line tools: ebook-meta

ebook-meta supports reading and writing of most e-book file metadata. File formats that support reading metadata include: azw, azw1, azw3, azw4, cbr, cbz, chm, docx, epub, fb2, html, htmlz, imp, lit, lrf, lrx, mobi, odt, oebzip, opf, pdb, pdf, pml, pmlz, pobi, prc, rar, rb, rtf, snb, tpz, txt, txtz, updb, zip. File formats that support writing metadata include: azw, azw1, azw3, azw4, docx, epub, fb2, htmlz, lrf, mobi, pdb, pdf, prc, rtf, tpz, txtz. Different file formats have different metadata types. If you want to write metadata that a file type does not support, this command silently ignores the specified metadata. It should also be noted that in any case, as long as the parameters (such as path, characters) contain spaces, they must be wrapped in single or double quotes.

Step 1 - Read eBook metadata

ebook-meta sample.azw3

The instruction to read the e-book metadata is simple, just add the path of the e-book file after the ebook-meta command (if the current path of the command and the e-book file are in the same path, a relative path can be used), run After success, you can see the following metadata information:

        Title           : ebook title
        Author(s)       : somebody
        Pulisher        : some publisher
        Languages       : English
        Published       : 2009-07-30T16:00:00+00:00
        Identifiers     : mobi-asin:XXXXXXXXXX        

Netizens share some e-book files on the Internet, and ca n’t judge from the format whether they are from the Amazon Kindle store. For example, Amazon ’s official e-book format is azw3, but Calibre can also convert e-books to azw3 format. It can be reviewed from the metadata. Because the e-book metadata provided by Amazon does not contain the word “Calibre”, once the word “Calibre” appears in the metadata, it means that the book has been modified by at least Calibre. This modified e-book may be different from the original typesetting. What’s more, the content of the e-book’s body may be inserted into the advertising information by the e-book resource profiters, affecting the reading experience.

Step 2 - Write eBook metadata

ebook-meta –title “Jobs” sample.azw3

There are more options for writing metadata instructions than reading e-book metadata. The meaning of this instruction, as shown above, is to change the title of sample.azw3, the e-book metadata, to “Jobs.” Unlike the read command, this command adds an option between the ebook-meta and the e-book file path to modify the e-book title –title followed by a parameter specifying the book name. Of course, in addition to modifying the title, there are other options available, such as author, publisher, category, label, etc. To learn more about the use of these options, just enter ebook-meta and press Enter to appear. The companion lists the available options as follows:

[Options]
  1. –title or -t —— Set the title.
  2. –title-sort —— The version value used to sort the titles. If this parameter is not specified and the title field is not empty, the key string will be automatically generated by the title field.
  3. –authors or -a —— Set author. Separate multiple authors with the & character. Author names are written in the following order: Name Last name.
  4. –author-sort —— The key string used to sort authors. If this parameter is not specified and the author field is not empty, the key string will be automatically generated by the author field.
  5. –cover —— Use the specified file as the cover.
  6. –get-cover —— Read the cover picture from the e-book and save it to the specified file (Note: the command must be followed by the path with the specified file name, not the path).
  7. –comments or -c —— Set up a book introduction.
  8. –identifier —— Set the identifier of the book, which can be specified multiple times. For example: –identifier uri: http: //acme.com –identifier isbn: 12345 To remove an identifier, specify a null value, like –identifier isbn :. Note that for EPUB files, identifiers marked as package identifiers cannot be removed.
  9. –isbn —— Set the ISBN of the book.
  10. –publisher or -p —— Set up a book publisher.
  11. –book-producer or -k —— Set up a book maker.
  12. –category —— Set book classification.
  13. –tags —— Set the label of the book. Separate multiple tags with commas.
  14. –series or -s —— Set the series to which the book belongs.
  15. –language or -l —— Set the language of the book.
  16. –date or -d —— Set the publication date.
  17. –index or -i —— Sets the index position of the book in the series.
  18. –rating or -r —— Set the score. The recommendation value is a number between 1 and 5.
  19. –to-opf —— Specify the OPF file name. The metadata is written to the OPF file.
  20. –from-opf —— Reads metadata information from the specified OPF file and writes it to the e-book. If there is other specified metadata on the command line, the metadata read in the OPF file will be overwritten.
  21. –lrf-bookid —— Set the BookID of the LRF file.
  22. –help or -h —— Display the help information of this command (Note: It is equivalent to directly enter the ebook-meta command and press Enter).
  23. –version —— Display the program version number and exit.

These options can be used in the same instruction, in no particular order. For example, if you want to change the author name of an e-book at the same time, you can add two options at the same time: ebook-meta -t “Book name” -a “Author name” sample.azw3. In addition, the metadata applicable to different file formats are not the same. If the metadata you are trying to set does not take effect on a file format, it may mean that the file format does not support such metadata. Silently ignore.

2 thoughts on “Calibre commonly used command line tools: ebook-meta”

Leave a Comment