Skip to content

Commit

Permalink
bug fix for mediaPresentationDuration regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
xhlove committed Feb 12, 2022
1 parent 89f2669 commit ce061db
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions XstreamDL_CLI/extractors/dash/mpditem.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ def match_duration(self, _duration: str) -> float:
duration = re.match(r"PT(\d+)(\.?\d+)S", _duration)
if duration is not None:
return float(duration.group(1)) if duration else 0.0
# PT1H54.600S
duration = re.match(r"PT(\d+)H(\d+)(\.?\d+)S", _duration)
if duration is not None:
_h, _s, _ss = duration.groups()
return int(_h) * 60 * 60 + int(_s) + float("0" + _ss)
# PT23M59.972S
duration = re.match(r"PT(\d+)M(\d+)(\.?\d+)S", _duration)
if duration is not None:
Expand Down

0 comments on commit ce061db

Please sign in to comment.