Commit 250d8661 authored by thiolliere's avatar thiolliere
Browse files

print catalog instead of creating files

parent be8b192e
import wget
import pretty_print
import os
import urllib.request
catalog_dir = "catalog"
catalog_url_path = "http://catalog.ideascube.org"
catalog_url_path = "http://catalog.ideascube.org/"
catalog_files = [
"kiwix.yml",
......@@ -12,14 +12,9 @@ catalog_files = [
"bibliotecamovil.yml",
]
def make():
pretty_print.step("build zim catalog")
if os.path.isdir(catalog_dir):
pretty_print.std("nothing to do")
return
os.mkdir(catalog_dir)
for catalog in catalog_files:
wget.download("{}/{}".format(catalog_url_path, catalog), out="{}/{}".format(catalog_dir, catalog), bar=pretty_print.wget_bar)
pretty_print.newline()
def get_catalog():
catalog = ""
for catalog_file in catalog_files:
with urllib.request.urlopen(catalog_url_path + catalog_file) as f:
catalog += f.read().decode("utf-8")
return catalog
......@@ -15,7 +15,7 @@ parser.add_argument('-w', "--wifi-pwd", help="wifi password (Open)")
parser.add_argument('-k', "--kalite", help="install kalite (fr | en | ar | es)", choices=["fr", "en", "ar", "er"], nargs="*")
parser.add_argument('-z', "--zim-install", help="install zim", nargs="*")
parser.add_argument('-r', "--resize", help="resize image in GiB", type=float)
parser.add_argument('-c', "--catalog", help="build zim catalog and exit", action="store_true")
parser.add_argument('-c', "--catalog", help="print zim catalog", action="store_true")
parser.add_argument('-s', "--sd", help="sd card device to put the image onto")
parser.add_argument('-q', "--quiet", help="more quiet", action="store_true")
......@@ -28,7 +28,7 @@ os.makedirs("build", exist_ok=True)
os.chdir("build")
if args.catalog:
catalog.make()
print(catalog.get_catalog())
exit(0)
vexpress_boot.make()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment