API for the package CLI subcommand
#2
Replies: 0 comments 6 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.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm opening a discussion to talk about a new subcommand for
rwpto package Readium Web Publications.It started with an initial proposal from @atomotic to add a command to package audiobooks (See the Slack thread):
Generate an empty readium manifest inside an audio directory $ rwp audiobook init -source {audio_directory} Package an audiobook with an already existent manifest $ rwp audiobook package -source {audio_directory} -output {output}.audiobook Generate a new audiobook $ rwp audiobook new -source {audio_directory} \ -output {output}.audiobook \ -id {identifier - autogen uuid/ulid} -cover {cover}.jpg \ -title {title} \ -date {date} \ -creator {creator}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 theinitsubcommand as well to pre-fill the generated manifest.Subcommands
rwp package initGenerate a Readium Web Publication Manifest for the given publication (directory or an archive (ZIP, RAR, etc.)).
Examples
Parameters and flags
publicationA path to the publication (directory, or an archive (ZIP, RAR, etc.)).-profile epub|audiobook|divina|pdfProfile and rules for the generated manifest (see https://readium.org/webpub-manifest/profiles/).-outputCustomize the output directory where the generated package will be created.What does it do?
publicationargument.publicationis an archive, it is unarchived tooutput.output(unlesspublication=output).Manifestobject is created using theprofilefor template.profileisepub, the manifest is parsed from the OPF using theepub.ParserAPIs.profileispdf, the manifest is parsed from the PDF file using thepdf.ParserAPIs.profileisaudiobookordivina, a basicManifestobject is created, and all the audio/image files inoutputare added to thereadingOrderin alphabetical order.Manifestobject is modified.Manifestobject is serialized tooutput/manifest.json.rwp package buildPackage a Readium Web Publication from a directory containing a manifest.
Examples
Parameters and flags
publicationA path to the publication directory.-outputCustomize the output package file.publicationdirectory.publicationdirectory, if it is the current directory.What does it do?
publication/manifest.jsonfile.outputusing 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 newGenerate and package a new Readium Web Publication for the given publication.
This is basically
package init+package buildtogether.Examples
Parameters and flags
publicationA path to the publication (directory, or an archive (ZIP, RAR, etc.)).-profile epub|audiobook|divina|pdfProfile and rules for the generated manifest (see https://readium.org/webpub-manifest/profiles/).-outputCustomize the output directory where the generated package will be created.What does it do?
publication/manifest.jsonfile.outputusing 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 initandpackage newcan 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.-titleSet themetadata.titleproperty.-identifierSet themetadata.identifierproperty. No autogeneration.-coverProvide an image cover which will be added tolinkswith acoverrelation.-authorAdd 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
audiobookprofile for these commands. Of course if you want to contribute more, it's always welcome!Beta Was this translation helpful? Give feedback.
All reactions