diff --git a/.github/workflows/json.yaml b/.github/workflows/json.yaml index 2edefb9..89b00d4 100644 --- a/.github/workflows/json.yaml +++ b/.github/workflows/json.yaml @@ -30,7 +30,7 @@ jobs: mkdir -p docs mkdir -p docs/scripts mv *.json ./docs - find scripts -type f -name "*.js" -exec cp {} ./docs/scripts \; + python3 utils/copy_js_and_assets.py echo "scripts.drawthings.ai" > ./docs/CNAME - name: Add and commit documentation diff --git a/scripts/creative-upscale/assets/tree-after.jpg b/scripts/creative-upscale/assets/tree-after.jpg new file mode 100644 index 0000000..462f2a6 Binary files /dev/null and b/scripts/creative-upscale/assets/tree-after.jpg differ diff --git a/scripts/creative-upscale/assets/tree-before.jpeg b/scripts/creative-upscale/assets/tree-before.jpeg new file mode 100644 index 0000000..736cdeb Binary files /dev/null and b/scripts/creative-upscale/assets/tree-before.jpeg differ diff --git a/scripts/creative-upscale/metadata.json b/scripts/creative-upscale/metadata.json index 3f35db2..b056a37 100644 --- a/scripts/creative-upscale/metadata.json +++ b/scripts/creative-upscale/metadata.json @@ -5,5 +5,11 @@ "description": "Generate up to 4x upscaled image from the input with crisp details.", "tags": [ "image-to-image" - ] -} \ No newline at end of file + ], + "baseColor": "0x00CC82", + "images": [ + {"url": "https://scripts.drawthings.ai/creative-upscale/assets/tree-after.jpg", "tags":["id:tree", "view:after"] }, + {"url": "https://scripts.drawthings.ai/creative-upscale/assets/tree-before.jpeg", "tags":["id:tree", "view:before"] } + ], + "favicon": "data:image/png;base64,data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABIBAMAAACnw650AAAAG1BMVEUAAAD////////////////////////////////rTT7CAAAACXRSTlMA/rebJRBsRd+IYbvdAAABRklEQVR4nO2VPU/DMBRFrcSwu+VrTEFijifWdGOECUbo0L1C/AAk+N8kvs+p30eijh1yh1TPPT1x4lfbuSXnm9090qH0VD6WzGWgXKN+z3VbQFUevEV9yHVjQX+oX6eglZzTxoDW8mGidbuWM7U5J6GKGlpthKoX9WMCqoSqFzUKclw1iJyGuGoQGRBTJZEFlaoksqBCBZEJHVUQmdCoIpGA/M8VWPTKJ73q59AVkHt7cfjpGlASuYtvZ6QKybhlt1HZJ79/mmOWnJivbrj6/RxT52VprW9pgWO4wQf6ii+wD78QATpQX23vugKipqOGHFvU6szckGOLWlAc//ukMqCjKKsMKBabCFQaKkWk0lBku1FSKYiLoFIQF0EloSBESWXsmQ2H1FilRVAp6JTN3jyATGjuAKqnDqCPcpITh+KDfJglZ5R/PoY5CcXic14AAAAASUVORK5CYII=" +} diff --git a/utils/copy_js_and_assets.py b/utils/copy_js_and_assets.py new file mode 100644 index 0000000..b4616d1 --- /dev/null +++ b/utils/copy_js_and_assets.py @@ -0,0 +1,49 @@ +import os +import shutil +import json + +# Define the paths +scripts_dir = 'scripts' # Replace with the path to your scripts directory +docs_dir = 'docs' # Replace with the path to your docs directory + +# Ensure the destination directory exists +if not os.path.exists(docs_dir): + os.makedirs(docs_dir) + +for subdir in os.listdir(scripts_dir): + subdir_path = os.path.join(scripts_dir, subdir) + + if os.path.isdir(subdir_path): + metadata_path = os.path.join(subdir_path, 'metadata.json') + + # Check if metadata.json exists in the subdirectory + if os.path.isfile(metadata_path): + with open(metadata_path, 'r') as f: + metadata = json.load(f) + + # Get the script file name from metadata.json + js_file_name = metadata.get('file') # Get the file name from the 'file' key + if js_file_name: + js_file_path = os.path.join(subdir_path, js_file_name) + + # Copy the .js file to docs directory + if os.path.isfile(js_file_path): + shutil.copy(js_file_path, docs_dir) + + # Copy the assets directory + assets_src_dir = os.path.join(subdir_path, 'assets') + assets_dst_dir = os.path.join(docs_dir, subdir, 'assets') + + if os.path.isdir(assets_src_dir): + # Create the destination directory if it doesn't exist + os.makedirs(assets_dst_dir, exist_ok=True) + + # Copy the assets directory + for item in os.listdir(assets_src_dir): + s = os.path.join(assets_src_dir, item) + d = os.path.join(assets_dst_dir, item) + if os.path.isdir(s): + shutil.copytree(s, d, dirs_exist_ok=True) + else: + shutil.copy2(s, d) +