From ae9df92d287e13566c817d61a7f7ab54c35b3502 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Wed, 8 Apr 2020 22:55:56 -0700 Subject: [PATCH] Divide file size by 2^10 but display SI units --- data/interfaces/default/js/script.js | 3 ++- plexpy/helpers.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/data/interfaces/default/js/script.js b/data/interfaces/default/js/script.js index 089488c9..b03bb3ee 100644 --- a/data/interfaces/default/js/script.js +++ b/data/interfaces/default/js/script.js @@ -462,7 +462,8 @@ $('*').on('click', '.refresh_pms_image', function (e) { // Taken from http://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable#answer-14919494 function humanFileSize(bytes, si = true) { - var thresh = si ? 1000 : 1024; + //var thresh = si ? 1000 : 1024; + var thresh = 1024; // Always divide by 2^10 but display SI units if (Math.abs(bytes) < thresh) { return bytes + ' B'; } diff --git a/plexpy/helpers.py b/plexpy/helpers.py index 4ed03e45..a2adb592 100644 --- a/plexpy/helpers.py +++ b/plexpy/helpers.py @@ -1034,7 +1034,8 @@ def humanFileSize(bytes, si=True): else: return bytes - thresh = 1000 if si else 1024 + #thresh = 1000 if si else 1024 + thresh = 1024 # Always divide by 2^10 but display SI units if bytes < thresh: return str(bytes) + ' B'