forked from koush/ROMManagerManifest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleaner.rb
More file actions
35 lines (28 loc) · 680 Bytes
/
Copy pathcleaner.rb
File metadata and controls
35 lines (28 loc) · 680 Bytes
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
require 'rubygems'
require 'json'
require 'open-uri'
data = File.open('manifests.js').read
parsed_data = JSON.parse(data)
manifests = parsed_data['manifests']
threads = []
for manifest in manifests:
threads << Thread.new(manifest) { |myManifest|
url = myManifest['manifest']
begin
test = open(url).read
myManifest['visible'] = true
rescue
myManifest['visible'] = false
end
}
end
threads.each { |aThread| aThread.join }
new_manifests = []
for manifest in manifests:
if manifest['visible'] then
new_manifests << manifest
end
manifest.delete('visible')
end
parsed_data['manifests'] = new_manifests
puts JSON.dump(parsed_data)