This repository has been archived on 2026-05-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
imagerepo/image_import_worker.py
T
2025-07-29 00:34:03 -04:00

21 lines
678 B
Python

# image_import_loop.py
import time
from app import create_app
from app.utils.image_importer import import_images_task
app = create_app()
def looped_import(source_dir='/import', dest_dir='/images', delay_seconds=7200):
with app.app_context():
print("[Image Importer] Starting import task...")
try:
result = import_images_task(source_dir, dest_dir)
print(f"[Image Importer] {result}")
except Exception as e:
print(f"[Image Importer] Error: {e}")
print(f"[Image Importer] Sleeping for {delay_seconds / 3600:.1f} hours...\n")
time.sleep(delay_seconds)
if __name__ == '__main__':
looped_import()