Handle playlist fetching signalling better
This commit is contained in:
parent
9c4914178d
commit
1b37071836
2 changed files with 4 additions and 1 deletions
|
@ -55,7 +55,7 @@ impl Player {
|
|||
PlayerEvent::FFTBins(bins) => self.tui_root.metadata.update_spectrogram(bins),
|
||||
}
|
||||
}
|
||||
if self.playlist.last_song() {
|
||||
if self.playlist.last_song() && !self.playlist.fetch_queued {
|
||||
self.api_chan.send(APIEvent::FetchRandom)?;
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
@ -4,6 +4,7 @@ use crate::ssonic::response::Song;
|
|||
|
||||
pub struct Playlist {
|
||||
song_list: VecDeque<Song>,
|
||||
pub fetch_queued: bool,
|
||||
}
|
||||
|
||||
impl Playlist {
|
||||
|
@ -17,11 +18,13 @@ impl Playlist {
|
|||
|
||||
pub fn append(&mut self, list: Vec<Song>) {
|
||||
self.song_list.append(VecDeque::from(list).borrow_mut());
|
||||
self.fetch_queued = false;
|
||||
}
|
||||
|
||||
pub fn new() -> Playlist {
|
||||
Playlist {
|
||||
song_list: VecDeque::new(),
|
||||
fetch_queued: true, // handle initial fetch outside this struct
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue