From 562048455bdf2d68d2238e2d8628f8ad4cf44463 Mon Sep 17 00:00:00 2001
From: relikd
Date: Mon, 21 Sep 2020 11:55:27 +0200
Subject: [PATCH] Filenames + small changes
---
src/bundle_combine.py | 15 +++++++++------
src/html_root.py | 2 +-
src/index_app_names.py | 4 ++--
src/index_domains.py | 9 ++-------
4 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/src/bundle_combine.py b/src/bundle_combine.py
index 03f73c7..6c73637 100755
--- a/src/bundle_combine.py
+++ b/src/bundle_combine.py
@@ -77,19 +77,22 @@ def json_combine(bundle_id):
mylib.err('bundle-combine', 'skip: ' + fname)
res['pardom'] = pardom
res['subdom'] = subdom
- res['last_date'] = latest
+ res['last_date'] = int(latest)
return res
def json_evaluate_inplace(obj):
+ def float3(val):
+ return int(val * 1000) / 1000
+
rec_count = len(obj['rec_len'])
time_total = sum(obj['rec_len'])
del(obj['rec_len'])
obj['sum_rec'] = rec_count
obj['sum_logs'] = sum([sum(x[1]) for x in obj['pardom'].values()])
- obj['sum_logs_pm'] = obj['sum_logs'] / (time_total or 1) * 60
+ obj['sum_logs_pm'] = float3(obj['sum_logs'] / (time_total or 1) * 60)
obj['sum_time'] = time_total
- obj['avg_time'] = time_total / rec_count
+ obj['avg_time'] = float3(time_total / rec_count)
def transform(ddic):
res = []
@@ -110,9 +113,9 @@ def json_evaluate_inplace(obj):
obj['pardom'], p_t, p_c = transform(obj['pardom'])
obj['subdom'], s_t, s_c = transform(obj['subdom'])
- obj['tracker_percent'] = s_t / (s_c or 1)
- obj['avg_logs'] = s_c
- obj['avg_logs_pm'] = s_c / (obj['avg_time'] or 1) * 60
+ obj['tracker_percent'] = float3(s_t / (s_c or 1))
+ obj['avg_logs'] = float3(s_c)
+ obj['avg_logs_pm'] = float3(s_c / (obj['avg_time'] or 1) * 60)
def process(bundle_ids, where=None):
diff --git a/src/html_root.py b/src/html_root.py
index cf0579a..91b17d1 100755
--- a/src/html_root.py
+++ b/src/html_root.py
@@ -13,7 +13,7 @@ def gen_root():
Information about the research project will be added soon. Stay tuned.
-
+
Get the iOS App and contribute.
Join the TestFlight Beta.
diff --git a/src/index_app_names.py b/src/index_app_names.py
index ba1cc5c..9ef0453 100755
--- a/src/index_app_names.py
+++ b/src/index_app_names.py
@@ -7,7 +7,7 @@ _bundle_name_dict = None
def index_fname():
- return mylib.path_data_index('bundle_names.json')
+ return mylib.path_data_index('app_names.json')
def missing():
@@ -50,7 +50,7 @@ def process(bundle_ids):
for bid in bundle_ids:
names = mylib.app_names(bid)
if not names:
- mylib.err('index-bundle-names', 'could not load: {}'.format(bid))
+ mylib.err('index-app-names', 'could not load: {}'.format(bid))
continue
_bundle_name_dict[bid] = names
did_change = True
diff --git a/src/index_domains.py b/src/index_domains.py
index a080b77..128d980 100755
--- a/src/index_domains.py
+++ b/src/index_domains.py
@@ -7,16 +7,11 @@ import tracker_download
def fname_all():
- return mylib.path_data_index('all_domains.json')
+ return mylib.path_data_index('domains_all.json')
def fname_tracker():
- return mylib.path_data_index('tracker_domains.json')
-
-
-def index_fname(tracker_only=False):
- return mylib.path_data_index(
- 'tracker_domains.json' if tracker_only else 'all_domains.json')
+ return mylib.path_data_index('domains_tracker.json')
def load_json_from_disk(index_file):