Open PoKnow opened 3 years ago
This happens because the general TUI uses a different code than the CLI. The TUI uses this handler
pub fn previous_track(&mut self) {
if self.song_progress_ms >= 3_000 {
self.dispatch(IoEvent::Seek(0));
} else {
self.dispatch(IoEvent::PreviousTrack);
}
}
And the CLI communicates directly with the Spotify Library to straight go to the previous track (notice there's no IF for the three seconds)
async fn previous_track(&mut self) {
match self
.spotify
.previous_track(self.client_config.device_id.clone())
.await
{
Ok(()) => {
self.get_current_playback().await;
}
Err(e) => {
self.handle_error(anyhow!(e)).await;
}
};
}
What we would have to do is to fetch first the current song progress in the CLI process, and then do the same validation to check if three seconds have passed or not. That can be achieved by using current_playing
method from RSpotify, get the song timestamp and do the same validation. Does that make sense? @Rigellute
"spt playback -p" does not go back to back to the beginning of the song. Instead it tires to go back to the previous song (acting like "-pp")
UI 'p' works as expected.