mirror of
https://github.com/dkhamsing/open-source-ios-apps.git
synced 2025-01-12 00:06:08 +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
|
end
|
||||||
|
|
||||||
def apps_for_cat(apps, id)
|
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 = ''
|
o = ''
|
||||||
apps.select { |a| a['category'] == id }.each do |a|
|
apps.each do |a|
|
||||||
name = a['title']
|
name = a['title']
|
||||||
link = a['source']
|
link = a['source']
|
||||||
itunes = a['itunes']
|
itunes = a['itunes']
|
||||||
@ -100,7 +108,8 @@ cats.each do |c|
|
|||||||
temp = "\n#\##{'#' unless c['parent']==nil } #{c['title']} \n \n"
|
temp = "\n#\##{'#' unless c['parent']==nil } #{c['title']} \n \n"
|
||||||
output << temp
|
output << temp
|
||||||
|
|
||||||
output << apps_for_cat(apps, c['id'])
|
cat_apps = apps_for_cat(apps, c['id'])
|
||||||
|
output << output_apps(cat_apps)
|
||||||
end
|
end
|
||||||
|
|
||||||
output << "\n"
|
output << "\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user