|
|
@@ -1,6 +1,7 @@ |
|
|
|
#!/usr/bin/env python3 |
|
|
|
|
|
|
|
import os |
|
|
|
import shutil |
|
|
|
|
|
|
|
from jinja2 import Environment, PackageLoader, select_autoescape |
|
|
|
|
|
|
@@ -17,12 +18,19 @@ def list_galleries_in(path): |
|
|
|
|
|
|
|
def generate_output_dir(): |
|
|
|
output_path = os.path.join(os.curdir, OUTPUT_DIR_NAME) |
|
|
|
shutil.rmtree(output_path) |
|
|
|
if not os.path.isdir(output_path): |
|
|
|
os.mkdir(output_path) |
|
|
|
return output_path |
|
|
|
|
|
|
|
|
|
|
|
def generate_index(galleries, output_path): |
|
|
|
def generate_style(output_path): |
|
|
|
style_path = os.path.join(os.curdir, THEME, "style") |
|
|
|
style_output_path = os.path.join(output_path, "style") |
|
|
|
shutil.copytree(style_path, style_output_path) |
|
|
|
|
|
|
|
|
|
|
|
def generate_index(output_path, galleries): |
|
|
|
index_path = os.path.join(output_path, "index.html") |
|
|
|
|
|
|
|
theme_path = os.path.join(os.curdir, THEME) |
|
|
@@ -41,7 +49,8 @@ def main(): |
|
|
|
|
|
|
|
if len(galleries) > 0: |
|
|
|
output_path = generate_output_dir() |
|
|
|
generate_index(galleries, output_path) |
|
|
|
generate_style(output_path) |
|
|
|
generate_index(output_path, galleries) |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |