|
|
|
|
|
|
|
|
continue |
|
|
continue |
|
|
|
|
|
|
|
|
photos.sort(key=itemgetter("name")) |
|
|
photos.sort(key=itemgetter("name")) |
|
|
|
|
|
cover_index = (len(gallery_dir.name) + 42) % len(photos) |
|
|
gallery = { |
|
|
gallery = { |
|
|
"name": gallery_dir.name, |
|
|
"name": gallery_dir.name, |
|
|
"path": gallery_dir.path, |
|
|
"path": gallery_dir.path, |
|
|
"url": gallery_dir.name, |
|
|
"url": gallery_dir.name, |
|
|
"num_photos": len(photos), |
|
|
"num_photos": len(photos), |
|
|
"photos": photos, |
|
|
"photos": photos, |
|
|
"cover_photo": photos[0], |
|
|
|
|
|
|
|
|
"cover_photo": photos[cover_index], |
|
|
} |
|
|
} |
|
|
yield gallery |
|
|
yield gallery |
|
|
|
|
|
|