Skip to content

Commit

Permalink
Merge pull request #419 from openzim/fix_zimrecreate
Browse files Browse the repository at this point in the history
Do not try to add twice Illustration.
  • Loading branch information
kelson42 authored Jul 8, 2024
2 parents 1b2e64c + 2d1bc89 commit 32c9cde
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/zimrecreate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ void create(const std::string& originFilename, const std::string& outFilename, b
} catch(...) {}

for(auto& metakey:origin.getMetadataKeys()) {
if (metakey == "Counter" ) {
if (metakey == "Counter" || metakey.find("Illustration_") == 0) {
// Counter is already added by libzim
// Illustration is already handled by `addIllustration`
continue;
}
auto metadata = origin.getMetadata(metakey);
Expand Down Expand Up @@ -176,7 +177,11 @@ void usage()
"\nOptions:\n"
"\t-v, --version print software version\n"
"\t-j, --withoutFTIndex don't create and add a fulltext index of the content to the ZIM\n"
"\t-J, --threads <number> count of threads to utilize (default: 4)\n";
"\t-J, --threads <number> count of threads to utilize (default: 4)\n"
"\nReturn value:\n"
"- 0 if no error\n"
"- -1 if arguments are not valid\n"
"- -2 if zim creation fails\n";
return;
}

Expand All @@ -187,7 +192,6 @@ int main(int argc, char* argv[])

//Parsing arguments
//There will be only two arguments, so no detailed parsing is required.
std::cout << "zimrecreate" << std::endl;;
for(int i=0;i<argc;i++)
{
if(std::string(argv[i])=="-H" ||
Expand Down Expand Up @@ -248,5 +252,7 @@ int main(int argc, char* argv[])
catch (const std::exception& e)
{
std::cerr << e.what() << std::endl;
return -2;
}
return 0;
}

0 comments on commit 32c9cde

Please sign in to comment.