Skip to content

Commit 6561a49

Browse files
committed
Add more arguments to make_zim_file
Add support for `disable_metadata_checks`, `ignore_duplicates` and `compression` arguments in `make_zim_file` function ("zimwritefs-mode")
1 parent b479038 commit 6561a49

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- Add support for `disable_metadata_checks`, `ignore_duplicates` and `compression` arguments in `make_zim_file` function ("zimwritefs-mode")
12+
1013
## [3.3.1] - 2024-02-27
1114

1215
### Added

src/zimscraperlib/zim/filesystem.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ def make_zim_file(
134134
redirects: Sequence[tuple[str, str, str]] = None, # noqa: RUF013 # pyright: ignore
135135
redirects_file: pathlib.Path = None, # noqa: RUF013 # pyright: ignore
136136
rewrite_links: bool = True, # noqa: FBT001, FBT002, ARG001
137-
workaround_nocancel: bool = True, # noqa: FBT001, FBT002
137+
workaround_nocancel: Optional[bool] = True, # noqa: FBT002
138+
compression: Optional[str] = None,
139+
ignore_duplicates: Optional[bool] = False, # noqa: FBT002
140+
disable_metadata_checks: bool = False, # noqa: FBT001, FBT002
138141
):
139142
"""Creates a zimwriterfs-like ZIM file at {fpath} from {build_dir}
140143
@@ -157,7 +160,14 @@ def make_zim_file(
157160
with open(illustration_path, "rb") as fh:
158161
illustration_data = fh.read()
159162

160-
zim_file = Creator(filename=fpath, main_path=main_page).config_metadata(
163+
zim_file = Creator(
164+
filename=fpath,
165+
main_path=main_page,
166+
compression=compression,
167+
workaround_nocancel=workaround_nocancel,
168+
ignore_duplicates=ignore_duplicates,
169+
disable_metadata_checks=disable_metadata_checks,
170+
).config_metadata(
161171
**{
162172
k: v
163173
for k, v in {

0 commit comments

Comments
 (0)