Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Apply DB metadata only for loaded tracks

Only fall back to database metadata when track.length > 0.
This avoids clients interpreting an elapsed=0 with a valid title
as started from the beginning and overriding the saved resume
position while the audio engine is still initializing.

+19 -11
+19 -11
crates/server/src/lib.rs
··· 345 345 track.album_art = album_art; 346 346 track.album_id = Some(metadata.album_id); 347 347 track.artist_id = Some(metadata.artist_id); 348 - if track.title.is_empty() { 349 - track.title = metadata.title.clone(); 350 - } 351 - if track.artist.is_empty() { 352 - track.artist = metadata.artist.clone(); 353 - } 354 - if track.album.is_empty() { 355 - track.album = metadata.album.clone(); 356 - } 357 - if track.album_artist.is_empty() { 358 - track.album_artist = metadata.album_artist.clone(); 348 + // Only fall back to DB metadata when the live Mp3Entry fields 349 + // are empty but the track is fully loaded (non-zero length). 350 + // If length is 0 the audio engine hasn't finished initialising 351 + // yet; leave the track unchanged so clients don't interpret 352 + // an elapsed=0 / valid-title combination as "started from the 353 + // beginning" and override the resume position. 354 + if track.length > 0 { 355 + if track.title.is_empty() { 356 + track.title = metadata.title.clone(); 357 + } 358 + if track.artist.is_empty() { 359 + track.artist = metadata.artist.clone(); 360 + } 361 + if track.album.is_empty() { 362 + track.album = metadata.album.clone(); 363 + } 364 + if track.album_artist.is_empty() { 365 + track.album_artist = metadata.album_artist.clone(); 366 + } 359 367 } 360 368 SimpleBroker::publish(track.clone()); 361 369