diff --git a/crengine/include/lvdocview.h b/crengine/include/lvdocview.h index 4253becd5..fa2b7363e 100644 --- a/crengine/include/lvdocview.h +++ b/crengine/include/lvdocview.h @@ -768,6 +768,8 @@ class LVDocView : public CacheLoadingCallback lString32 getDescription() { return m_doc_props->getStringDef(DOC_PROP_DESCRIPTION); } /// returns book keywords (separated by "; ") lString32 getKeywords() { return m_doc_props->getStringDef(DOC_PROP_KEYWORDS); } + /// returns book identifiers (scheme:identifier separated by "\n") + lString32 getIdentifiers() { return m_doc_props->getStringDef(DOC_PROP_IDENTIFIERS); } /// returns book series name and number (series name #1) lString32 getSeries() { diff --git a/crengine/include/lvtinydom.h b/crengine/include/lvtinydom.h index 251fd0bd4..6b7997680 100644 --- a/crengine/include/lvtinydom.h +++ b/crengine/include/lvtinydom.h @@ -94,6 +94,7 @@ extern const int gDOMVersionCurrent; #define DOC_PROP_LANGUAGE "doc.language" #define DOC_PROP_DESCRIPTION "doc.description" #define DOC_PROP_KEYWORDS "doc.keywords" +#define DOC_PROP_IDENTIFIERS "doc.identifiers" #define DOC_PROP_SERIES_NAME "doc.series.name" #define DOC_PROP_SERIES_NUMBER "doc.series.number" #define DOC_PROP_ARC_NAME "doc.archive.name" diff --git a/crengine/src/epubfmt.cpp b/crengine/src/epubfmt.cpp index 2e6400856..1b736c22f 100644 --- a/crengine/src/epubfmt.cpp +++ b/crengine/src/epubfmt.cpp @@ -1384,6 +1384,36 @@ bool ImportEpubDocument( LVStreamRef stream, ldomDocument * m_doc, LVDocViewCall m_doc_props->setString(DOC_PROP_KEYWORDS, subjects); CRLog::info("Authors: %s Title: %s", LCSTR(authors), LCSTR(title)); + // Return possibly multiple (identifiers) + // as a single doc_props string with values in a key-value format (scheme:identifier) separated by ; + bool identifiers_set = false; + lString32 identifiers; + // Iterate all package/metadata/identifier + lUInt16 identifier_id = doc->getElementNameIndex(U"identifier"); + for (size_t i=0; igetChildNode(i); + if ( item->getNodeId() != identifier_id ) + continue; + lString32 scheme = item->getAttributeValue(U"scheme"); + lString32 identifier; + // In version 3, scheme is not set but the type is rather included in the text itself + if (scheme.empty()) { + identifier = item->getText().trim(); + } + else { + // In version 2, the scheme is only found as attribute + identifier << scheme << ":" << item->getText().trim(); + } + if (identifiers_set) { + identifiers << "\n" << identifier; + } + else { + identifiers << identifier; + identifiers_set = true; + } + } + m_doc_props->setString(DOC_PROP_IDENTIFIERS, identifiers); + bool hasSeriesMeta = false; bool hasSeriesIdMeta = false; // Iterate all package/metadata/meta