diff --git a/src/README.md b/src/README.md index 657d07d..1b7c4b4 100644 --- a/src/README.md +++ b/src/README.md @@ -40,22 +40,21 @@ Given A → B, B depends on A ``` digraph Dependency { - "." -> download_tracker + "." -> html_root + "." -> html_ranking "." -> download_itunes "." -> bundle_combine download_itunes -> index_app_names bundle_combine -> index_rank bundle_combine -> index_domains - index_app_names -> html_index_apps + index_categories -> html_index_apps index_app_names -> index_rank index_app_names -> index_categories index_categories -> html_categories index_rank -> html_bundle - index_rank -> html_rank index_rank -> html_index_domains index_domains -> html_index_domains - "." -> html_ranking - "." -> html_root + "." -> download_tracker } ``` [graphviz](http://www.webgraphviz.com/) \ No newline at end of file diff --git a/src/html_categories.py b/src/html_categories.py index 899cca9..28ef87a 100755 --- a/src/html_categories.py +++ b/src/html_categories.py @@ -9,15 +9,18 @@ def process(affected=None, per_page=60): base = mylib.path_out('category') parent = 'All Categories' arr = [] - for json in mylib.enum_categories(): - cid, cname = json['cat'] + for fname, json in mylib.enum_categories(): + cid, cname = json['meta'] arr.append((cid, cname)) if affected and cid not in affected: continue - pre = HTML.h2(HTML.a_path([(parent, '../')], cname)) - _, a = HTML.write_app_pages(mylib.path_add(base, cid), json['apps'], - cname, per_page, pre=pre) + out_dir = mylib.path_add(base, cid) + A = HTML.h2(HTML.a_path([(parent, '../')], cname)) + 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) print(' {} ({})'.format(cname, a)) + mylib.symlink(fname, mylib.path_add(out_dir, 'data.json')) print(' .. {} categories'.format(len(arr))) mylib.sort_by_name(arr, 1) diff --git a/src/index_categories.py b/src/index_categories.py index f27c875..891c2e2 100755 --- a/src/index_categories.py +++ b/src/index_categories.py @@ -90,7 +90,7 @@ def persist_individual_files(): mylib.mkdir(pth) for cid, cname in _dict_names.items(): mylib.json_write(mylib.path_add(pth, 'id_{}.json'.format(cid)), - {'cat': [cid, cname], 'apps': index[cid]}) + {'meta': [cid, cname], 'apps': index[cid]}) def get_categories(bundle_id): diff --git a/src/lib_common.py b/src/lib_common.py index 1a881a9..5805c88 100755 --- a/src/lib_common.py +++ b/src/lib_common.py @@ -256,7 +256,7 @@ def enum_jsons(bundle_id): def enum_categories(): for fname in glob.glob(path_data_index('category', 'id_*.json')): with open(fname, 'r') as fp: - yield json.load(fp) + yield fname, json.load(fp) def appids_in_out(selection=None): diff --git a/src/main.py b/src/main.py index 692a740..26829f3 100755 --- a/src/main.py +++ b/src/main.py @@ -69,7 +69,7 @@ def combine_and_update(bundle_ids): new_ids = ['*'] # special case needed to force rebuilt index if len(new_ids) > 0: index_app_names.process(new_ids) # after download_itunes - index_categories.process(new_ids) # after download_itunes + index_categories.process(new_ids) # after index_app_names # 3. re-calculate combined.json bundle_combine.process(bundle_ids) # 4. re-build indices diff --git a/src/z_dependency.svg b/src/z_dependency.svg index c99a3df..d2e6d3e 100644 --- a/src/z_dependency.svg +++ b/src/z_dependency.svg @@ -1,161 +1,151 @@ - + Dependency - + . - -. - - -download_tracker - -download_tracker - - -.->download_tracker - - - - -download_itunes - -download_itunes - - -.->download_itunes - - - - -bundle_combine - -bundle_combine - - -.->bundle_combine - - - - -html_ranking - -html_ranking - - -.->html_ranking - - + +. -html_root - -html_root +html_root + +html_root -.->html_root - - +.->html_root + + + + +html_ranking + +html_ranking + + +.->html_ranking + + + + +download_itunes + +download_itunes + + +.->download_itunes + + + + +bundle_combine + +bundle_combine + + +.->bundle_combine + + + + +download_tracker + +download_tracker + + +.->download_tracker + + -index_app_names - -index_app_names +index_app_names + +index_app_names -download_itunes->index_app_names - - +download_itunes->index_app_names + + -index_rank - -index_rank +index_rank + +index_rank -bundle_combine->index_rank - - +bundle_combine->index_rank + + -index_domains - -index_domains +index_domains + +index_domains -bundle_combine->index_domains - - +bundle_combine->index_domains + + -index_app_names->index_rank - - - - -html_index_apps - -html_index_apps - - -index_app_names->html_index_apps - - +index_app_names->index_rank + + -index_categories - -index_categories +index_categories + +index_categories -index_app_names->index_categories - - +index_app_names->index_categories + + -html_bundle - -html_bundle +html_bundle + +html_bundle -index_rank->html_bundle - - - - -html_rank - -html_rank - - -index_rank->html_rank - - +index_rank->html_bundle + + html_index_domains - -html_index_domains + +html_index_domains index_rank->html_index_domains - - + + index_domains->html_index_domains - - + + + + +html_index_apps + +html_index_apps + + +index_categories->html_index_apps + + -html_categories - -html_categories +html_categories + +html_categories -index_categories->html_categories - - +index_categories->html_categories + + \ No newline at end of file