push-pqqsxyupswry #21

Merged
eric merged 76 commits from push-pqqsxyupswry into main 2025-12-06 12:49:47 +01:00
4 changed files with 60 additions and 2 deletions
Showing only changes of commit 996a2096d0 - Show all commits

3
.gitignore vendored
View File

@@ -39,4 +39,5 @@ upmpdcli/
test_upnp*.cargo/
.cargo/
setup-env.sh
cache
cache
gupnp-tools

View File

@@ -0,0 +1,49 @@
use pmodidl::{DIDLLite, Item, Resource};
fn main() {
let item1 = Item {
id: "test1".to_string(),
parent_id: "root".to_string(),
restricted: Some("1".to_string()),
title: "Test Song".to_string(),
creator: Some("Test Artist".to_string()),
class: "object.item.audioItem.musicTrack".to_string(),
artist: Some("Test Artist".to_string()),
album: None, // Pas d'album
genre: None,
album_art: None, // Pas d'albumArtURI
album_art_pk: None,
date: None,
original_track_number: None,
resources: vec![Resource {
protocol_info: "http-get:*:audio/flac:*".to_string(),
bits_per_sample: Some("16".to_string()),
sample_frequency: Some("44100".to_string()),
nr_audio_channels: Some("2".to_string()),
duration: Some("0:03:00".to_string()),
url: "http://example.com/test.flac".to_string(),
}],
descriptions: vec![],
};
let didl = DIDLLite {
xmlns: "urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/".to_string(),
xmlns_upnp: Some("urn:schemas-upnp-org:metadata-1-0/upnp/".to_string()),
xmlns_dc: Some("http://purl.org/dc/elements/1.1/".to_string()),
xmlns_dlna: Some("urn:schemas-dlna-org:metadata-1-0/".to_string()),
xmlns_pv: None,
xmlns_sec: None,
containers: vec![],
items: vec![item1],
};
let xml = quick_xml::se::to_string(&didl).expect("Serialization failed");
println!("=== Output from quick_xml::se::to_string() ===");
println!("{}", xml);
println!("\n=== Length: {} bytes ===", xml.len());
println!("\n=== Starts with '<?xml' ? {} ===", xml.starts_with("<?xml"));
println!("\n=== With manual XML declaration ===");
let with_decl = format!("<?xml version=\"1.0\" encoding=\"UTF-8\"?>{}", xml);
println!("{}", with_decl);
}

View File

@@ -309,6 +309,14 @@ impl RadioParadiseSource {
}
}
}
// Fix: Ajouter un genre par défaut si absent
// Certains clients UPnP (comme gupnp-av-cp) requièrent le champ <upnp:genre>
// pour parser correctement les items de classe musicTrack, même si ce champ
// est optionnel selon la spec UPnP ContentDirectory.
if item.genre.is_none() {
item.genre = Some("Radio Paradise".to_string());
}
}
Ok(items)

View File

@@ -15,7 +15,7 @@
set -e
# Valeurs par défaut
CONTROL_URL="http://localhost:8080/device/88b84e76-4de0-4ee6-b794-99cc4a278cc9/service/ContentDirectory/control"
CONTROL_URL="http://localhost:8080/device/63623ff4-ee41-4850-90aa-2d39395df981/service/ContentDirectory/control"
OBJECT_ID="0"
BROWSE_FLAG="BrowseDirectChildren"
STARTING_INDEX=0