python-didl-lite 1.4.0__tar.gz → 1.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-didl-lite
3
- Version: 1.4.0
3
+ Version: 1.4.1
4
4
  Summary: DIDL-Lite (Digital Item Declaration Language) tools for Python
5
5
  Home-page: https://github.com/StevenLooman/python-didl-lite
6
6
  Author: Steven Looman
7
7
  Author-email: steven.looman@gmail.com
8
- License: UNKNOWN
9
- Platform: UNKNOWN
10
8
  Classifier: Development Status :: 5 - Production/Stable
11
9
  Classifier: Intended Audience :: Developers
12
10
  Classifier: License :: OSI Approved :: Apache Software License
@@ -16,9 +14,11 @@ Classifier: Programming Language :: Python :: 3.9
16
14
  Classifier: Programming Language :: Python :: 3.10
17
15
  Classifier: Programming Language :: Python :: 3.11
18
16
  Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
19
18
  Requires-Python: >=3.8
20
19
  Description-Content-Type: text/x-rst
21
20
  License-File: LICENSE.md
21
+ Requires-Dist: defusedxml>=0.6.0
22
22
 
23
23
  DIDL-Lite (Digital Item Declaration Language) tools for Python
24
24
  ==============================================================
@@ -42,5 +42,3 @@ DIDL-Lite resources and documents:
42
42
  * `UPnP-av-ContentDirectory-v2-Service <http://upnp.org/specs/av/UPnP-av-ContentDirectory-v2-Service.pdf>`_
43
43
  * `didl-lite-v2.xsd <http://www.upnp.org/schemas/av/didl-lite-v2.xsd>`_
44
44
  * `mpeg21-didl <http://xml.coverpages.org/mpeg21-didl.html>`_
45
-
46
-
@@ -1094,7 +1094,13 @@ def from_xml_el(
1094
1094
  # construct item
1095
1095
  upnp_class = child_el.find("./upnp:class", NAMESPACES)
1096
1096
  if upnp_class is None or not upnp_class.text:
1097
- continue
1097
+ if strict:
1098
+ continue
1099
+ # WiiM Pro and possibly other Linkplay devices emit
1100
+ # upnp_class above the item element instead of inside it
1101
+ upnp_class = xml_el.find("./upnp:class", NAMESPACES)
1102
+ if upnp_class is None or not upnp_class.text:
1103
+ continue
1098
1104
  didl_object_type = type_by_upnp_class(upnp_class.text, strict)
1099
1105
  if didl_object_type is None:
1100
1106
  if strict:
@@ -1,12 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-didl-lite
3
- Version: 1.4.0
3
+ Version: 1.4.1
4
4
  Summary: DIDL-Lite (Digital Item Declaration Language) tools for Python
5
5
  Home-page: https://github.com/StevenLooman/python-didl-lite
6
6
  Author: Steven Looman
7
7
  Author-email: steven.looman@gmail.com
8
- License: UNKNOWN
9
- Platform: UNKNOWN
10
8
  Classifier: Development Status :: 5 - Production/Stable
11
9
  Classifier: Intended Audience :: Developers
12
10
  Classifier: License :: OSI Approved :: Apache Software License
@@ -16,9 +14,11 @@ Classifier: Programming Language :: Python :: 3.9
16
14
  Classifier: Programming Language :: Python :: 3.10
17
15
  Classifier: Programming Language :: Python :: 3.11
18
16
  Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
19
18
  Requires-Python: >=3.8
20
19
  Description-Content-Type: text/x-rst
21
20
  License-File: LICENSE.md
21
+ Requires-Dist: defusedxml>=0.6.0
22
22
 
23
23
  DIDL-Lite (Digital Item Declaration Language) tools for Python
24
24
  ==============================================================
@@ -42,5 +42,3 @@ DIDL-Lite resources and documents:
42
42
  * `UPnP-av-ContentDirectory-v2-Service <http://upnp.org/specs/av/UPnP-av-ContentDirectory-v2-Service.pdf>`_
43
43
  * `didl-lite-v2.xsd <http://www.upnp.org/schemas/av/didl-lite-v2.xsd>`_
44
44
  * `mpeg21-didl <http://xml.coverpages.org/mpeg21-didl.html>`_
45
-
46
-
@@ -23,7 +23,7 @@ TEST_REQUIRES = [
23
23
 
24
24
  setup(
25
25
  name="python-didl-lite",
26
- version="1.4.0",
26
+ version="1.4.1",
27
27
  description=DESCRIPTION,
28
28
  long_description=LONG_DESCRIPTION,
29
29
  long_description_content_type="text/x-rst",
@@ -40,6 +40,7 @@ setup(
40
40
  "Programming Language :: Python :: 3.10",
41
41
  "Programming Language :: Python :: 3.11",
42
42
  "Programming Language :: Python :: 3.12",
43
+ "Programming Language :: Python :: 3.13",
43
44
  ],
44
45
  packages=["didl_lite"],
45
46
  package_data={
@@ -654,3 +654,29 @@ class TestDidlLite:
654
654
  assert hasattr(item, "otherItem")
655
655
  assert not hasattr(item, "other_item")
656
656
  assert item.otherItem == "otherItem"
657
+
658
+ def test_item_improper_class_nesting(self) -> None:
659
+ """
660
+ Test item from XML that has upnp_class element above item.
661
+
662
+ Cater for WiiM Pro and possibly other Linkplay devices that
663
+ emit upnp_class above the item element instead of inside it
664
+ """
665
+ didl_string = """
666
+ <DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/"
667
+ xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"
668
+ xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/">
669
+ <upnp:class>object.item.audioItem.musicTrack</upnp:class>
670
+ <item id="0">
671
+ <res protocolInfo="protocol_info"></res>
672
+ <dc:title>Music Track Title</dc:title>
673
+ <dc:creator>Music Track Creator</dc:creator>
674
+ <upnp:artist>Artist</upnp:artist>
675
+ <upnp:album>Album</upnp:album>
676
+ </item>
677
+ </DIDL-Lite>"""
678
+ items = didl_lite.from_xml_string(didl_string, strict=False)
679
+ assert len(items) == 1
680
+
681
+ item = items[0]
682
+ assert isinstance(item, didl_lite.MusicTrack)