Les playlists suivent la lecture de leurs morceaux.

This commit is contained in:
2025-11-29 12:55:21 +01:00
parent 8f043a4d80
commit cf3f0afde4
16 changed files with 756 additions and 44 deletions

View File

@@ -376,11 +376,11 @@ mod tests {
cover: None,
rating: None,
extra: HashMap::new(),
gapless_url: todo!(),
sched_time_millis: todo!(),
song_id: todo!(),
artist_id: todo!(),
cover_large: todo!(),
gapless_url: Some("http://example.com/song.flac".into()),
sched_time_millis: Some(1_700_000_000_000),
song_id: Some("song-id".into()),
artist_id: Some("artist-id".into()),
cover_large: Some("cover-large.jpg".into()),
};
assert_eq!(song.end_time_ms(), 6000);

View File

@@ -126,9 +126,13 @@ impl RadioParadiseSource {
for pid in ids {
let weak = Arc::downgrade(self);
let pid_clone = pid.clone();
let token = mgr.register_callback(move |changed_id| {
let token = mgr.register_callback(move |event| {
let pid = pid_clone.clone();
if changed_id == pid {
if event.playlist_id == pid {
// On ne réagit qu'aux mises à jour structurelles (ajout/suppression)
if !matches!(event.kind, pmoplaylist::PlaylistEventKind::Updated) {
return;
}
if let Some(strong) = weak.upgrade() {
tokio::spawn(async move {
strong.bump_update_counter().await;
@@ -663,7 +667,7 @@ impl MusicSource for RadioParadiseSource {
}
}
ObjectIdType::HistoryTrack { slug, pk } => {
ObjectIdType::HistoryTrack { slug: _, pk: _ } => {
// Return metadata for the history track item
let item = self.get_item(object_id).await?;
Ok(BrowseResult::Items(vec![item]))