mirror of
https://github.com/dkhamsing/open-source-ios-apps.git
synced 2025-01-11 15:54:30 +01:00
[script] Support categories list
This commit is contained in:
parent
f7cc2abd17
commit
c482b2a570
13
convert.rb
13
convert.rb
@ -33,8 +33,16 @@ def output_flag(lang)
|
||||
end
|
||||
|
||||
def apps_for_cat(apps, id)
|
||||
apps.select do |a|
|
||||
cat = a['category']
|
||||
# puts cat.class
|
||||
cat.class == Array ? cat.include?(id) : (cat == id)
|
||||
end
|
||||
end
|
||||
|
||||
def output_apps(apps)
|
||||
o = ''
|
||||
apps.select { |a| a['category'] == id }.each do |a|
|
||||
apps.each do |a|
|
||||
name = a['title']
|
||||
link = a['source']
|
||||
itunes = a['itunes']
|
||||
@ -100,7 +108,8 @@ cats.each do |c|
|
||||
temp = "\n#\##{'#' unless c['parent']==nil } #{c['title']} \n \n"
|
||||
output << temp
|
||||
|
||||
output << apps_for_cat(apps, c['id'])
|
||||
cat_apps = apps_for_cat(apps, c['id'])
|
||||
output << output_apps(cat_apps)
|
||||
end
|
||||
|
||||
output << "\n"
|
||||
|
Loading…
Reference in New Issue
Block a user