Skip to content

Commit

Permalink
add rule for match_duration
Browse files Browse the repository at this point in the history
  • Loading branch information
xhlove committed Feb 25, 2022
1 parent fe11181 commit 20c96fb
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
# PT50M0S
duration = re.match(r"PT(\d+)M(\d+)S", _duration)
if duration is not None:
_m, _s = duration.groups()
return int(_m) * 60 + int(_s)
# PT1H54.600S
duration = re.match(r"PT(\d+)H(\d+)(\.?\d+)S", _duration)
if duration is not None:
Expand Down

0 comments on commit 20c96fb

Please sign in to comment.