Implement parent_id=-1

This commit is contained in:
Igor Katson 2024-08-31 19:09:59 +01:00
parent 8ab3d4d428
commit 79a8451519
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
3 changed files with 10 additions and 10 deletions

View file

@ -25,7 +25,7 @@ async fn main() -> anyhow::Result<()> {
mime_type: Some(Mime::from_str("video/x-matroska")?),
url: "http://192.168.0.165:3030/torrents/4/stream/0/file.mkv".to_owned(),
id: 1,
parent_id: Some(0),
parent_id: 0,
})];
const HTTP_PORT: u16 = 9005;

View file

@ -70,7 +70,7 @@ pub mod browse {
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Item {
pub id: usize,
pub parent_id: Option<isize>,
pub parent_id: usize,
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(-1),
parent_id = item.parent_id,
mime_type = mime,
url = item.url,
upnp_class = upnp_class,
@ -115,7 +115,7 @@ pub mod browse {
"../resources/templates/content_directory/control/browse/container.tmpl.xml"
),
id = item.id,
parent_id = item.parent_id.unwrap_or(0),
parent_id = item.parent_id.map(|p| p as isize).unwrap_or(-1),
title = item.title,
childCountTag = child_count_tag
)