API for the rwp package
CLI subcommand
#71
Replies: 2 comments 4 replies
-
Good, I like the idea of the generic The basic API should be something like these:
I add to the discussion:
|
Beta Was this translation helpful? Give feedback.
-
Relared to packaging, I would suggest either as part of this command (if source is an EPUB) or as a separate This enhances the EPUB ZIP, turning it into a file that is simultaneously an EPUB and a WebPub. The advantage for future consumers of the EPUB is faster parsing, because you can use the manifest.json directly to stream the publication. I have seen multiple ebook stores in the wild post-processing EPUBs to speed up/avoid having to parse using container.xml -> OPF, so why not offer this functionality? Described here as well: https://readium.org/webpub-manifest/packaging.html#6-hybrid-epub-3--rpf-packages |
Beta Was this translation helpful? Give feedback.
-
I'm opening a discussion to talk about a new subcommand for
rwp
to package Readium Web Publications.It started with an initial proposal from @atomotic to add a command to package audiobooks (See the Slack thread):
I like the idea of offering a two-steps generation to allow modifications of the generated manifest, while also having a simpler command that combines the two other. I think we can go further:
-cover
) could be used with theinit
subcommand as well to pre-fill the generated manifest.Subcommands
rwp package init
Generate a Readium Web Publication Manifest for the given publication (directory or an archive (ZIP, RAR, etc.)).
Examples
Parameters and flags
publication
A path to the publication (directory, or an archive (ZIP, RAR, etc.)).-profile epub|audiobook|divina|pdf
Profile and rules for the generated manifest (see https://readium.org/webpub-manifest/profiles/).-output
Customize the output directory where the generated package will be created.What does it do?
publication
argument.publication
is an archive, it is unarchived tooutput
.output
(unlesspublication
=output
).Manifest
object is created using theprofile
for template.profile
isepub
, the manifest is parsed from the OPF using theepub.Parser
APIs.profile
ispdf
, the manifest is parsed from the PDF file using thepdf.Parser
APIs.profile
isaudiobook
ordivina
, a basicManifest
object is created, and all the audio/image files inoutput
are added to thereadingOrder
in alphabetical order.Manifest
object is modified.Manifest
object is serialized tooutput/manifest.json
.rwp package build
Package a Readium Web Publication from a directory containing a manifest.
Examples
Parameters and flags
publication
A path to the publication directory.-output
Customize the output package file.publication
directory.publication
directory, if it is the current directory.What does it do?
publication/manifest.json
file.output
using the right file extension for the profile.Additionally, we could have some verification steps to check that all the files are properly set in the reading order, or that it is valid according to the profile, etc.
rwp package new
Generate and package a new Readium Web Publication for the given publication.
This is basically
package init
+package build
together.Examples
Parameters and flags
publication
A path to the publication (directory, or an archive (ZIP, RAR, etc.)).-profile epub|audiobook|divina|pdf
Profile and rules for the generated manifest (see https://readium.org/webpub-manifest/profiles/).-output
Customize the output directory where the generated package will be created.What does it do?
publication/manifest.json
file.output
using the right file extension for the profile.Additionally, we could have some verification steps to check that all the files are properly set in the reading order, or that it is valid according to the profile, etc.
Metadata flags
Both
package init
andpackage new
can take additional metadata flags to preset (or override) some of the defaults in themanifest.json
. To be more consistent, we should use the same names as in the Metadata manifest object.-title
Set themetadata.title
property.-identifier
Set themetadata.identifier
property. No autogeneration.-cover
Provide an image cover which will be added tolinks
with acover
relation.-author
Add an author contributor. This flag can be added multiple times.@atomotic If we follow-up on some of these ideas, I don't expect you to do everything in your audiobook PR. For example you could only support the
audiobook
profile for these commands. Of course if you want to contribute more, it's always welcome!Beta Was this translation helpful? Give feedback.
All reactions