mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-15 00:48:28 +00:00
[utils] parse_duration
: return int
when decimal part is zero
This commit is contained in:
parent
71f30921a2
commit
52c0c1fe96
@ -2123,9 +2123,11 @@ def parse_duration(s):
|
||||
|
||||
if ms:
|
||||
ms = ms.replace(':', '.')
|
||||
return sum(float(part or 0) * mult for part, mult in (
|
||||
total = sum(float(part or 0) * mult for part, mult in (
|
||||
(days, 86400), (hours, 3600), (mins, 60), (secs, 1), (ms, 1)))
|
||||
|
||||
return int(total) if total.is_integer() else total
|
||||
|
||||
|
||||
def _change_extension(prepend, filename, ext, expected_real_ext=None):
|
||||
name, real_ext = os.path.splitext(filename)
|
||||
|
Loading…
Reference in New Issue
Block a user