Move /ranking -> /index/apps

This commit is contained in:
relikd
2020-09-25 23:16:57 +02:00
parent e2901503f4
commit f7c75d1bd5
8 changed files with 36 additions and 22 deletions

View File

@@ -11,18 +11,19 @@ def process(affected=None, per_page=60):
arr = []
for fname, json in mylib.enum_categories():
cid, cname = json['meta']
arr.append((cid, cname))
arr.append([cid, cname])
if affected and cid not in affected:
continue
out_dir = mylib.path_add(base, cid)
# full url since categories can have page 2, 3, etc.
A = '<h2>' + HTML.a_path([(parent, '/category/')], cname) + \
'<a class="snd floatr" href="ranking/">Ranking</a></h2>'
A = HTML.h2_path_n_rank(cname, [(parent, '/category/')], 'ranking/')
Z = HTML.p_download_json('data.json', 'category-{}.json'.format(cid))
# does BREAK html_ranking!! call html_categories before html_ranking
_, a = HTML.write_app_pages(out_dir, json['apps'],
cname, per_page, pre=A, post=Z)
# write_app_pages breaks html_ranking!! call html_ranking after this!
print(' {} ({})'.format(cname, a))
if a > 1:
arr[-1][-1] += ' ({})'.format(a) # append count
mylib.symlink(fname, mylib.path_add(out_dir, 'data.json'))
print(' .. {} categories'.format(len(arr)))