mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-22 03:12:20 -04:00
[kiwix-manage] Update to last API of kiwix-lib.
`kiwix::Manager` cannot set the book index. We have to modify the book itself. We remove the `backend` option as the only supported xapian was and always was xapian.
This commit is contained in:
parent
640f907fb2
commit
c8be8fbad8
@ -82,7 +82,6 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath,
|
||||
string zimPath;
|
||||
string zimPathToSave = ".";
|
||||
string indexPath;
|
||||
kiwix::supportedIndexType indexBackend = kiwix::XAPIAN;
|
||||
string url;
|
||||
string origID = "";
|
||||
int option_index = 0;
|
||||
@ -100,11 +99,10 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath,
|
||||
= {{"url", required_argument, 0, 'u'},
|
||||
{"origId", required_argument, 0, 'o'},
|
||||
{"indexPath", required_argument, 0, 'i'},
|
||||
{"indexBackend", required_argument, 0, 'b'},
|
||||
{"zimPathToSave", required_argument, 0, 'z'},
|
||||
{0, 0, 0, 0}};
|
||||
|
||||
c = getopt_long(argc, argv, "cz:u:i:b:", long_options, &option_index);
|
||||
c = getopt_long(argc, argv, "cz:u:i:", long_options, &option_index);
|
||||
|
||||
if (c != -1) {
|
||||
switch (c) {
|
||||
@ -120,14 +118,6 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath,
|
||||
indexPath = optarg;
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
if (!strcmp(optarg, "xapian")) {
|
||||
indexBackend = kiwix::XAPIAN;
|
||||
} else {
|
||||
usage();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
zimPathToSave = optarg;
|
||||
break;
|
||||
@ -144,8 +134,12 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath,
|
||||
zimPath, zimPathToSave, url, false);
|
||||
if (!bookId.empty()) {
|
||||
/* Save the index infos if necessary */
|
||||
if (!indexPath.empty())
|
||||
manager.setBookIndex(bookId, indexPath, indexBackend);
|
||||
if (!indexPath.empty()) {
|
||||
if (isRelativePath(indexPath)) {
|
||||
indexPath = computeAbsolutePath(indexPath, getCurrentDirectory());
|
||||
}
|
||||
library->getBookById(bookId).setIndexPath(indexPath);
|
||||
}
|
||||
} else {
|
||||
cerr << "Unable to build or save library file '" << libraryPath << "'"
|
||||
<< endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user