From 0b451cd1f463d24ef05abc54366507ee9b5dc3d2 Mon Sep 17 00:00:00 2001 From: Magic <82341152+MagicTheDev@users.noreply.github.com> Date: Sun, 18 Aug 2024 22:48:29 -0500 Subject: [PATCH] initial --- assets/bot/emojis.json | 10 ++-- ... => Building_CC_District_Hall_level_1.png} | Bin ... => Building_CC_District_Hall_level_2.png} | Bin ... => Building_CC_District_Hall_level_3.png} | Bin ... => Building_CC_District_Hall_level_4.png} | Bin ... => Building_CC_District_Hall_level_5.png} | Bin download_html.py | 55 ------------------ 7 files changed, 5 insertions(+), 60 deletions(-) rename assets/capital-base/capital-hall-pics/{Building_CC_District_Hall_ level _1.png => Building_CC_District_Hall_level_1.png} (100%) rename assets/capital-base/capital-hall-pics/{Building_CC_District_Hall_ level_2.png => Building_CC_District_Hall_level_2.png} (100%) rename assets/capital-base/capital-hall-pics/{Building_CC_District_Hall_ level_3.png => Building_CC_District_Hall_level_3.png} (100%) rename assets/capital-base/capital-hall-pics/{Building_CC_District_Hall_ level_4.png => Building_CC_District_Hall_level_4.png} (100%) rename assets/capital-base/capital-hall-pics/{Building_CC_District_Hall_ level_5.png => Building_CC_District_Hall_level_5.png} (100%) delete mode 100644 download_html.py diff --git a/assets/bot/emojis.json b/assets/bot/emojis.json index 0e1432d..168acea 100644 --- a/assets/bot/emojis.json +++ b/assets/bot/emojis.json @@ -75,11 +75,11 @@ }, "capital_hall_emojis": { "Capital_Hall7": "/capital-base/capital-hall-pics/Building_CC_Capital_Hall_level_7.png", - "District_Hall4": "/capital-base/capital-hall-pics/Building_CC_District_Hall_ level_4.png", - "District_Hall5": "/capital-base/capital-hall-pics/Building_CC_District_Hall_ level_5.png", - "District_Hall3": "/capital-base/capital-hall-pics/Building_CC_District_Hall_ level_3.png", - "District_Hall2": "/capital-base/capital-hall-pics/Building_CC_District_Hall_ level_2.png", - "District_Hall1": "/capital-base/capital-hall-pics/Building_CC_District_Hall_ level_1.png", + "District_Hall4": "/capital-base/capital-hall-pics/Building_CC_District_Hall_level_4.png", + "District_Hall5": "/capital-base/capital-hall-pics/Building_CC_District_Hall_level_5.png", + "District_Hall3": "/capital-base/capital-hall-pics/Building_CC_District_Hall_level_3.png", + "District_Hall2": "/capital-base/capital-hall-pics/Building_CC_District_Hall_level_2.png", + "District_Hall1": "/capital-base/capital-hall-pics/Building_CC_District_Hall_level_1.png", "Capital_Hall9": "/capital-base/capital-hall-pics/Building_CC_Capital_Hall_level_9.png", "Capital_Hall10": "/capital-base/capital-hall-pics/Building_CC_Capital_Hall_level_10.png", "Capital_Hall8": "/capital-base/capital-hall-pics/Building_CC_Capital_Hall_level_8.png", diff --git a/assets/capital-base/capital-hall-pics/Building_CC_District_Hall_ level _1.png b/assets/capital-base/capital-hall-pics/Building_CC_District_Hall_level_1.png similarity index 100% rename from assets/capital-base/capital-hall-pics/Building_CC_District_Hall_ level _1.png rename to assets/capital-base/capital-hall-pics/Building_CC_District_Hall_level_1.png diff --git a/assets/capital-base/capital-hall-pics/Building_CC_District_Hall_ level_2.png b/assets/capital-base/capital-hall-pics/Building_CC_District_Hall_level_2.png similarity index 100% rename from assets/capital-base/capital-hall-pics/Building_CC_District_Hall_ level_2.png rename to assets/capital-base/capital-hall-pics/Building_CC_District_Hall_level_2.png diff --git a/assets/capital-base/capital-hall-pics/Building_CC_District_Hall_ level_3.png b/assets/capital-base/capital-hall-pics/Building_CC_District_Hall_level_3.png similarity index 100% rename from assets/capital-base/capital-hall-pics/Building_CC_District_Hall_ level_3.png rename to assets/capital-base/capital-hall-pics/Building_CC_District_Hall_level_3.png diff --git a/assets/capital-base/capital-hall-pics/Building_CC_District_Hall_ level_4.png b/assets/capital-base/capital-hall-pics/Building_CC_District_Hall_level_4.png similarity index 100% rename from assets/capital-base/capital-hall-pics/Building_CC_District_Hall_ level_4.png rename to assets/capital-base/capital-hall-pics/Building_CC_District_Hall_level_4.png diff --git a/assets/capital-base/capital-hall-pics/Building_CC_District_Hall_ level_5.png b/assets/capital-base/capital-hall-pics/Building_CC_District_Hall_level_5.png similarity index 100% rename from assets/capital-base/capital-hall-pics/Building_CC_District_Hall_ level_5.png rename to assets/capital-base/capital-hall-pics/Building_CC_District_Hall_level_5.png diff --git a/download_html.py b/download_html.py deleted file mode 100644 index 8319187..0000000 --- a/download_html.py +++ /dev/null @@ -1,55 +0,0 @@ -import os -import aiohttp -import asyncio - -# Replace with your Bunny.net credentials -api_key = 'YOUR_API_KEY' -storage_zone_name = 'YOUR_STORAGE_ZONE_NAME' -storage_zone_region = 'YOUR_STORAGE_ZONE_REGION' # e.g., 'ny', 'sg', etc. -base_url = f'https://{storage_zone_region}.storage.bunnycdn.com/{storage_zone_name}' - -# Set up the headers for authentication -headers = { - 'AccessKey': api_key -} - - -# Function to list all files in the storage zone -async def list_files(session, path=""): - url = f'{base_url}/{path}' - async with session.get(url, headers=headers) as response: - response.raise_for_status() - return await response.json() - - -# Function to download .html files -async def download_file(session, file_url, local_filename): - async with session.get(file_url, headers=headers) as response: - response.raise_for_status() - os.makedirs(os.path.dirname(local_filename), exist_ok=True) - with open(local_filename, 'wb') as f: - async for chunk in response.content.iter_chunked(8192): - f.write(chunk) - - -# List all files and download .html files -async def download_html_files(): - async with aiohttp.ClientSession() as session: - files = await list_files(session) - tasks = [] - for file in files: - if file['IsDirectory']: - continue # Skip directories - if file['ObjectName'].endswith('.html'): - file_url = f"{base_url}/{file['Path']}" - local_filename = os.path.join('downloaded_files', file['ObjectName']) - print(f"Queuing download for {file['ObjectName']}...") - tasks.append(download_file(session, file_url, local_filename)) - - # Run all download tasks concurrently - await asyncio.gather(*tasks) - - -# Run the asynchronous download -if __name__ == '__main__': - asyncio.run(download_html_files())