mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 05:31:15 -07:00
Divide file size by 2^10 but display SI units
(cherry picked from commit ae9df92d28
)
This commit is contained in:
parent
435230711e
commit
0886d133a8
2 changed files with 4 additions and 2 deletions
|
@ -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
|
// Taken from http://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable#answer-14919494
|
||||||
function humanFileSize(bytes, si = true) {
|
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) {
|
if (Math.abs(bytes) < thresh) {
|
||||||
return bytes + ' B';
|
return bytes + ' B';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1056,7 +1056,8 @@ def humanFileSize(bytes, si=True):
|
||||||
else:
|
else:
|
||||||
return bytes
|
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:
|
if bytes < thresh:
|
||||||
return str(bytes) + ' B'
|
return str(bytes) + ' B'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue