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

support_description_long_description #183

Closed
wants to merge 3 commits into from
Closed
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ celerybeat-schedule

# dotenv
.env
.venv

# virtualenv
venv/
Expand All @@ -91,4 +92,6 @@ openedx2zim/templates/assets/videojs/
openedx2zim/templates/assets/mathjax/
openedx2zim/templates/assets/ogvjs/
openedx2zim/templates/assets/jquery.min.js
openedx2zim/templates/assets/videojs-ogvjs.js
openedx2zim/templates/assets/videojs-ogvjs.js
openedx/openedx2zim.egg-info/
openedx/output/
7 changes: 7 additions & 0 deletions openedx2zim/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ def main():
help="Custom description for your ZIM. Based on MOOC otherwise.",
)

##made changes here
parser.add_argument(
"--long-description",
help="Custom description for your ZIM,optional",
)


parser.add_argument("--creator", help="Name of content creator", default="edX")

parser.add_argument(
Expand Down
21 changes: 16 additions & 5 deletions openedx2zim/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
VideoWebmHigh,
)
from zimscraperlib.zim import make_zim_file

from zimscraperlib.inputs import compute_descriptions
from .annex import MoocForum, MoocWiki
from .constants import (
IMAGE_FORMATS,
Expand Down Expand Up @@ -85,6 +85,8 @@
"unavailable": Unavailable,
}



logger = getLogger()


Expand All @@ -101,6 +103,7 @@ def __init__(
name,
title,
description,
long_description,
creator,
publisher,
tags,
Expand Down Expand Up @@ -135,6 +138,7 @@ def __init__(
self.tags = [] if tags is None else [t.strip() for t in tags.split(",")]
self.title = title
self.description = description
self.long_description = long_description
self.creator = creator
self.publisher = publisher
self.name = name
Expand Down Expand Up @@ -843,10 +847,16 @@ def get_zim_info(self):
else f"{self.course_info['name']} from {self.course_info['org']}"
)

description,long_description = compute_descriptions(
default_description = fallback_description,
description = self.description,
long_description = self.long_description
)


return {
"description": self.description
if self.description
else fallback_description,
"description": description,
"long-description" : long_description,
"title": self.title if self.title else self.course_info["name"],
"creator": self.creator if self.creator else self.course_info["org"],
"homepage": homepage,
Expand Down Expand Up @@ -902,9 +912,10 @@ def run(self):
fpath=self.output_dir.joinpath(self.fname),
name=self.name,
main_page=zim_info["homepage"],
favicon="favicon.png",
illustration="favicon.png",
title=zim_info["title"],
description=zim_info["description"],
long_description= zim_info["long-description"],
language=get_language_details(self.instance_lang)["iso-639-3"],
creator=zim_info["creator"],
publisher=self.publisher,
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Jinja2>=2.11.2,<2.12
mistune>=2.0.0a4,<2.1
requests>=2.24,<3.0
iso-639>=0.4.5,<0.5
zimscraperlib>=1.3.6,<1.4
zimscraperlib==3.2.0
kiwixstorage>=0.3,<1.0
pif>=0.8.2,<0.9
xxhash>=2.0.0,<2.1
Expand All @@ -15,4 +15,4 @@ youtube_dl
# Jinja2 2.11 depends on soft_unicode which has been remove from markupsafe after 2.0.1
# so we pin the version to 2.0.1 ; this HAS to be removed once Jinja2 is update to a more
# recent version
markupsafe==2.0.1
markupsafe==2.0.1