{"id":24444,"library":"python-didl-lite","title":"python-didl-lite","description":"A Python library for parsing and generating DIDL-Lite (Digital Item Declaration Language) XML, commonly used in UPnP/DLNA media servers. Current version 1.5.0, requires Python 3.10+. Released irregularly, last update in 2024.","status":"active","version":"1.5.0","language":"python","source_language":"en","source_url":"https://github.com/StevenLooman/python-didl-lite","tags":["didl-lite","upnp","dlna","xml","media-server"],"install":[{"cmd":"pip install python-didl-lite","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"DidlObject","correct":"from didl_lite import DidlObject"},{"note":"","wrong":"","symbol":"DidlItem","correct":"from didl_lite import DidlItem"},{"note":"","wrong":"","symbol":"DidlContainer","correct":"from didl_lite import DidlContainer"},{"note":"","wrong":"","symbol":"Guid","correct":"from didl_lite import Guid"},{"note":"","wrong":"","symbol":"Resource","correct":"from didl_lite import Resource"},{"note":"","wrong":"","symbol":"deserialize","correct":"from didl_lite import deserialize"},{"note":"","wrong":"","symbol":"serialize","correct":"from didl_lite import serialize"}],"quickstart":{"code":"from didl_lite import DidlContainer, DidlItem, Resource, Guid, serialize, deserialize\n\n# Create a container\ncontainer = DidlContainer(\n    id='0',\n    parent_id='-1',\n    title='My Container',\n    creator='User',\n    clazz='object.container',\n    restricted=True\n)\n\n# Create an item with a resource\nitem = DidlItem(\n    id='1',\n    parent_id='0',\n    title='Song.mp3',\n    creator='Artist',\n    clazz='object.item.audioItem.musicTrack',\n    restricted=True\n)\nitem.resources.append(Resource(uri='http://example.com/song.mp3', protocol='http-get:*:audio/mpeg:*', size=12345))\n\n# Serialize to XML string\nxml_str = serialize([container, item], pretty_print=True)\nprint(xml_str)\n\n# Deserialize from XML string\nparsed = deserialize(xml_str)\nprint(parsed)","lang":"python","description":"Creates a simple DIDL-Lite XML with a container and an audio item, then serializes and deserializes it."},"warnings":[{"fix":"Upgrade Python to >=3.10 or pin to python-didl-lite<1.5.0","message":"Version 1.5.0 dropped support for Python versions older than 3.10. Code running on earlier Python versions will break.","severity":"breaking","affected_versions":"<1.5.0"},{"fix":"Use the correct DIDL-Lite class strings as per UPnP specifications.","message":"The `clazz` parameter is named with a 'z' (to avoid 'class' keyword) and must be a fully qualified DIDL-Lite class string (e.g., 'object.container', 'object.item.audioItem'). Incorrect class strings may cause deserialization errors or non-standard XML.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `from didl_lite import DidlObject` instead of `from didl_lite.didl_lite import DidlObject`.","message":"The `didl_lite.didl_lite` submodule (old import path) is deprecated since v1.0. Use `from didl_lite import ...` directly.","severity":"deprecated","affected_versions":">=1.0.0, <2.0.0"},{"fix":"Always provide all mandatory constructor arguments.","message":"When serializing, ensure all required fields are set (e.g., `id`, `parent_id`, `title`, `clazz`, `restricted`). Missing fields may produce invalid XML that cannot be deserialized.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from didl_lite import DidlObject` (or the specific class like `DidlItem`).","cause":"Old import path: `from didl_lite.didl_lite import DidlObject`.","error":"AttributeError: module 'didl_lite' has no attribute 'DidlObject'"},{"fix":"Use a valid class like 'object.item.audioItem' or 'object.container.storageFolder'.","cause":"The `clazz` parameter must be a fully qualified UPnP class string. 'object.item' is missing a subclass.","error":"ValueError: Invalid class string: object.item"},{"fix":"Ensure all DidlObject instances have all required attributes set before serialization.","cause":"The serialized XML has mismatched tags due to incorrect object structure (e.g., missing `id` or `parent_id`).","error":"xml.etree.ElementTree.ParseError: mismatched tag"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}