update main.py

This commit is contained in:
Firepup Sixfifty 2025-01-21 14:02:53 -06:00
parent 34d145fa63
commit 0ca4d0c887
Signed by: Firepup650
SSH key fingerprint: SHA256:cb8sEJwc0kQJ6/nMUhscWRe35itf0NFMdSKl3v4qt48

24
main.py
View file

@ -8,14 +8,23 @@ try:
except:
...
current = get("https://api.github.com/repos/material-extensions/material-icons-browser-extension/releases/latest").json()
current = get(
"https://api.github.com/repos/material-extensions/material-icons-browser-extension/releases/latest"
).json()
version = current["name"]
if version == oldVer:
exit(0)
subprocess.run(['rm','-rf','github-material-icons-chrome-extensio*'])
subprocess.run(
[
"rm",
"-rf",
"github-material-icons-chrome-extension",
"github-material-icons-chrome-extension.zip",
]
)
# Below is modifed from https://stackoverflow.com/a/16696317
@ -25,6 +34,13 @@ with open("github-material-icons-chrome-extension.zip", "wb") as f:
for chunk in file.iter_content(chunk_size=8192):
f.write(chunk)
os.mkdir('github-material-icons-chrome-extension')
os.mkdir("github-material-icons-chrome-extension")
subprocess.run(['unzip','github-material-icons-chrome-extension.zip','-d','github-material-icons-chrome-extension'])
subprocess.run(
[
"unzip",
"github-material-icons-chrome-extension.zip",
"-d",
"github-material-icons-chrome-extension",
]
)