From 1bf0bb7b3dcb9ba3c32a91525ab386763299f3ce Mon Sep 17 00:00:00 2001 From: genericname462 Date: Sat, 20 Feb 2016 15:19:26 +0000 Subject: [PATCH] Added unit conversion for the Tebibyte (TiB, 2^40 B) suffix. Any amount greater than 1099511627776 B (1 TiB) gets converted with 2 digit precision, similiar to the GiB conversion. --- transmission-remote-cli | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/transmission-remote-cli b/transmission-remote-cli index 6d3a39d..a9f3ffc 100755 --- a/transmission-remote-cli +++ b/transmission-remote-cli @@ -3440,7 +3440,10 @@ def timestamp(timestamp, format="%x %X"): def scale_bytes(bytes, type='short'): - if bytes >= 1073741824: + if bytes >= 1099511627776: + scaled_bytes = round((bytes / 1099511627776.0), 2) + unit = 'T' + elif bytes >= 1073741824: scaled_bytes = round((bytes / 1073741824.0), 2) unit = 'G' elif bytes >= 1048576: