Ebook Reader activity is an Epub viewer that allow to browse and read a set of ebooks hosted on a server. A set of ebooks in French and in English coming from Gutenberg Project is provided natively with the activity. But you're able to change settings to point to your own set of ebooks.
Only EPUB 3 files could be read by the Ebook Reader activity. The ePub reader is based on Future press Epub.js v0.3 library.
By default the activity call the library to the URL http://sugarizer.org/content/books.php
and add to the URL a param with the current user Sugarizer ISO 639-1 language code. So for example http://sugarizer.org/content/books.php?lang=fr
if you're in French.
Once read, the library content is set in the Journal so this URL will not be read again for this instance.
A user could change this URL by clicking on the Settings icon of the toolbar. So, because the library content is set in the Journal, you could have in your Journal Ebook reader activity instance with libraries coming from different places.
The result of the URL call should be a JSON object describing the content of the library. Here is an example of this JSON file:
{
"information": {
"name": "contesen",
"fileprefix": "https://sugarizer.org/content/books/en/",
"imageprefix": "https://sugarizer.org/content/books/images/"
},
"database": [
{
"title": "Alice's Adventures in Wonderland",
"author": "Lewis Carroll",
"image": "alice.png",
"file": "Carroll_Alice.epub"
},
{
"title": "The Jungle Book",
"author": "Rudyard Kipling",
"image": "kipling_jungle.png",
"file": "kipling_jungle_book.epub"
},
...
{
"title": "The Second Jungle Book",
"author": "Rudyard Kipling",
"image": "kipling_jungle2.png",
"file": "kipling_second_jungle.epub"
}
]
}
This JSON object is separated in two parts:
Here what means each field in the information
part:
fileprefix + file
should give the full URL of the ebook ePub file,imageprefix + file
should give the full URL of the ebook cover image.Here what means each field of objects in the database
part:
It's important to say that the JSON file for the database is not necessarily static, it could be generated dynamically, for example depending of language.