EBOOK(1p) | User Contributed Perl Documentation | EBOOK(1p) |
ebook - create and manipulate e-books from the command line
ebook COMMAND arg1 arg2 --opt1 --opt2
See also "EXAMPLES".
Adds a documents to both the book manifest and spine.
Options
Example
ebook adddoc --opf mybook.opf --id 'text-ch1' chapter1.html
Add an item to the book manifest, but not the spine.
Note that the "fix" command will automatically insert manifest items for any local files referenced by existing manifest items.
Options
Example
ebook additem --opf mybook.opf --id 'illus-ch1' chapter1-illus.jpg
Search for a BISAC code matching a case-insensitive regular expression.
Options
This requires that the BISAC codes be downloaded ahead of time. (See "dlbisac".)
Create a blank e-book structure.
Options
The author of the book. If not specified, defaults to "Unknown Author".
Example
ebook blank newfile.opf --author "Me Myself" --title "New File" ebook blank --opffile newfile.opf --author "Me Myself" --title "New File"
Both of those commands have the same effect.
Make changes to the EBook::Tools configuration file.
The configuration file itself is located as either "$ENV{HOME}/.ebooktools/config.ini" or as "$ENV{USERPROFILE}\Application Data\EBook-Tools", depending on platform and which directory is found first. See "userconfigdir()" in EBook::Tools for details.
Arguments / Subcommands
Configuration is always handled in the format of:
ebook config subcommand value
Replace any existing configuration file with a default template. This creates the file if it does not exist. This should be done once before any other configuration manipulation is done, unless a configuration file has been manually created ahead of time.
Sets the default debugging level when no verbosity is specified. Note that verbosity can only be increased, not decreased, with the "-v" option.
Sets the default safety level when tidy is used. Valid values are from 0-4. See "unpack" for details on what each value means.
A comma-separated list of Mobipocket PIDs to try to use to decrypt e-books. This value is only used if the appropriate plug-in modules or helper applications are available, as DRM is not supported natively by EBook::Tools. Note that if the PID includes a $ character, the entire PID string has to be enclosed in single quotes.
Examples
ebook config default ebook config debug 2 ebook config mobipids '1234567890,2345678$90'
Unpacks the ebook specified as the first argument, runs standard fixes on the contents, and repacks it into a new format in the output file specified as the second argument. Currently the only supported output format is epub, which is the format you will get irrespective of the extension you actually give the output file.
Options
Example
ebook convert MyBook.prc MyBook.epub ebook convert --name MyBook.lit /home/myname/MyBook.epub
Downloads and caches the Book Industry Study Group BISAC codes into a local database. This will destroy the existing contents of that table if this has been done previously.
If the appropriate helpers or plugins are available, write a copy of the input file with the DRM restrictions removed.
NOTE: no actual DRM-removal code is present in this package. This is just presents a unified interface to other programs that have that capability.
Arguments
The first non-option argument is taken to be the input file. If not specified, the program exits with an error.
The second non-option argument is taken to be the output file. If not specified, the program will use a name based on the input file, appending '-nodrm' to the basename and keeping the extension. In the special case of Mobipocket files ending in '-sm', the '-sm' portion of the basename is simply removed, and nothing else is appended.
The third non-option argument is taken to be either the decryption key/PID, or in the case of Microsoft Reader (.lit) files, the "keys.txt" file containing the decryption keys.
If not specified, this will be looked up from the configuration file. Convertlit keyfiles will be looked for in standard locations. If no key is found, the command aborts and exits with an error.
Example
ebook downconvert NewBook.lit NewBook-readable.lit mykeys.txt ebook dc MyBook-sm.prc
Find and fix problems with an e-book, including enforcing a standard specification and ensuring that all linked objects are present in the manifest.
Options
This is not done by default as it can damage unusual but correct names.
Generate a .epub book from existing OPF data.
Options
Example
ebook genepub mybook.opf -o my_special_book.epub -d ../epubbooks
or in the simplest case:
ebook genepub
Generate a eBookwise .imp book from a .RES directory
Options
This can also be specified as the first non-option argument, which will override this option if it exists. If not specified, the current directory will be used.
Examples
ebook genimp MyUnpackedBook.RES MyBook.imp ebook genimp --resdir ../MyUnpackedBook.RES -f imp/MyBook.imp
Generate a Mobipocket .mobi/.prc book from OPF, HTML, or ePub input.
Options
This can also be specified as the second non-option argument, which will override this option if it exists.
Example
ebook genmobi mybook.opf -o my_special_book.prc -d ../mobibooks ebook genmobi mybook.html mybook.prc -c2
or in the simplest case:
ebook genmobi
Given an OPF file, creates a NCX-format table of contents from the package unique-identifier, the dc:title, dc:creator, and spine elements, and then add the NCX entry to the manifest if it is not already referenced.
The OPF file will be cleaned to OPF20 format before this happens.
Options
Set specific metadata values in an ETI .imp file.
Options
Specify the input filename. This can also be specified as the first argument, in which case the -i option will be ignored.
Specify the output filename. If not specified, the input file will be overwritten.
Specify the identifier metadata.
Specify the category metadata.
Specify the subcategory metadata.
Specify the title metadata.
Specify the author last name metadata.
Specify the author middle name metadata.
Specify the author first name metadata. Note that IMP files commonly place the full name in this component, and leave the middlename and lastname entries blank.
Examples
ebook impmeta mybook.imp --title 'Fixed Title' --lastname 'John Q. Brandy' ebook impmeta -i mybook.imp -o fixed.imp --title 'Fixed Title'
Sets the cover image
Takes as a single argument the href of the file to use.
Options
Specifies the OPF file to modify. If not specified, the script will attempt to find one
Specifies the ID to assign to the associated manifest item.
Set specific metadata values on an OPF file, creating a new entry if none exists.
Both the element to set and the value are specified as additional arguments, not as options.
The elements that can be set are currently:
The 'series' values can take an extra argument containing the series index position.
The 'subject' elements can be added multiple times (including in a single command-line, though --id will only set the ID on the first one specified). Other entries will be overwritten.
The element argument can be shortened to the minimum number of letters necessary to uniquely identify it.
Options
Specifies the OPF file to modify. If not specified, the script will attempt to find one in the current directory.
Allows the deletion of subject and series metadata. Has no effect on other elements.
Specifies the 'file-as' attribute when setting an author. Has no effect on other elements.
Specifies the ID to assign to the element.
Examples
ebook setmeta series 'Some Other Series' 03 ebook setmeta title 'My Great Title' ebook setmeta t 'My Great Title' ebook --opf newfile.opf setmeta author 'John Smith' --fileas 'Smith, John' --id mainauthor
Split the <metadata>...</metadata> block out of a pseudo-HTML file that contains one.
Split <pre>...</pre> blocks out of an existing HTML file, wrapping each one found into a separate HTML file.
The first non-option argument is taken to be the input file. The second non-option argument is taken to be the basename of the output files.
Strips <script>...</script> blocks out of a HTML file.
The first non-option argument is taken to be the input file. The second non-option argument is taken to be the output file. If the latter is not specified, the input file will be overwritten.
Options
Strips <noscript>...</noscript> blocks as well.
Run tidy on a HTML file to enforce valid XHTML output (required by the OPF 2.0 specification).
Run tidy an a XML file (for neatness).
Unpacks an ebook into its component parts, creating an OPF for them if necessary.
Options
This setting is DANGEROUS!
Examples
ebook unpack mybook.pdb My_Book --author "By Me" ebook unpack -i mybook.pdb -d My_Book --author "By Me"
Both of the above commands do the same thing
ebook splitmeta book.html mybook.opf ebook tidyxhtml book.html ebook tidyxml mybook.opf ebook fix mybook.opf --oeb12 --mobi ebook genepub ebook blank newbook.opf --title "My Title" --author "My Name" ebook adddoc myfile.html ebook fix newbook.opf --opf20 -v ebook genepub ebook unpack mybook.pdb my_book cd my_book ebook addoc new_document.html ebook fix ebook genepub
Copyright 2008 Zed Pobre
Licensed to the public under the terms of the GNU GPL, version 2.
2019-08-08 | perl v5.28.1 |