Skip to content

Commit

Permalink
Allow to add a ZIM scraper suffix via CLI argument
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Jan 31, 2024
1 parent ae18aed commit f963080
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/warc2zim/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.0.0-dev0"
__version__ = "2.0.0-dev1"
4 changes: 3 additions & 1 deletion src/warc2zim/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ def __init__(self, args):

self.written_records = self.total_records = 0

self.scraper_suffix = args.scraper_suffix

def init_env(self):
# autoescape=False to allow injecting html entities from translated text
env = Environment(
Expand Down Expand Up @@ -240,7 +242,7 @@ def run(self):
Illustration_48x48_at_1=self.illustration,
Tags=";".join(self.tags),
Source=self.source,
Scraper=f"warc2zim {get_version()}",
Scraper=f"warc2zim {get_version()}{self.scraper_suffix}",
).start()

for filename in importlib.resources.files("warc2zim.statics").iterdir():
Expand Down
6 changes: 6 additions & 0 deletions src/warc2zim/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ def main(raw_args=None):
default="",
)

parser.add_argument(
"--scraper-suffix",
help="Additional string to append as a suffix to ZIM Scraper metadata, in "
"addition to regular warc2zim value",
)

args = parser.parse_args(args=raw_args)
converter = Converter(args)
return converter.run()
Expand Down

0 comments on commit f963080

Please sign in to comment.