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

Upgrade + pin all dependencies #44

Merged
merged 5 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## Fixed
- Fix issue with ePub rendering which was outside the iframe

### Changed

- Using zimscraperlib 2.1
- Using zimscraperlib 3.1.0
- Updated image to `python:3.11-bullseye`
- Retrying video reencoding up to three times
- Retry video reencoding up to three times
- Move inline javascript to dedicated files
- Move huge inline CSS to dedicated file
- Add `--node-ids` CLI parameter to process only few nodes (useful for debugging)

## [1.0.1] - 2023-02-22

Expand Down
34 changes: 22 additions & 12 deletions kolibri2zim/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,9 @@ def run(self):
f" tags: {';'.join(self.tags)}"
)

logger.info("Retrieving favicon")
self.retrieve_favicon()

logger.info("Setup Zim Creator")
self.output_dir.mkdir(parents=True, exist_ok=True)

Expand All @@ -764,15 +767,18 @@ def run(self):
filename=self.output_dir.joinpath(self.fname),
main_path=self.root_id,
ignore_duplicates=True,
language="eng",
title=self.title,
description=self.description,
creator=self.author,
publisher=self.publisher,
name=self.name,
tags=";".join(self.tags),
date=datetime.date.today().strftime("%Y-%d-%m"),
).start()
)
self.creator.config_metadata(
Name=self.name,
Language="eng",
Title=self.title,
Description=self.description,
Creator=self.author,
Publisher=self.publisher,
Date=datetime.date.today().strftime("%Y-%d-%m"),
Illustration_48x48_at_1=self.favicon_fpath.read_bytes(),
)
self.creator.start()

succeeded = False
try:
Expand Down Expand Up @@ -901,7 +907,7 @@ def sanitize_inputs(self):

self.tags = list(set(self.tags + ["_category:other", "kolibri", "_videos:yes"]))

def add_favicon(self):
def retrieve_favicon(self):
favicon_orig = self.build_dir / "favicon"
# if user provided a custom favicon, retrieve that
if self.favicon:
Expand Down Expand Up @@ -944,8 +950,12 @@ def add_favicon(self):
favicon_ico_path = favicon_fpath.with_suffix(".ico")
create_favicon(src=favicon_fpath, dst=favicon_ico_path)

self.creator.add_item_for("favicon.png", fpath=favicon_fpath)
self.creator.add_item_for("favicon.ico", fpath=favicon_ico_path)
self.favicon_fpath = favicon_fpath
self.favicon_ico_path = favicon_ico_path

def add_favicon(self):
self.creator.add_item_for("favicon.png", fpath=self.favicon_fpath)
self.creator.add_item_for("favicon.ico", fpath=self.favicon_ico_path)

def add_custom_about_and_css(self):
channel_meta = self.db.get_channel_metadata(self.channel_id)
Expand Down
11 changes: 6 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
zimscraperlib>=2.1.0,<2.2
kiwixstorage>=0.8.3,<0.9
jinja2>=3.1.2<3.2
## Direct dependencies
zimscraperlib==3.1.0
kiwixstorage==0.8.3
Jinja2==3.1.2
pif==0.8.2
beautifulsoup4>=4.9.0,<5.0
retrying>=1.3.4,<1.4
beautifulsoup4==4.9.3
retrying==1.3.4