]> git.seodisparate.com - mpd_info_screen/commitdiff
Fix get current_song_pos in shared
authorStephen Seo <seo.disparate@gmail.com>
Thu, 16 Dec 2021 02:10:10 +0000 (11:10 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Thu, 16 Dec 2021 02:10:10 +0000 (11:10 +0900)
When polling for the shared data, the position of the song now accounts
for when the position was polled (using an Instant object set to "now()"
on poll, and returning the position with the Instant's elapsed time).

src/mpd_handler.rs

index f97f10eba5ba5a0e0009dbc43c4dd53a920f1c46..b2bac32a6a99bc2c47e85054257bf5ee9aeccf50 100644 (file)
@@ -296,7 +296,8 @@ impl MPDHandler {
                 title: read_lock.current_song_title.clone(),
                 artist: read_lock.current_song_artist.clone(),
                 length: read_lock.current_song_length,
-                pos: read_lock.current_song_position,
+                pos: read_lock.current_song_position
+                    + read_lock.song_pos_get_time.elapsed().as_secs_f64(),
                 error_text: read_lock.error_text.clone(),
             });
         }