NEW: --noCheck option to "add" command in kiwix-manage to avoid any ZIM quality check

This commit is contained in:
kelson42 2012-01-24 12:36:56 +00:00
parent 475f7875df
commit 61dd14a2f3

View File

@ -48,7 +48,7 @@ void show(kiwix::Library library) {
void usage() {
cerr << "Usage:" << endl;
cerr << "\tkiwix-manage LIBRARY_PATH add ZIM_PATH [--zimPathToSave=../content/foobar.zim] [--current|-c] [--indexBackend|-b=xapian|clucene] [--indexPath|-i=FULLTEXT_IDX_PATH] [url|u=http://...metalink]" << endl;
cerr << "\tkiwix-manage LIBRARY_PATH add ZIM_PATH [--zimPathToSave=../content/foobar.zim] [--current|-c] [--indexBackend|-b=xapian|clucene] [--indexPath|-i=FULLTEXT_IDX_PATH] [--noCheck|n] [url|u=http://...metalink]" << endl;
cerr << "\tkiwix-manage LIBRARY_PATH show [CONTENTID1] [CONTENTID2] ... (show everything if no param.)" << endl;
cerr << "\tkiwix-manage LIBRARY_PATH remove CONTENTID1 [CONTENTID2]" << endl;
}
@ -94,7 +94,8 @@ int main(int argc, char **argv) {
kiwix::supportedIndexType indexBackend = kiwix::XAPIAN;
string url;
bool setCurrent = false;
bool noCheck = false;
if (argc>3) {
zimPath = argv[3];
}
@ -109,10 +110,11 @@ int main(int argc, char **argv) {
{"indexBackend", required_argument, 0, 'b'},
{"zimPathToSave", required_argument, 0, 'z'},
{"current", no_argument, 0, 'c'},
{"noCheck", no_argument, 0, 'n'},
{0, 0, 0, 0}
};
c = getopt_long(argc, argv, "cz:u:i:b:", long_options, &option_index);
c = getopt_long(argc, argv, "ncz:u:i:b:", long_options, &option_index);
if (c != -1) {
@ -125,6 +127,10 @@ int main(int argc, char **argv) {
setCurrent = true;
break;
case 'n':
noCheck = true;
break;
case 'i':
indexPath = optarg;
break;
@ -151,7 +157,7 @@ int main(int argc, char **argv) {
if (zimPath != "") {
zimPathToSave = zimPathToSave == "." ? zimPath : zimPathToSave;
string bookId = libraryManager.addBookFromPathAndGetId(zimPath, zimPathToSave, url, true);
string bookId = libraryManager.addBookFromPathAndGetId(zimPath, zimPathToSave, url, !noCheck);
if (!bookId.empty()) {