From: Jakob Cornell Date: Tue, 6 Oct 2020 03:23:38 +0000 (-0500) Subject: Fix attr list parsing bugs X-Git-Url: https://jcornell.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=8a2c65cfad856ee72257026ff900b4f5a9990e64;p=hls-watch.git Fix attr list parsing bugs --- diff --git a/hls_watch/playlist.py b/hls_watch/playlist.py index 36fe912..f964b4c 100644 --- a/hls_watch/playlist.py +++ b/hls_watch/playlist.py @@ -118,7 +118,7 @@ def _parse_attrs(string): # decimal-resolution m = re.match(r'(?P\d+)x(?P\d+)(?P,.+|$)$', string) if m: - return Resolution._make(map(int, m.groups())) + return (Resolution(int(m.group('h')), int(m.group('v'))), m.group('rest')) m = re.match('(?P[^,]*)(?P,.+|$)$', string) return m.groups() @@ -130,6 +130,7 @@ def _parse_attrs(string): assert rest[0] == '=' (val, rest) = pop_value(rest[1:]) items.append((key, val)) + rest = rest.lstrip(',') attrs = dict(items) assert len(attrs) == len(items)