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

Add getzim.sh script #40

Merged
merged 10 commits into from
Oct 10, 2019
Merged

Add getzim.sh script #40

merged 10 commits into from
Oct 10, 2019

Conversation

mkg20001
Copy link
Contributor

The script allows the user to pick a source and download it from cli without having to visit http://wiki.kiwix.org/wiki/Content_in_all_languages
It also automatically resumes the download and verifies the md5sum

@momack2 momack2 requested a review from lidel September 10, 2019 02:46
@momack2
Copy link
Contributor

momack2 commented Sep 10, 2019

Seems related to #58?

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @mkg20001!

Quick feedback:

getzim.sh Outdated

if [ ! -e ".content" ]; then
echo "Downloading content list..."
curl -s http://wiki.kiwix.org/wiki/Content_in_all_languages > .content
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did not work for me unless I enabled following redirect to HTTPS:

Suggested change
curl -s http://wiki.kiwix.org/wiki/Content_in_all_languages > .content
curl -sL http://wiki.kiwix.org/wiki/Content_in_all_languages > .content

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just better use the https version https://wiki.kiwix.org/wiki/Content_in_all_languages

@mkg20001
Copy link
Contributor Author

I've changed the script to work with the download.kiwix.org site directly

There's a command bash getzim.sh choose that allows to create a download command

One of these for example is bash getzim.sh download other archlinux en all notag any which downloads the english archlinux zim

Note that currently SHA256 validation is broken and needs to be fixed

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkg20001 Apologies for missing notification on this! I did a test run with bash getzim.sh download wikipedia wikipedia tr all maxi any and download worked as expected 👍

Let me know if you have time to make two changes before we merge this:

  1. Rename any to latest (I believe you already sort to ensure it returns latest entry, so it is a better name anyway)
  2. Add url command to print the URL behind latest without downloading it, something like:
    $ bash getzim.sh url wikipedia wikipedia tr all maxi latest
    https://download.kiwix.org/zim/wikipedia/wikipedia_tr_all_maxi_2019-10.zim
    The idea is to use this in automation (Automate snapshot updates #58) to tell if latest newer than the last successful snapshot build.

@mkg20001
Copy link
Contributor Author

mkg20001 commented Oct 8, 2019

The url command did already exist (download_url), but now I've aliased it to url as well and documented it

Any is now latest

@mkg20001
Copy link
Contributor Author

mkg20001 commented Oct 8, 2019

Now the url command also returns json and prints the log to stderr

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
Works as expected, can be refined later if needed, let's merge this.

@mkg20001 are you able to apply below fix? (i can't commit to your repo)

getzim.sh Show resolved Hide resolved
Co-Authored-By: Marcin Rataj <[email protected]>
@mkg20001
Copy link
Contributor Author

mkg20001 commented Oct 9, 2019

The cache being filled without cache_update was sorta a unintended feature, but I think we can just make this a proper feature

@lidel
Copy link
Member

lidel commented Oct 9, 2019

@mkg20001 is there anything you want to add, or ok to merge? (can be a separate PR)

@mkg20001
Copy link
Contributor Author

mkg20001 commented Oct 9, 2019

Not really. Don't fix it, if it ain't broken :P

@lidel lidel changed the title Add getzim script Add getzim.sh script Oct 10, 2019
@lidel lidel merged commit 2106f78 into ipfs:master Oct 10, 2019
@lidel
Copy link
Member

lidel commented Oct 10, 2019

Thanks again!

@mkg20001 mkg20001 deleted the getzim branch October 10, 2019 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants