container parent default -1

This commit is contained in:
Igor Katson 2024-08-31 19:01:49 +01:00
parent 2d4b467055
commit 8ab3d4d428
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
2 changed files with 4 additions and 4 deletions

View file

@ -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()

View file

@ -70,7 +70,7 @@ pub mod browse {
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Item {
pub id: usize,
pub parent_id: Option<usize>,
pub parent_id: Option<isize>,
pub title: String,
pub mime_type: Option<mime_guess::Mime>,
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,