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 zimPath;
|
||||||
string zimPathToSave = ".";
|
string zimPathToSave = ".";
|
||||||
string indexPath;
|
string indexPath;
|
||||||
kiwix::supportedIndexType indexBackend = kiwix::XAPIAN;
|
|
||||||
string url;
|
string url;
|
||||||
string origID = "";
|
string origID = "";
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
@ -100,11 +99,10 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath,
|
|||||||
= {{"url", required_argument, 0, 'u'},
|
= {{"url", required_argument, 0, 'u'},
|
||||||
{"origId", required_argument, 0, 'o'},
|
{"origId", required_argument, 0, 'o'},
|
||||||
{"indexPath", required_argument, 0, 'i'},
|
{"indexPath", required_argument, 0, 'i'},
|
||||||
{"indexBackend", required_argument, 0, 'b'},
|
|
||||||
{"zimPathToSave", required_argument, 0, 'z'},
|
{"zimPathToSave", required_argument, 0, 'z'},
|
||||||
{0, 0, 0, 0}};
|
{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) {
|
if (c != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@ -120,14 +118,6 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath,
|
|||||||
indexPath = optarg;
|
indexPath = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
|
||||||
if (!strcmp(optarg, "xapian")) {
|
|
||||||
indexBackend = kiwix::XAPIAN;
|
|
||||||
} else {
|
|
||||||
usage();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'z':
|
case 'z':
|
||||||
zimPathToSave = optarg;
|
zimPathToSave = optarg;
|
||||||
break;
|
break;
|
||||||
@ -144,8 +134,12 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath,
|
|||||||
zimPath, zimPathToSave, url, false);
|
zimPath, zimPathToSave, url, false);
|
||||||
if (!bookId.empty()) {
|
if (!bookId.empty()) {
|
||||||
/* Save the index infos if necessary */
|
/* Save the index infos if necessary */
|
||||||
if (!indexPath.empty())
|
if (!indexPath.empty()) {
|
||||||
manager.setBookIndex(bookId, indexPath, indexBackend);
|
if (isRelativePath(indexPath)) {
|
||||||
|
indexPath = computeAbsolutePath(indexPath, getCurrentDirectory());
|
||||||
|
}
|
||||||
|
library->getBookById(bookId).setIndexPath(indexPath);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cerr << "Unable to build or save library file '" << libraryPath << "'"
|
cerr << "Unable to build or save library file '" << libraryPath << "'"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user