Skip to content

Commit 66cb0c0

Browse files
authored
Ready to go!
1 parent 1e17553 commit 66cb0c0

2 files changed

Lines changed: 193 additions & 0 deletions

File tree

WinOptimizer.py

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
import os
2+
import aiohttp
3+
import asyncio
4+
import zipfile
5+
from pathlib import Path
6+
from rich.console import Console
7+
from rich.logging import RichHandler
8+
import logging
9+
10+
# Logger configuration
11+
console = Console()
12+
logging.basicConfig(
13+
level=logging.INFO,
14+
format='%(message)s',
15+
handlers=[RichHandler(console=console)]
16+
)
17+
logger = logging.getLogger("Downloader")
18+
19+
# Set GitHub token and desktop path
20+
GITHUB_TOKEN = 'YOUR_GITHUB_TOKEN_HERE' # Replace with your actual GitHub token
21+
DESKTOP_PATH = Path.home() / "Desktop" / "WinOptimizer"
22+
DESKTOP_PATH.mkdir(parents=True, exist_ok=True)
23+
24+
# List of repositories to download and Sysinternals URLs
25+
repos = [
26+
"https://github.com/meetrevision/playbook",
27+
"https://github.com/Atlas-OS/Atlas",
28+
"https://github.com/microsoft/devhome",
29+
"https://github.com/CorentinTh/it-tools",
30+
"https://github.com/massgravel/Microsoft-Activation-Scripts",
31+
"https://github.com/ChrisTitusTech/winutil",
32+
"https://github.com/OgnitorenKs/Toolbox",
33+
"https://github.com/hellzerg/optimizer",
34+
"https://github.com/just-maik/win-opti-resources",
35+
"https://github.com/DuckyOnQuack-999/WinKit",
36+
"https://github.com/Marvin700/Windows_Optimisation_Pack",
37+
"https://github.com/azurejoga/Aurora-Windows-Optimizer",
38+
"https://github.com/semazurek/ET-Optimizer",
39+
"https://github.com/rayenghanmi/RyTuneX",
40+
"https://github.com/caxzy/LynxOptimizer",
41+
"https://github.com/LightMode00/Hone-Optimizer",
42+
"https://github.com/Greedeks/GTweak",
43+
"https://github.com/mrandcris/WIN10-OPTIMIZER",
44+
"https://github.com/Parcoil/Sparkle",
45+
"https://github.com/Kuuuuuuuu/Tweaks",
46+
"https://github.com/hasanalt/Windows-Optimizer",
47+
"https://github.com/DevToys-app/DevToys",
48+
"https://github.com/gordonbay/Windows-On-Reins",
49+
"https://github.com/PublicSatanicVoid/WindowsPowerWash",
50+
"https://github.com/Raphire/Win11Debloat",
51+
"https://github.com/farag2/Sophia-Script-for-Windows",
52+
"https://github.com/LeDragoX/Win-Debloat-Tools",
53+
"https://github.com/awesome-windows11/windows11",
54+
"https://github.com/99natmar99/Windows-11-Fixer",
55+
"https://github.com/rcmaehl/NotCPUCores",
56+
"https://github.com/farag2/Utilities",
57+
"https://github.com/svenmauch/WinSlap",
58+
"https://github.com/SanGraphic/QuickBoost",
59+
"https://github.com/equk/windows",
60+
"https://github.com/TairikuOokami/Windows",
61+
"https://github.com/denis-g/windows10-latency-optimization",
62+
"https://github.com/alfinauzikri/WinCustom",
63+
"https://github.com/ancel1x/Ancels-Performance-Batch",
64+
"https://github.com/Jisll/windows11",
65+
"https://github.com/alfaaarex/awesome-tweaks",
66+
"https://github.com/Zusier/Zusiers-optimization-Batch",
67+
"https://github.com/Ec-25/FixIt",
68+
"https://github.com/Jisll/Sadcoy",
69+
"https://github.com/Batlez/Batlez-Tweaks",
70+
"https://github.com/Teramanbr/TerabyteTweaker",
71+
"https://github.com/leetfin/Windows10Tools",
72+
"https://github.com/WinTweaks/windows-optimization",
73+
"https://github.com/Foulest/RepairKit",
74+
"https://github.com/Empyreal96/win-10-services-toolbox",
75+
"https://github.com/2rf/winGetDebloated",
76+
"https://github.com/iamtraction/WindowsRegistry",
77+
"https://github.com/zoicware/ZOICWARE",
78+
"https://github.com/AFaustini/OtimizeWindows",
79+
"https://github.com/ehsan18t/Win10-Ultimate-System-Tweaks",
80+
"https://github.com/felikcat/W11Boost",
81+
"https://github.com/shoober420/windows11-scripts",
82+
"https://github.com/K3V1991/Increase-Perfomance-on-Windows",
83+
"https://github.com/TheDoctorTash/MegaTweakPack",
84+
"https://github.com/buxh/ZER0-Batch-Optimizer",
85+
"https://github.com/Jisll/Sadeaner",
86+
"https://github.com/zoicware/RepairBadTweaks",
87+
"https://github.com/AzhamProdLive/WPC-Useful-Box",
88+
"https://github.com/christopherhowe02/Debloat10",
89+
"https://github.com/SegoCode/DebloBat",
90+
"https://github.com/vukilis/Windows11-Optimizer-Debloater",
91+
"https://github.com/PusPC/Pus",
92+
"https://github.com/ivandfx/DFXWinTweaks",
93+
"https://github.com/kubsonxtm/Windows-Tweaks",
94+
"https://github.com/Batch-o-Taco/UBC",
95+
"https://github.com/emylfy/simplify11",
96+
"https://github.com/RickyDevs/QOptimizer",
97+
"https://github.com/DavoDC/WindowsFiles",
98+
"https://github.com/aazhbd/WinDecluttered",
99+
"https://github.com/0000xFFFF/reghacks",
100+
"https://github.com/MartinLXXX6/The-Windows-Suite",
101+
"https://github.com/SchooiCodes/smt",
102+
"https://github.com/DevSentinel/SentinelsToolbox",
103+
"https://github.com/equk/w10_gaming",
104+
"https://github.com/DestroyerDarkNess/StrelyCleaner",
105+
"https://github.com/Empyreal96/win-10-toolbox-gui",
106+
"https://github.com/waylaa/WindowsOptimizations",
107+
"https://github.com/kubsonxtm/Windows-Tweaks",
108+
"https://github.com/mattreecebentley/Windows-10-11-Simplifier",
109+
"https://github.com/teeotsa/windows-11-debloat",
110+
"https://github.com/teeotsa/windows-10-debloat",
111+
"https://github.com/mrandcris/WIN10-OPTIMIZER",
112+
"https://github.com/ionuttbara/melody_windows"
113+
]
114+
115+
# Sysinternals and AME Wizard URLs
116+
sysinternals_url = "https://download.sysinternals.com/files/SysinternalsSuite.zip"
117+
ame_wizard_url = "https://download.ameliorated.io/AME%20Wizard%20Beta.zip"
118+
119+
# Set headers for GitHub API access
120+
headers = {"Authorization": f"token {GITHUB_TOKEN}"}
121+
122+
async def download_file(session, url, dest_path):
123+
"""Download a file and log the process."""
124+
async with session.get(url) as response:
125+
if response.status == 200:
126+
with open(dest_path, 'wb') as file:
127+
file.write(await response.read())
128+
logger.info(f"[bold green]Downloaded file:[/bold green] {dest_path}")
129+
else:
130+
logger.error(f"[bold red]Download failed (status {response.status}):[/bold red] {url}")
131+
132+
async def fetch_latest_release(session, repo_owner, repo_name):
133+
"""Fetch the latest release link from the GitHub API."""
134+
url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/releases/latest"
135+
async with session.get(url, headers=headers) as response:
136+
if response.status == 200:
137+
release = await response.json()
138+
assets = release.get("assets", [])
139+
if assets:
140+
return assets[0]["browser_download_url"]
141+
return None
142+
143+
async def get_default_branch(session, repo_owner, repo_name):
144+
"""Get the default branch name from GitHub."""
145+
url = f"https://api.github.com/repos/{repo_owner}/{repo_name}"
146+
async with session.get(url, headers=headers) as response:
147+
if response.status == 200:
148+
repo_info = await response.json()
149+
return repo_info.get("default_branch", "main")
150+
return "main"
151+
152+
async def process_repo(session, repo_url):
153+
"""Process downloading the latest release or the default branch from the given repo URL."""
154+
repo_owner, repo_name = repo_url.strip("/").split("/")[-2:]
155+
dest_folder = DESKTOP_PATH / f"{repo_name}_{repo_owner}"
156+
dest_folder.mkdir(parents=True, exist_ok=True)
157+
158+
release_url = await fetch_latest_release(session, repo_owner, repo_name)
159+
if release_url:
160+
await download_file(session, release_url, dest_folder / release_url.split("/")[-1])
161+
else:
162+
default_branch = await get_default_branch(session, repo_owner, repo_name)
163+
await download_repo(session, repo_owner, repo_name, dest_folder, default_branch)
164+
logger.info(f"[bold blue]Completed repo:[/bold blue] {repo_name}")
165+
166+
async def download_repo(session, repo_owner, repo_name, dest_folder, branch):
167+
"""Download the zip file from the default branch."""
168+
repo_url = f"https://codeload.github.com/{repo_owner}/{repo_name}/zip/refs/heads/{branch}"
169+
await download_file(session, repo_url, dest_folder / f"{repo_name}.zip")
170+
171+
async def download_and_extract(session, url, folder_name):
172+
"""Download a file and extract it."""
173+
zip_path = DESKTOP_PATH / f"{folder_name}.zip"
174+
await download_file(session, url, zip_path)
175+
dest_folder = DESKTOP_PATH / folder_name
176+
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
177+
zip_ref.extractall(dest_folder)
178+
zip_path.unlink()
179+
logger.info(f"[bold yellow]{folder_name} downloaded and extracted.[/bold yellow]")
180+
181+
async def main():
182+
"""Main function to perform download operations."""
183+
async with aiohttp.ClientSession() as session:
184+
tasks = [
185+
download_and_extract(session, sysinternals_url, "SysinternalsSuite"),
186+
download_and_extract(session, ame_wizard_url, "AME_Wizard_Beta")
187+
]
188+
for repo in repos:
189+
tasks.append(process_repo(session, repo))
190+
await asyncio.gather(*tasks)
191+
192+
if __name__ == "__main__":
193+
asyncio.run(main())

requirements.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)