[utils] Introduce parse_bitrate

This commit is contained in:
Sergey M․ 2019-03-17 09:07:47 +07:00
parent e5cfb779ea
commit 0dc41787af
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D
2 changed files with 16 additions and 0 deletions

View file

@ -1798,6 +1798,14 @@ def parse_resolution(s):
return {}
def parse_bitrate(s):
if not isinstance(s, compat_str):
return
mobj = re.search(r'\b(\d+)\s*kbps', s)
if mobj:
return int(mobj.group(1))
def month_by_name(name, lang='en'):
""" Return the number of a month by (locale-independently) English name """