Skip to content

Commit

Permalink
fixed issue when manifest had no encoding declared (#8)
Browse files Browse the repository at this point in the history
Co-authored-by: Avishay Cohen <avishay.c>
  • Loading branch information
avishaycohen committed Aug 13, 2022
1 parent 789ec85 commit bbf30d0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ python -m pylint ./mpd_parser/
6. ~~push package to pypi~~
7. add github actions
1. ~~pylint~~
2. pytest
2. ~~pytest~~
3. build package
4. push package
1. add tokens to secrets
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "mpd-parser"
version = "0.0.4"
version = "0.0.5"
description = "lxml based parser for DASH manifests (mpd files)"
readme = "README.md"
authors = [{ name = "Avishay Cohen", email = "avishay.c@gmail.com" }]
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = mpd-parser
version = 0.0.4
version = 0.0.5
author = Avishay Cohen
author_email = avishay.c@gmail.com
description = A parser for mpd manifest files
Expand Down
4 changes: 3 additions & 1 deletion src/mpd_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ def cut_and_burn(match: Match) -> str:
except ValueError as err:
if "Unicode" in err.args[0]:
raise UnicodeDeclaredError() from err
return MPD(root, encoding=encoding[0].groups()[0])
if encoding:
return MPD(root, encoding=encoding[0].groups()[0])
return MPD(root)
2 changes: 1 addition & 1 deletion src/mpd_parser/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ class MPD(Tag): # pylint: disable=too-many-public-methods
the element passed for MPD should be the root of the lxml.etree
"""

def __init__(self, element: Element, encoding: str):
def __init__(self, element: Element, encoding: str = "utf-8"):
super().__init__(element=element)
self.encoding = encoding

Expand Down

0 comments on commit bbf30d0

Please sign in to comment.