diff --git a/crates/librqbit/src/upnp_server_adapter.rs b/crates/librqbit/src/upnp_server_adapter.rs index 646a920..3128930 100644 --- a/crates/librqbit/src/upnp_server_adapter.rs +++ b/crates/librqbit/src/upnp_server_adapter.rs @@ -74,7 +74,7 @@ impl TorrentFileTreeNode { .unwrap_or_else(|| self.title.clone()); ItemOrContainer::Item(Item { id: encoded_id, - parent_id: encoded_parent_id, + parent_id: encoded_parent_id.map(|id| id as isize), title: self.title.clone(), mime_type: mime_guess::from_path(filename).first(), url: format!( @@ -600,7 +600,7 @@ mod tests { adapter.browse_direct_children(encode_id(1, 1), "127.0.0.1"), vec![ItemOrContainer::Item(Item { id: encode_id(2, 1), - parent_id: Some(encode_id(1, 1)), + parent_id: Some(encode_id(1, 1) as isize), title: "f2".into(), mime_type: None, url: "http://127.0.0.1:9005/torrents/1/stream/0/d1/f2".into() diff --git a/crates/upnp-serve/src/services/content_directory.rs b/crates/upnp-serve/src/services/content_directory.rs index 034e9a6..515a7ef 100644 --- a/crates/upnp-serve/src/services/content_directory.rs +++ b/crates/upnp-serve/src/services/content_directory.rs @@ -70,7 +70,7 @@ pub mod browse { #[derive(Debug, Clone, PartialEq, Eq)] pub struct Item { pub id: usize, - pub parent_id: Option, + pub parent_id: Option, pub title: String, pub mime_type: Option, pub url: String, @@ -97,7 +97,7 @@ pub mod browse { "../resources/templates/content_directory/control/browse/item.tmpl.xml" ), id = item.id, - parent_id = item.parent_id.unwrap_or(0), + parent_id = item.parent_id.unwrap_or(-1), mime_type = mime, url = item.url, upnp_class = upnp_class,