Closed rgaudin closed 1 year ago
Due to the use of pascalize in add_metadata, it is not possible to set any metadata with a name that does not obey this convention.
pascalize
add_metadata
Given the spec doesn't mention any such requirement, and given libzim itself doesn't mangle with metadata names, I propose to simply remove it.
https://github.com/openzim/python-libzim/blob/12f82b4ec836b502311353ed25bfab687f571d4c/libzim/libzim.pyx#L550-L554
from libzim.writer import Creator with Creator("test-pacalize.zim") as creator: creator.add_metadata("description", "HOP HOP") creator.add_metadata("LongDescription", "HOP HOP HOP") from libzim.reader import Archive zim = Archive("test-pacalize.zim") zim.get_metadata("Description") # b'HOP HOP' zim.get_metadata("LongDescription") --------------------------------------------------------------------------- # RuntimeError: Cannot find metadata zim.get_metadata("Longdescription") # b'HOP HOP HOP'
To be more precise, it is possible to set it by using add_metadata("long_description") but it forces user to use a specific format for no valid reason
add_metadata("long_description")
Due to the use of
pascalize
inadd_metadata
, it is not possible to set any metadata with a name that does not obey this convention.Given the spec doesn't mention any such requirement, and given libzim itself doesn't mangle with metadata names, I propose to simply remove it.
https://github.com/openzim/python-libzim/blob/12f82b4ec836b502311353ed25bfab687f571d4c/libzim/libzim.pyx#L550-L554