-
Notifications
You must be signed in to change notification settings - Fork 2
Handle unbound XML prefixes when strict=False #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Handle unbound XML prefixes when strict=False #35
Conversation
StevenLooman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far, just one minor thing. Also, can you add tests for this?
|
Hi Steven, I've updated the test case. The previous failure was due to a missing default namespace in the test XML string. After adding it, the test now correctly identifies the item and verifies that the unbound song: prefix is handled. All tests are passing locally now! |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
|
Fixed some linting errors etc. Do these changes work for you? Have you tested the current code? |
|
Yes, I have tested the current code locally. I've added a new unit test in tests/test_didl_lite.py specifically to verify that artist and genre are correctly assigned to MusicTrack and rendered properly in the XML output. All 25 tests passed successfully in my environment. The linting fixes didn't break any existing functionality. You can see the new test case in my latest commit. |
|
I suggest running pre-commit before committing, to ensure linting etc finishes without any errors. |
As discussed in async_upnp_client#289, some DLNA devices (like JBL,WiiM/LinkPlay) return metadata with undeclared prefixes (e.g., song:subTitle). This PR adds a generic fix in from_xml_string that identifies missing namespaces and injects temporary ones when strict=False. This prevents xml.etree.ElementTree.ParseError: unbound prefix while maintaining strict compliance when requested.