Compare group of apps

This commit is contained in:
relikd
2020-10-13 19:46:13 +02:00
parent 215ff82d65
commit 76b22281f5
16 changed files with 429 additions and 156 deletions

View File

@@ -2,6 +2,7 @@
import lib_common as mylib
import lib_html as HTML
import html_group_compare
def write_overview_page(base_dir, category_tuples, title):
@@ -12,7 +13,8 @@ def write_overview_page(base_dir, category_tuples, title):
cluster[i].append(x)
except KeyError:
cluster[i] = [x]
src = '<h2>{}</h2><div id="categories">'.format(title)
src = HTML.h2_path_n_rank(title, [], 'compare/', 'Compare')
src += '<div id="categories">'
for i, arr in sorted(cluster.items()):
mylib.sort_by_name(arr, 1)
kind = 'Apps' if i == 6 else 'Games' if i == 7 else 'Other'
@@ -21,6 +23,12 @@ def write_overview_page(base_dir, category_tuples, title):
src += ''.join([HTML.a_category(*x) for x in arr]) + '</div>'
HTML.write(base_dir, src + '</div>', title)
# make groupby compare html
base_dir = mylib.path_add(base_dir, 'compare')
html_group_compare.write_groupby_multi(
base_dir, [('/category', 'All Categories')], 'Compare', 'Categories',
[('category-6', 'Category: Apps'), ('category-7', 'Category: Games')])
def process(affected=None, per_page=60):
print('generating html: category-index ...')
@@ -34,7 +42,7 @@ def process(affected=None, per_page=60):
continue
out_dir = mylib.path_add(base, cid)
# full url since categories can have page 2, 3, etc.
A = HTML.h2_path_n_rank(cname, [(parent, '/category/')], 'ranking/')
A = HTML.h2_path_n_rank(cname, [('/category/', parent)], 'ranking/')
Z = HTML.p_download_json('data.json', 'category-{}.json'.format(cid))
_, a = HTML.write_app_pages(out_dir, json['apps'],
cname, per_page, pre=A, post=Z)