UPNP: add size attribute

This commit is contained in:
Igor Katson 2024-09-02 12:04:50 +01:00
parent bf910d39f2
commit ff7924ff78
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
4 changed files with 14 additions and 5 deletions

View file

@ -26,6 +26,7 @@ async fn main() -> anyhow::Result<()> {
url: "http://192.168.0.165:3030/torrents/4/stream/0/file.mkv".to_owned(),
id: 1,
parent_id: 0,
size: 1,
})];
const HTTP_PORT: u16 = 9005;

View file

@ -1,5 +1,5 @@
<item id="{id}" parentID="{parent_id}" restricted="true">
<dc:title>{title}</dc:title>
<upnp:class>{upnp_class}</upnp:class>
<res protocolInfo="http-get:*:{mime_type}:DLNA.ORG_OP=01">{url}</res>
<res protocolInfo="http-get:*:{mime_type}:DLNA.ORG_OP=01" size="{size}">{url}</res>
</item>

View file

@ -76,6 +76,7 @@ pub mod browse {
pub title: String,
pub mime_type: Option<mime_guess::Mime>,
pub url: String,
pub size: u64,
}
#[derive(Debug, Clone, PartialEq, Eq)]
@ -103,7 +104,8 @@ pub mod browse {
mime_type = mime,
url = item.url,
upnp_class = upnp_class,
title = item.title
title = item.title,
size = item.size
))
}