From 61dd14a2f356572d333ea452d085086332451c8a Mon Sep 17 00:00:00 2001 From: kelson42 Date: Tue, 24 Jan 2012 12:36:56 +0000 Subject: [PATCH] NEW: --noCheck option to "add" command in kiwix-manage to avoid any ZIM quality check --- src/manager/kiwix-manage.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/manager/kiwix-manage.cpp b/src/manager/kiwix-manage.cpp index 649478e..fcc9717 100644 --- a/src/manager/kiwix-manage.cpp +++ b/src/manager/kiwix-manage.cpp @@ -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()) {