mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-27 21:39:37 +00:00
Support for multiple illustrations in OPDS entry
This commit is contained in:
@ -52,6 +52,22 @@ namespace
|
||||
|
||||
typedef kainjow::mustache::data MustacheData;
|
||||
typedef kainjow::mustache::list BookData;
|
||||
typedef kainjow::mustache::list IllustrationInfo;
|
||||
|
||||
IllustrationInfo getBookIllustrationInfo(const Book& book)
|
||||
{
|
||||
kainjow::mustache::list illustrations;
|
||||
if ( book.isPathValid() ) {
|
||||
for ( auto illustration_size : zim::Archive(book.getPath()).getIllustrationSizes() ) {
|
||||
illustrations.push_back(kainjow::mustache::object{
|
||||
{"icon_width", to_string(illustration_size)},
|
||||
{"icon_height", to_string(illustration_size)},
|
||||
{"icon_scale", "1"},
|
||||
});
|
||||
}
|
||||
}
|
||||
return illustrations;
|
||||
}
|
||||
|
||||
BookData getBookData(const Library* library, const std::vector<std::string>& bookIds)
|
||||
{
|
||||
@ -78,6 +94,7 @@ BookData getBookData(const Library* library, const std::vector<std::string>& boo
|
||||
{"publisher_name", book.getPublisher()},
|
||||
{"url", bookUrl},
|
||||
{"size", to_string(book.getSize())},
|
||||
{"icons", getBookIllustrationInfo(book)},
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user