Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[zimwriterfs] Use the correct method to add the illustration to zim file. #356

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/zimwriterfs/zimwriterfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ bool checkMetadata(const zim::Metadata& metadata)
void addMetadata(ZimCreatorFS& zimCreator, const zim::Metadata& metadata)
{
for ( const auto& kv : metadata ) {
zimCreator.addMetadata(kv.first, kv.second);
if (kv.first == "Illustration_48x48@1") {
zimCreator.addIllustration(48, kv.second);
} else {
Comment on lines +126 to +128
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will take slightly more effort, but while we are at it, why not fix this issue for all illustrations of the NxN@1 kind?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well.. it is two different issues :)

Supporting NxN@1 is not just parse the "Illustration_NxN@1" string. This string is already fixed and is added by https://github.com/openzim/zim-tools/blob/main/src/zimwriterfs/zimwriterfs.cpp#L100-L103

We will have to extend the zimwriterfs options to allow user to pass other illustration other than 48x48 first (and if we do this, probably not pass through the Metadata class (or extend it to store the size as plain value)).

I not really sure we should do this in this PR which "simply" set the correct mimetype for illustration.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hack creates a situation where the same bug is likely to be reintroduced for illustrations with dimensions different from 48x48 when zimwriterfs is enhanced to support them. One way to track it is to add an action item (with a checkbox) to the corresponding ticket (or create such a ticket if one doesn't yet exist).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no such ticket ATM and given:

  • we don't quite support other sizes (no reader makes use of them at least)
  • we don't use zimwriterfs anymore ourselves for creating ZIM files
    I'd say it's safe to merge as-is.

zimCreator.addMetadata(kv.first, kv.second);
}
}
}

Expand Down
Loading