[script] get screenshots, cleanup

This commit is contained in:
Daniel Khamsing 2016-08-10 07:39:26 -07:00
parent e0d2e93ca8
commit 4f08ea107c
1 changed files with 17 additions and 16 deletions

View File

@ -1,7 +1,7 @@
require_relative 'osia_helper'
OUTPUT = 'check-unique.txt' # should be unique
HP = 'check-links.txt' # allow dupes
UNIQUES = 'check-unique.txt' # should be unique
LINKS = 'check-links.txt' # allow dupes
def apps_archived(apps)
a = apps.select {|a| a['tags'] != nil }.select {|b| b['tags'].include?'archive'}
@ -13,30 +13,31 @@ a = j['projects']
archived = apps_archived a
active = a.reject { |x| archived.include? x }
links = []
uniques = []
active.each do |z|
links.push z['source']
links.push z['itunes'] unless z['itunes'].nil?
uniques.push z['source']
uniques.push z['itunes'] unless z['itunes'].nil?
uniques.push z['screenshots'] unless z['screenshots'].nil?
end
links.each_with_index { |z, i| puts "#{i+1} #{z}" }
uniques.each_with_index { |z, i| puts "#{i+1} #{z}" }
puts "Writing #{OUTPUT}"
File.open(OUTPUT, 'w') { |f| f.puts links }
puts "Writing #{UNIQUES}"
File.open(UNIQUES, 'w') { |f| f.puts uniques }
hp = []
links = []
active.each do |z|
hp.push z['homepage'] unless z['homepage'].nil?
hp.push z['title'] unless z['title'].nil?
hp.push z['description'] unless z['description'].nil?
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|
hp.push z['title']
links.push z['title']
end
hp.each_with_index { |z, i| puts "#{i+1} #{z}" }
links.each_with_index { |z, i| puts "#{i+1} #{z}" }
puts "Writing #{HP}"
File.open(HP, 'w') { |f| f.puts hp }
puts "Writing #{LINKS}"
File.open(LINKS, 'w') { |f| f.puts links }