Skip to content

Conversation

@mastikamastika
Copy link

@mastikamastika mastikamastika commented Dec 18, 2025

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.

Copy link
Owner

@StevenLooman StevenLooman left a 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?

@mastikamastika
Copy link
Author

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!

@codecov-commenter
Copy link

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 ☂️

@StevenLooman
Copy link
Owner

Fixed some linting errors etc. Do these changes work for you? Have you tested the current code?

@mastikamastika
Copy link
Author

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.

@StevenLooman
Copy link
Owner

I suggest running pre-commit before committing, to ensure linting etc finishes without any errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants