Amélioration de l'affichage des artistes et correction des parent_id dans les listes de lecture
Cette mise à jour corrige l'affichage des artistes dans les pistes musicales en évitant les duplications avec le nom de la station. Elle ajuste également les identifiants parents des éléments dans les listes de lecture pour une meilleure organisation hiérarchique. Les modifications affectent les fichiers playlist.rs et source.rs.
This commit is contained in:
@@ -417,13 +417,26 @@ impl StationPlaylist {
|
||||
if let Some(ref song) = now.song {
|
||||
// Radio musicale avec morceau
|
||||
let title = now.first_line.title_or_default().to_string();
|
||||
let artist = if song.interpreters.is_empty() {
|
||||
let song_artist = if song.interpreters.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(song.artists_display())
|
||||
};
|
||||
|
||||
// Artist affiché = "Station - Artiste du morceau" pour identifier la radio
|
||||
// Éviter la duplication si l'artiste est égal au nom de la station
|
||||
let artist = if let Some(ref art) = song_artist {
|
||||
if art != &station.name && art != station.display_name() {
|
||||
Some(format!("{} - {}", station.display_name(), art))
|
||||
} else {
|
||||
Some(station.display_name().to_string())
|
||||
}
|
||||
} else {
|
||||
Some(station.display_name().to_string())
|
||||
};
|
||||
|
||||
let album = song.release.title.clone();
|
||||
let creator = artist.clone();
|
||||
let creator = song_artist; // Creator reste l'artiste du morceau pour compatibilité
|
||||
let genre = Some("Music".to_string());
|
||||
let class = "object.item.audioItem.musicTrack".to_string();
|
||||
|
||||
@@ -448,11 +461,14 @@ impl StationPlaylist {
|
||||
};
|
||||
|
||||
// Artist/Creator = "{Station} - {Subtitle}"
|
||||
let artist = if !second.is_empty() {
|
||||
Some(format!("{} - {}", station.name, second))
|
||||
} else {
|
||||
Some(station.name.clone())
|
||||
};
|
||||
// Éviter la duplication si subtitle == nom de la station
|
||||
let artist =
|
||||
if !second.is_empty() && second != station.name && second != station.display_name()
|
||||
{
|
||||
Some(format!("{} - {}", station.name, second))
|
||||
} else {
|
||||
Some(station.name.clone())
|
||||
};
|
||||
let creator = artist.clone();
|
||||
// Album = nom de l'émission principale
|
||||
let album = if !first.is_empty() {
|
||||
|
||||
@@ -488,17 +488,26 @@ impl MusicSource for RadioFranceSource {
|
||||
.ok_or_else(|| MusicSourceError::ObjectNotFound(id.to_string()))?;
|
||||
|
||||
// Build items for this group only (main + webradios)
|
||||
let mut items = vec![self
|
||||
let group_id = format!("radiofrance:group:{}", slug);
|
||||
|
||||
let mut main_item = self
|
||||
.build_station_item(&group.main)
|
||||
.await
|
||||
.map_err(|e| MusicSourceError::BrowseError(e.to_string()))?];
|
||||
.map_err(|e| MusicSourceError::BrowseError(e.to_string()))?;
|
||||
|
||||
// Fix parent_id to point to the group container
|
||||
main_item.parent_id = group_id.clone();
|
||||
let mut items = vec![main_item];
|
||||
|
||||
for webradio in &group.webradios {
|
||||
items.push(
|
||||
self.build_station_item(webradio)
|
||||
.await
|
||||
.map_err(|e| MusicSourceError::BrowseError(e.to_string()))?,
|
||||
);
|
||||
let mut item = self
|
||||
.build_station_item(webradio)
|
||||
.await
|
||||
.map_err(|e| MusicSourceError::BrowseError(e.to_string()))?;
|
||||
|
||||
// Fix parent_id to point to the group container
|
||||
item.parent_id = group_id.clone();
|
||||
items.push(item);
|
||||
}
|
||||
|
||||
Ok(BrowseResult::Items(items))
|
||||
@@ -514,11 +523,14 @@ impl MusicSource for RadioFranceSource {
|
||||
// Build items for local radios only
|
||||
let mut items = Vec::new();
|
||||
for station in &groups.local_radios {
|
||||
items.push(
|
||||
self.build_station_item(station)
|
||||
.await
|
||||
.map_err(|e| MusicSourceError::BrowseError(e.to_string()))?,
|
||||
);
|
||||
let mut item = self
|
||||
.build_station_item(station)
|
||||
.await
|
||||
.map_err(|e| MusicSourceError::BrowseError(e.to_string()))?;
|
||||
|
||||
// Fix parent_id to point to the ICI container
|
||||
item.parent_id = "radiofrance:ici".to_string();
|
||||
items.push(item);
|
||||
}
|
||||
|
||||
Ok(BrowseResult::Items(items))
|
||||
|
||||
Reference in New Issue
Block a user