Why you need and how OPDS electronic catalogs work

On GT, we have already talked about the history and principles of the work of the formats of electronic books DjVu , FB2 and his “younger brother” FB3 . Today we decided to talk about the standard that helps these books distribute. Let us tell you why we need OPDS electronic catalogs and how they are “arranged”.


/ Flickr / gael varoquaux / cc

What is OPDS?


OPDS (Open Publication Distribution System) is a syndication format for electronic publishing. Its goal is to provide users of applications and reading devices with the ability to browse and download books from digital libraries.

The project began to develop in April 2009. It was attended by several organizations and companies, including the Internet Archive , Feedbooks, O'Reilly and Lexcycle, which developed electronic reading software. The standard was based on the HTTP ( RFC2616 ) and Atom ( RFC4287 ) technologies .

Atom is a different syndication format based on XML. It allows you to describe sets of web resources: news feeds, announcements of articles in the blog and so on. At its core, it is similar to RSS and solves the same problems, but it does not have some of its shortcomings, in particular, it is better standardized (the relationship between different versions of RSS is rather confusing - they may be incompatible with each other). Today, Atom is supported by Google in many of its projects, for example in Feedburner .

What is “inside” the OPDS directory


OPDS directories borrowed the concept of feeds and entries from the Atom format. In fact, feeds are containers for recordings and are divided into two categories: navigation feeds and download feeds. The first ones define the hierarchy for content search, and the second ones contain lists of records with information about available publications. Each record has metadata: the format of the electronic book, the title, the method of receipt, etc.

Entries in the list are links that either direct the user to another feed or give him the opportunity to download the publication. In Atom, on which OPDS is based, the link is a tag with the rel (relationship) attribute. This relationship indicates the acquisition method and the rules for providing literature. The following options are supported:


The official site of the OPDS project provides the following example of such a link:

<link rel="http://opds-spec.org/acquisition" type="video/mp4v-es" href="/content/free/4561.mp4"/> 

If one publication is available in several formats, then they are represented by a group of links in one post:

 <link rel="http://opds-spec.org/acquisition/borrow" href="/content/borrow/4561.mobi" type="application/x-mobipocket-ebook"/> <link rel="http://opds-spec.org/acquisition/borrow" href="/content/borrow/4561.epub" type="application/epub+zip"/> 

Sometimes the link does not lead to the book directly. This happens if the publication is packed in a zip-archive, where several files are located (for example, the same copies of the book in different formats). The opds: indirectAcquisition element is used to describe the "internals" of such a component, where the type is the media element format:

 <link type="application/zip" rel="http://opds-spec.org/acquisition/open-access" href="/item/1111/buy/"> <opds:indirectAcquisition type="application/epub+zip" /> <opds:indirectAcquisition type="application/pdf" /> <opds:indirectAcquisition type="application/x-mobipocket-ebook" /> </link> 

And here is an example of a link for a situation when the publication is paid. The currencycode attribute defines the currency:

 <link rel="http://opds-spec.org/acquisition/buy" href="/product/song1.mp3" type="audio/mpeg"> <opds:price currencycode="USD">1.99</opds:price> </link> 

Where to find OPDS-directories and how to work with them?


One of the first to start using OPDS is publishers and libraries. Later, readers, e-book readers, and e-booksellers joined the community. Most often they are the creators of OPDS-directories. A list of the most popular directories can be found on the site with the OPDS specification .

For example, there is a Feedbooks, which distributes more than 3 million e-books every month. The Internet Archive collection contains almost 2 million publications, and O'Reilly Media offers thousands of technical literature. You can also highlight the directories of The Pragmatic Programmers and Revues.org .

In general, the network can find a lot of OPDS directories in different languages. At the same time, users have the opportunity to create their own catalog to organize access to their book library from any device. There are even special programs that can help with this. For example, this utility offers FBReader - it is based on the code books.fbreader.org .

Other readers, such as Cool Reader, Bluefire Reader, QuickReader, AlReader and OReader, also support OPDS. The latter is an adaptation of AlReader specifically for ONYX-BOOX readers, which was modified by the creator of the original application. The reader received a single interface menu and a built-in metadata scanner used by the system. Back in OReader, support for the SNOW Field technology was added, which does not work in AlReader. SNOW Field improves the "redrawing" of the page on the screen with electronic ink, reducing the number of artifacts when flipping (and eliminates the frequent "fill" the display with black).

Note that some applications, although they work with OPDS, do not support multimedia content. Different programs and the number of supported formats of electronic literature.

In general, to work with OPDS, you need to connect network libraries of interest. How to do this on ONYX readers can be found in one of the materials on our website. Then you can begin to view the publication, focusing on feeds and lists of records.

Note that the user can find the right books not only using feeds, but also using the search function. OPDS Search is based on the Open Search format. In this case, a separate XML file is created with a description of search parameters - OpenSearch Description. Here is an example of filling such a file from the Open Search repository on GitHub:

 <?xml version="1.0" encoding="UTF-8"?> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> <ShortName>Web Search</ShortName> <Description>Use Example.com to search the Web.</Description> <Tags>example web</Tags> <Contact>admin@example.com</Contact> <Url type="application/rss+xml" template="http://example.com/?q={searchTerms}&pw={startPage?}&format=rss"/> </OpenSearchDescription> 

Usually it is called OpenSearch.xml and it is in the root of the directory.


/ Flickr / Dave Collie / CC

Ecosystem development


To date, several OPDS specifications have been released: these are versions of OPDS Catalog 0.9 (2010), OPDS Catalog 1.0 (2010) and OPDS Catalog 1.1 (2011), which is the last one released to date. However, there is a “draft” of the new version of the standard - 1.2. A functional should appear in it that will allow you to rent books, that is, to issue them for a certain period of time. In addition, new attributes will be added for media content types, elements to indicate the rating and the number of downloads of the book, as well as OPDS profiles for users.

At the same time, the community, represented by e-literature sellers, the OPDS working group and other industry participants, is working on the ODL (Open Distribution Libraries) specification and OPDS authentication mechanisms to make possible the "horizontal" integration of libraries and commercial services that sell books with each other .

The ODL format is already used by distributors of electronic literature for sending information about licenses to libraries ( for example , in Feedbooks). As for the new version of OPDS 1.2, while its specification exists only in the draft format, and the date for the full release of the standard remains unknown.



PS We offer you three reviews of ONYX BOOX readers:

Source: https://habr.com/ru/post/412355/


All Articles