-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert.py
26 lines (25 loc) · 955 Bytes
/
convert.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
import base64
import requests
import json
def main():
pluginList = newPluginList()
extensions = getExtensions()
with open("./plugins.json", "w") as jsonFile:
jsonFile.write(json.dumps(pluginList))
jsonFile.close()
for extension in extensions:
request = requests.post(f'{os.getenv("data_url")}/upload', files={ 'upload_file': open(extension, "rb") })
print(request.text)
requests.post(f'{os.getenv("data_url")}/upload', files={ 'upload_file': open("plugins.json", "rb") })
def getExtensions():
filesInDir = filter(lambda x: x.endswith(".cs3"), [f for f in os.listdir('.') if os.path.isfile(f)])
return filesInDir
def newPluginList():
with open("./plugins.json") as jsonFile:
jsonArray = json.load(jsonFile)
jsonFile.close()
for i in jsonArray:
i["url"] = f'{os.getenv("proxy_url")}/view/{i["url"].split("/").pop()}?download'
return jsonArray
main()