forked from koush/ROMManagerManifest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kernelkanger.rb
53 lines (40 loc) · 1.43 KB
/
kernelkanger.rb
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
require "rubygems"
require "net/https"
require "json"
require "open-uri"
http = Net::HTTP.new("kernels.teamw.in")
headers = { "Content-Type" => "application/x-www-form-urlencoded" }
devices = JSON.parse(open("http://rommanager.appspot.com/manifests/devices.js").read)
kernels = []
supported = {}
devices["devices"].each do |device|
key = device["key"]
puts key
resp, data = http.post("/kernels.php?device=" + URI.escape(device["name"]), "[email protected]", headers)
data = JSON.parse(data)
data.each do |kernel|
supported[key] = true
rmk = {
:modversion => kernel["file"],
:device => key,
:url => "http://kernels.teamw.in/files/" + kernel["file"],
:name => kernel["kernel"],
:summary => kernel["desc"] + "\n\nAndroid Version: " + kernel["androidversion"] + "\n\nLinux Kernel Version: " + kernel["lnxkernelver"] + "\n\nOS Type: " + kernel["ostype"]
}
kernels.push rmk
end
end
wrapper = {
:version => "1",
:homepage => "https://market.android.com/details?id=com.teamwin.kernelmanager.free",
:donate => "http://bit.ly/hVLp6l",
:roms => kernels
}
File.open("kernelmanager.js", "w").write(JSON.pretty_generate(wrapper))
manifest = JSON.parse(File.open("manifests.js").read)
manifest["manifests"].each do |developer|
if developer["id"] == "teamwin" then
developer["roms"] = supported
end
end
File.open("manifests.js", "w").write(JSON.pretty_generate(manifest))