-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJsonParse.py
40 lines (33 loc) · 1.09 KB
/
JsonParse.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
27
28
29
30
31
32
33
34
35
import urllib.request, json
import BashCommands
#get data from url
with urllib.request.urlopen("https://raw.githubusercontent.com/hsmnzaydn/AfterFromManjaro/master/Packages.json") as url:
data = json.loads(url.read().decode())
#
#get all packagename from url
def getPackageName(Type):
Packages=[]
for row in data[Type]:
Packages.append(row["PackageName"])
return Packages
#get choosed bashCommands of Package from url
def getPackageBashCommands(Type,PackageName):
for row in data[Type]:
Com = ""
if row["PackageName"]==PackageName:
for Command in row["PackageBashCommands"]:
if len(Command)==1:
Com = Com + "" + Command
else:
Com = Com + "\n" + Command
if len(Command) == 1:
BashCommands.EchoSingle(Com)
BashCommands.RunSh("./install.sh")
else:
BashCommands.EchoMulti(Com)
#get version from url
def getVersion():
return data["Version"]
#get GithubRepo from url
def getGithubRepo():
return data["GithubRepo"]