2016-06-07 16:53:14 +03:00
|
|
|
require_relative 'osia_helper'
|
|
|
|
|
2016-08-05 22:47:23 +03:00
|
|
|
OUTPUT = 'check-unique.txt' # should be unique
|
|
|
|
HP = 'check-links.txt' # allow dupes
|
2016-06-07 16:53:14 +03:00
|
|
|
|
|
|
|
def apps_archived(apps)
|
|
|
|
a = apps.select {|a| a['tags'] != nil }.select {|b| b['tags'].include?'archive'}
|
|
|
|
a.sort_by { |k, v| k['title'] }
|
|
|
|
end
|
|
|
|
|
|
|
|
j = get_json
|
|
|
|
a = j['projects']
|
|
|
|
archived = apps_archived a
|
2016-06-07 17:43:32 +03:00
|
|
|
active = a.reject { |x| archived.include? x }
|
2016-06-07 16:53:14 +03:00
|
|
|
|
2016-06-07 17:43:32 +03:00
|
|
|
links = []
|
|
|
|
active.each do |z|
|
|
|
|
links.push z['source']
|
|
|
|
links.push z['itunes'] unless z['itunes'].nil?
|
|
|
|
end
|
|
|
|
|
|
|
|
links.each_with_index { |z, i| puts "#{i+1} #{z}" }
|
2016-06-07 16:53:14 +03:00
|
|
|
|
|
|
|
puts "Writing #{OUTPUT}"
|
|
|
|
File.open(OUTPUT, 'w') { |f| f.puts links }
|
2016-06-08 06:05:24 +03:00
|
|
|
|
|
|
|
hp = []
|
|
|
|
active.each do |z|
|
|
|
|
hp.push z['homepage'] unless z['homepage'].nil?
|
2016-08-05 22:47:23 +03:00
|
|
|
hp.push z['title'] unless z['title'].nil?
|
|
|
|
hp.push z['description'] unless z['description'].nil?
|
|
|
|
end
|
|
|
|
|
|
|
|
c = j['categories']
|
|
|
|
c.each do |z|
|
|
|
|
hp.push z['title']
|
2016-06-08 06:05:24 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
hp.each_with_index { |z, i| puts "#{i+1} #{z}" }
|
|
|
|
|
|
|
|
puts "Writing #{HP}"
|
|
|
|
File.open(HP, 'w') { |f| f.puts hp }
|