From b897212050fa3f752ba38a87020716313694ad8f Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Tue, 4 Aug 2020 13:44:48 -0700 Subject: [PATCH] Update human_file_size helper function --- plexpy/helpers.py | 6 +++--- plexpy/notification_handler.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plexpy/helpers.py b/plexpy/helpers.py index e2ec0a84..4a6f63dc 100644 --- a/plexpy/helpers.py +++ b/plexpy/helpers.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # This file is part of Tautulli. # @@ -918,7 +918,7 @@ def build_datatables_json(kwargs, dt_columns, default_sort_col=None): return json.dumps(json_data) -def humanFileSize(bytes, si=True): +def human_file_size(bytes, si=True): if str(bytes).isdigit(): bytes = cast_to_float(bytes) else: @@ -940,7 +940,7 @@ def humanFileSize(bytes, si=True): bytes /= thresh u += 1 - return "{0:.1f} {1}".format(bytes, units[u]) + return "{0:.2f} {1}".format(bytes, units[u]) def parse_condition_logic_string(s, num_cond=0): diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index 58f24921..ba940057 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -1071,7 +1071,7 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m 'subtitle_language_code': notify_params['subtitle_language_code'], 'file': notify_params['file'], 'filename': os.path.basename(notify_params['file']), - 'file_size': helpers.humanFileSize(notify_params['file_size']), + 'file_size': helpers.human_file_size(notify_params['file_size']), 'indexes': notify_params['indexes'], 'section_id': notify_params['section_id'], 'rating_key': notify_params['rating_key'],