templates
This commit is contained in:
15
main.py
15
main.py
@ -75,7 +75,7 @@ def fetch_list(list_url):
|
||||
# to use this next field to direct the pagination instead of an increment
|
||||
page += 1
|
||||
if not next:
|
||||
more_results = False
|
||||
more_results = False
|
||||
else:
|
||||
more_results = False
|
||||
except:
|
||||
@ -156,7 +156,7 @@ if __name__ == '__main__':
|
||||
# create parser
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='bookshelf-generator',
|
||||
description='generates HTML for a web-page to display a bookshelf using bookwyrm or a csv as input',
|
||||
description='generates HTML for a web-page to display a bookshelf using bookwyrm or a yaml as input',
|
||||
epilog='<3')
|
||||
|
||||
# subparser for building website
|
||||
@ -184,25 +184,22 @@ if __name__ == '__main__':
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.subparser == "bookwyrm-download":
|
||||
|
||||
# subargs = bookwyrm_parser.parse_args()
|
||||
print(args.list_url)
|
||||
print(args.output_dir)
|
||||
|
||||
if not os.path.exists(args.output_dir):
|
||||
os.makedirs(args.output_dir)
|
||||
|
||||
processed_items = process_list(args.list_url)
|
||||
download_images(processed_items, output_dir=args.output_dir)
|
||||
write_yaml(processed_items, output_dir=args.output_dir)
|
||||
|
||||
else:
|
||||
elif args.subparser == "generate-html":
|
||||
yaml_path = args.yaml_path
|
||||
images_dir = args.images_dir
|
||||
output_path = args.output_path
|
||||
template_vars = load_yaml(yaml_path)
|
||||
build_site(output_dir=output_path, images_dir=images_dir, relative_template_path=args.template, template_vars=template_vars)
|
||||
|
||||
else:
|
||||
raise Exception("invalid subcommand. must be either bookwyrm-download or generate-html")
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user