mirror of https://github.com/kiwix/libkiwix.git
Convert the standard opds date to our format (YYYY-MM-DD)
This commit is contained in:
parent
0f812c6584
commit
e6d7ba06fb
10
src/book.cpp
10
src/book.cpp
|
@ -131,6 +131,14 @@ void Book::updateFromXml(const pugi::xml_node& node, const std::string& baseDir)
|
|||
#undef ATTR
|
||||
|
||||
|
||||
static std::string fromOpdsDate(const std::string& date)
|
||||
{
|
||||
//The opds date use the standard <YYYY>-<MM>-<DD>T<HH>:<mm>:<SS>Z
|
||||
//and we want <YYYY>-<MM>-<DD>. That's easy, let's take the first 10 char
|
||||
return date.substr(0, 10);
|
||||
}
|
||||
|
||||
|
||||
#define VALUE(name) node.child(name).child_value()
|
||||
void Book::updateFromOpds(const pugi::xml_node& node, const std::string& urlHost)
|
||||
{
|
||||
|
@ -141,7 +149,7 @@ void Book::updateFromOpds(const pugi::xml_node& node, const std::string& urlHost
|
|||
m_title = VALUE("title");
|
||||
m_description = VALUE("description");
|
||||
m_language = VALUE("language");
|
||||
m_date = VALUE("updated");
|
||||
m_date = fromOpdsDate(VALUE("updated"));
|
||||
m_creator = node.child("author").child("name").child_value();
|
||||
for(auto linkNode = node.child("link"); linkNode;
|
||||
linkNode = linkNode.next_sibling("link")) {
|
||||
|
|
Loading…
Reference in New Issue