better manifest
This commit is contained in:
@@ -11,10 +11,23 @@ IMAGEDIR = os.path.abspath(IMAGEDIR)
|
||||
|
||||
def main():
|
||||
exts = ('.jpg', '.jpeg', '.png', '.webp', '.gif')
|
||||
files = [f for f in sorted(os.listdir(IMAGEDIR)) if f.lower().endswith(exts)]
|
||||
|
||||
files = [
|
||||
f for f in os.listdir(IMAGEDIR)
|
||||
if f.lower().endswith(exts)
|
||||
]
|
||||
|
||||
# Newest images first
|
||||
files.sort(
|
||||
key=lambda f: os.path.getctime(os.path.join(IMAGEDIR, f)),
|
||||
reverse=True
|
||||
)
|
||||
|
||||
out = os.path.join(IMAGEDIR, 'manifest.json')
|
||||
|
||||
with open(out, 'w', encoding='utf-8') as fh:
|
||||
json.dump(files, fh, indent=2)
|
||||
|
||||
print(f'Wrote {len(files)} entries to {out}')
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user