mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 06:04:15 +00:00
create millisecondToHuman method in utils
This commit is contained in:
parent
faeee7d667
commit
3852ed52a7
1 changed files with 12 additions and 0 deletions
|
@ -204,6 +204,18 @@ def toDatetime(value, format=None):
|
|||
return value
|
||||
|
||||
|
||||
def millisecondToHuman(milliseconds):
|
||||
""" Returns human readable time duration from milliseconds.
|
||||
HH:MM:SS
|
||||
|
||||
Parameters:
|
||||
milliseconds (str,int): time duration in milliseconds.
|
||||
"""
|
||||
_milliseconds = cast(int, milliseconds)
|
||||
hhmmsssm = timedelta(milliseconds=_milliseconds)
|
||||
return str(hhmmsssm).split(".")[0]
|
||||
|
||||
|
||||
def toList(value, itemcast=None, delim=','):
|
||||
""" Returns a list of strings from the specified value.
|
||||
|
||||
|
|
Loading…
Reference in a new issue