2424import pathlib
2525import re
2626import weakref
27- from collections .abc import Callable
28- from typing import Any
2927
3028import libzim .writer # pyright: ignore
3129import PIL .Image
3230
33- import zimscraperlib .zim .metadata
3431from zimscraperlib import logger
3532from zimscraperlib .constants import FRONT_ARTICLE_MIMETYPES
3633from zimscraperlib .filesystem import (
@@ -102,8 +99,8 @@ class Creator(libzim.writer.Creator):
10299 Use workaround_nocancel=False to disable the workaround.
103100
104101 By default, all metadata are validated for compliance with openZIM specification and
105- conventions. Set check_metadata_conventions=True to disable this validation (you can
106- still do checks manually with the validation methods or your own logic).
102+ conventions. Set metdata.APPLY_RECOMMENDATIONS to False to disable this validation
103+ # (you canstill do checks manually with the validation methods or your own logic).
107104 """
108105
109106 def __init__ (
@@ -114,7 +111,6 @@ def __init__(
114111 * ,
115112 workaround_nocancel : bool | None = True ,
116113 ignore_duplicates : bool | None = False ,
117- check_metadata_conventions : bool = True ,
118114 ):
119115 super ().__init__ (filename = filename )
120116 self ._metadata : dict [str , Metadata ] = {}
@@ -132,9 +128,6 @@ def __init__(
132128
133129 self .workaround_nocancel = workaround_nocancel
134130 self .ignore_duplicates = ignore_duplicates
135- zimscraperlib .zim .metadata .check_metadata_conventions = (
136- check_metadata_conventions
137- )
138131
139132 def config_indexing (
140133 self , indexing : bool , language : str | None = None # noqa: FBT001
@@ -211,7 +204,7 @@ def _get_first_language_metadata_value(self) -> str | None:
211204 """Private methods to get most popular lang code from Language metadata"""
212205 for metadata in self ._metadata .values ():
213206 if isinstance (metadata , LanguageMetadata ):
214- return metadata .libzim_value . decode (). split ( "," ) [0 ]
207+ return metadata .value [0 ]
215208 return None
216209
217210 def start (self ):
@@ -244,26 +237,22 @@ def start(self):
244237
245238 for metadata in self ._metadata .values ():
246239 if isinstance (metadata , IllustrationMetadata ):
247- self .add_illustration (metadata .size , metadata .libzim_value )
240+ self .add_illustration (metadata .illustration_size , metadata .libzim_value )
248241 else :
249242 self .add_metadata (metadata )
250243 self ._metadata .clear ()
251244
252245 return self
253246
254- def add_metadata (
255- self ,
256- value : Metadata ,
257- mimetype : str = "text/plain;charset=UTF-8" ,
258- ):
247+ def add_metadata (self , value : Metadata ):
259248 """Really add the metadata to the ZIM, after ZIM creation has started.
260249
261250 You would probably prefer to use config_metadata methods to check metadata
262251 before starting the ZIM, ensure all mandatory metadata are set, and avoid
263252 duplicate metadata name.
264253 """
265254
266- super ().add_metadata (value .name , value .libzim_value , mimetype )
255+ super ().add_metadata (value .name , value .libzim_value , value . mimetype )
267256
268257 def config_metadata (
269258 self ,
0 commit comments