- Created `download_categories.py` to download specific category images from a remote server. - Created `download_extra_categories.py` to download additional category images. - Added `find_shapes.py` to extract and print unique shape and category image paths from a markdown file.
25 lines
1.0 KiB
Python
25 lines
1.0 KiB
Python
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/shapes/hero-shape3.png": "assets/images/shapes/hero-shape3.png",
|
|
"assets/images/home/category/hakka.webp": "assets/images/home/category/hakka.webp",
|
|
"assets/images/home/category/veg-biryani.webp": "assets/images/home/category/veg-biryani.webp",
|
|
"assets/images/home/category/veg-curry.webp": "assets/images/home/category/veg-curry.webp",
|
|
"assets/images/home/category/nonveg-biryani.webp": "assets/images/home/category/nonveg-biryani.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}")
|