Refresh env, add aiohttp dep, improve resource selection and GStreamer flags

This commit is contained in:
Matteo Benedetto
2026-03-22 12:32:40 +01:00
parent 6fc467127c
commit 193e914ffd
11 changed files with 242 additions and 32 deletions
+17
View File
@@ -79,6 +79,23 @@ class TestParseDIDL:
items = _parse_didl(didl, "http://myserver:8200")
assert items[0].resource_url == "http://myserver:8200/media/track.flac"
def test_prefers_video_resource_over_subtitle_resource(self):
didl = """\
<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">
<item id="400" parentID="1">
<dc:title>Movie</dc:title>
<upnp:class>object.item.videoItem</upnp:class>
<res protocolInfo="http-get:*:text/vtt:*">http://srv/movie.vtt</res>
<res protocolInfo="http-get:*:video/x-matroska:*" size="999">http://srv/movie.mkv</res>
</item>
</DIDL-Lite>
"""
items = _parse_didl(didl, "http://srv")
assert items[0].resource_url == "http://srv/movie.mkv"
assert items[0].mime_type == "video/x-matroska"
class TestExtractBrowseResult:
def test_extracts_unnamespaced_result(self):
+21
View File
@@ -98,6 +98,27 @@ class TestParseDIDLItem:
item = parse_didl_item(didl)
assert item.resource_url == "http://srv/vid.mp4"
def test_prefers_media_resource_over_subtitle_resource(self):
didl = {
"id": "3",
"title": "Movie",
"upnp_class": "object.item.videoItem",
"resources": [
{
"url": "http://srv/movie.srt",
"protocol_info": "http-get:*:text/srt:*",
},
{
"url": "http://srv/movie.mkv",
"protocol_info": "http-get:*:video/x-matroska:*",
"size": "1200",
},
],
}
item = parse_didl_item(didl)
assert item.resource_url == "http://srv/movie.mkv"
assert item.mime_type == "http-get:*:video/x-matroska:*"
def test_alt_key_names(self):
"""Handles alternative key formats (@id, @parentID, class, etc.)."""
didl = {