|
|
@@ -40,7 +40,13 @@ def list_photos_in(gallery_dir): |
|
|
|
] |
|
|
|
for photo_file in photo_files: |
|
|
|
url = os.path.join(gallery_dir.name, photo_file.name) |
|
|
|
photo = {"name": photo_file.name, "url": url} |
|
|
|
thumb_url = os.path.join(gallery_dir.name, f"thumb_{photo_file.name}") |
|
|
|
photo = { |
|
|
|
"name": photo_file.name, |
|
|
|
"path": photo_file.path, |
|
|
|
"url": url, |
|
|
|
"thumb_url": thumb_url, |
|
|
|
} |
|
|
|
yield photo |
|
|
|
|
|
|
|
|
|
|
@@ -97,7 +103,13 @@ def generate_gallery_dir(output_path, gallery): |
|
|
|
gallery_output_path = os.path.join(output_path, gallery["name"]) |
|
|
|
if os.path.isdir(gallery_output_path): |
|
|
|
os.mkdir(gallery_output_path) |
|
|
|
shutil.copytree(gallery["path"], gallery_output_path) |
|
|
|
|
|
|
|
for photo in gallery["photos"]: |
|
|
|
photo_output_path = os.path.join(output_path, photo["url"]) |
|
|
|
shutil.copyfile(photo["path"], photo_output_path) |
|
|
|
|
|
|
|
thumb_output_path = os.path.join(output_path, photo["thumb_url"]) |
|
|
|
shutil.copyfile(photo["path"], thumb_output_path) |
|
|
|
|
|
|
|
|
|
|
|
def main(): |