mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
kiwix reports size in K
This commit is contained in:
parent
050d1c68b7
commit
ce05888f62
1 changed files with 4 additions and 3 deletions
|
@ -215,7 +215,7 @@ def write_zim_versions_idx():
|
||||||
get_substitution_data(perma_ref, zims_installed, path_to_id_map)
|
get_substitution_data(perma_ref, zims_installed, path_to_id_map)
|
||||||
zim_versions[perma_ref]['article_count'] = articlecount
|
zim_versions[perma_ref]['article_count'] = articlecount
|
||||||
zim_versions[perma_ref]['media_count'] = mediacount
|
zim_versions[perma_ref]['media_count'] = mediacount
|
||||||
size = human_readable(size)
|
size = human_readable(size * 1024) # kiwix reports in K
|
||||||
zim_versions[perma_ref]['size'] = size
|
zim_versions[perma_ref]['size'] = size
|
||||||
zim_versions[perma_ref]['tags'] = tags
|
zim_versions[perma_ref]['tags'] = tags
|
||||||
zim_versions[perma_ref]['language'] = lang
|
zim_versions[perma_ref]['language'] = lang
|
||||||
|
@ -290,6 +290,7 @@ def get_kiwix_catalog_item(perma_ref):
|
||||||
|
|
||||||
def human_readable(num):
|
def human_readable(num):
|
||||||
# return 3 significant digits and unit specifier
|
# return 3 significant digits and unit specifier
|
||||||
|
# TFM 7/15/2019 change to factor of 1024, not 1000 to match similar calcs elsewhere
|
||||||
num = float(num)
|
num = float(num)
|
||||||
units = [ '','K','M','G']
|
units = [ '','K','M','G']
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
|
@ -299,7 +300,7 @@ def human_readable(num):
|
||||||
return "%.1f%s"%(num,units[i])
|
return "%.1f%s"%(num,units[i])
|
||||||
if num < 1000.0:
|
if num < 1000.0:
|
||||||
return "%.0f%s"%(num,units[i])
|
return "%.0f%s"%(num,units[i])
|
||||||
num /= 1000.0
|
num /= 1024.0
|
||||||
|
|
||||||
# Now start the application
|
# Now start the application
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue