1
0
mirror of https://github.com/dkhamsing/open-source-ios-apps.git synced 2024-12-22 21:38:44 +01:00
App-Open-Source-per-iPhone-.../.github/osia_get_links.rb

44 lines
1.0 KiB
Ruby
Raw Normal View History

2016-06-07 15:53:14 +02:00
require_relative 'osia_helper'
2016-08-10 16:39:26 +02:00
UNIQUES = 'check-unique.txt' # should be unique
LINKS = 'check-links.txt' # allow dupes
2016-06-07 15:53:14 +02: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 16:43:32 +02:00
active = a.reject { |x| archived.include? x }
2016-06-07 15:53:14 +02:00
2016-08-10 16:39:26 +02:00
uniques = []
2016-06-07 16:43:32 +02:00
active.each do |z|
2016-08-10 16:39:26 +02:00
uniques.push z['source']
uniques.push z['itunes'] unless z['itunes'].nil?
uniques.push z['screenshots'] unless z['screenshots'].nil?
2016-06-07 16:43:32 +02:00
end
2016-08-10 16:39:26 +02:00
uniques.each_with_index { |z, i| puts "#{i+1} #{z}" }
2016-06-07 15:53:14 +02:00
2016-08-10 16:39:26 +02:00
puts "Writing #{UNIQUES}"
File.open(UNIQUES, 'w') { |f| f.puts uniques }
2016-06-08 05:05:24 +02:00
2016-08-10 16:39:26 +02:00
links = []
2016-06-08 05:05:24 +02:00
active.each do |z|
2016-08-10 16:39:26 +02:00
links.push z['homepage'] unless z['homepage'].nil?
links.push z['title'] unless z['title'].nil?
links.push z['description'] unless z['description'].nil?
end
c = j['categories']
c.each do |z|
2016-08-10 16:39:26 +02:00
links.push z['title']
2016-06-08 05:05:24 +02:00
end
2016-08-10 16:39:26 +02:00
links.each_with_index { |z, i| puts "#{i+1} #{z}" }
2016-06-08 05:05:24 +02:00
2016-08-10 16:39:26 +02:00
puts "Writing #{LINKS}"
File.open(LINKS, 'w') { |f| f.puts links }