mirror of https://github.com/kiwix/libkiwix.git
+ last imp. of the content manager
This commit is contained in:
parent
35b4a1402f
commit
804889d5dc
|
@ -36,7 +36,8 @@ namespace kiwix {
|
|||
url(""),
|
||||
articleCount(""),
|
||||
mediaCount(""),
|
||||
readOnly(false) {
|
||||
readOnly(false),
|
||||
size("") {
|
||||
}
|
||||
|
||||
/* Destructor */
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define KIWIX_LIBRARY_VERSION "20110503"
|
||||
#define KIWIX_LIBRARY_VERSION "20110512"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -55,6 +55,7 @@ namespace kiwix {
|
|||
string articleCount;
|
||||
string mediaCount;
|
||||
bool readOnly;
|
||||
string size;
|
||||
};
|
||||
|
||||
class Library {
|
||||
|
|
|
@ -57,6 +57,7 @@ namespace kiwix {
|
|||
book.url = bookNode.attribute("url").value();
|
||||
book.articleCount = bookNode.attribute("articleCount").value();
|
||||
book.mediaCount = bookNode.attribute("mediaCount").value();
|
||||
book.size = bookNode.attribute("size").value();
|
||||
|
||||
/* Update the book properties with the new importer */
|
||||
if (libraryVersion.empty() || atoi(libraryVersion.c_str()) < atoi(KIWIX_LIBRARY_VERSION)) {
|
||||
|
@ -135,6 +136,8 @@ namespace kiwix {
|
|||
if (itr->mediaCount != "")
|
||||
bookNode.append_attribute("mediaCount") = itr->mediaCount.c_str();
|
||||
|
||||
if (itr->size != "")
|
||||
bookNode.append_attribute("size") = itr->size.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,6 +187,14 @@ namespace kiwix {
|
|||
std::ostringstream mediaCountStream;
|
||||
mediaCountStream << reader.getMediaCount();
|
||||
book.mediaCount = mediaCountStream.str();
|
||||
|
||||
struct stat filestatus;
|
||||
stat( path.c_str(), &filestatus );
|
||||
unsigned int size = filestatus.st_size / 1024;
|
||||
char csize[42];
|
||||
sprintf (csize, "%u", size);
|
||||
book.size = csize;
|
||||
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -20,12 +20,17 @@
|
|||
#ifndef KIWIX_MANAGER_H
|
||||
#define KIWIX_MANAGER_H
|
||||
|
||||
#include <kiwix/library.h>
|
||||
#include <kiwix/reader.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <kiwix/library.h>
|
||||
#include <kiwix/reader.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
Loading…
Reference in New Issue