import urllib.request
import os

base_url = "https://shivasakthi.ca/"
static_dir = "/mnt/extra-addons/dine360_theme_shivasakthi/static/src/img"

assets_to_download = {
    "assets/images/home/category/dosa.webp": "assets/images/home/category/dosa.webp",
    "assets/images/home/category/idly.webp": "assets/images/home/category/idly.webp",
    "assets/images/home/category/uthappam.webp": "assets/images/home/category/uthappam.webp",
    "assets/images/home/category/beverages.webp": "assets/images/home/category/beverages.webp"
}

for remote, local in assets_to_download.items():
    url = base_url + remote
    local_path = os.path.join(static_dir, local)
    os.makedirs(os.path.dirname(local_path), exist_ok=True)
    print(f"Downloading {url} to {local_path}...")
    try:
        urllib.request.urlretrieve(url, local_path)
        print("Success!")
    except Exception as e:
        print(f"Failed: {e}")
