mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 08:16:06 -07:00
Update human_file_size helper function
This commit is contained in:
parent
3f6612fe9a
commit
b897212050
2 changed files with 4 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# This file is part of Tautulli.
|
# 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)
|
return json.dumps(json_data)
|
||||||
|
|
||||||
|
|
||||||
def humanFileSize(bytes, si=True):
|
def human_file_size(bytes, si=True):
|
||||||
if str(bytes).isdigit():
|
if str(bytes).isdigit():
|
||||||
bytes = cast_to_float(bytes)
|
bytes = cast_to_float(bytes)
|
||||||
else:
|
else:
|
||||||
|
@ -940,7 +940,7 @@ def humanFileSize(bytes, si=True):
|
||||||
bytes /= thresh
|
bytes /= thresh
|
||||||
u += 1
|
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):
|
def parse_condition_logic_string(s, num_cond=0):
|
||||||
|
|
|
@ -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'],
|
'subtitle_language_code': notify_params['subtitle_language_code'],
|
||||||
'file': notify_params['file'],
|
'file': notify_params['file'],
|
||||||
'filename': os.path.basename(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'],
|
'indexes': notify_params['indexes'],
|
||||||
'section_id': notify_params['section_id'],
|
'section_id': notify_params['section_id'],
|
||||||
'rating_key': notify_params['rating_key'],
|
'rating_key': notify_params['rating_key'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue