Fix attr list parsing bugs
authorJakob Cornell <jakob+gpg@jcornell.net>
Tue, 6 Oct 2020 03:23:38 +0000 (22:23 -0500)
committerJakob Cornell <jakob+gpg@jcornell.net>
Tue, 6 Oct 2020 03:23:38 +0000 (22:23 -0500)
hls_watch/playlist.py

index 36fe9127eef22149b0b44fb46b2276e874a058e9..f964b4c139548d96547a16896448901b14847fa5 100644 (file)
@@ -118,7 +118,7 @@ def _parse_attrs(string):
                # decimal-resolution
                m = re.match(r'(?P<h>\d+)x(?P<v>\d+)(?P<rest>,.+|$)$', 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<v>[^,]*)(?P<rest>,.+|$)$', 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)