mirror of
https://github.com/ivabus/lonelyradio
synced 2024-11-21 15:45:09 +03:00
Fix monoclient-s playlist requests
Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
This commit is contained in:
parent
5d9179e5df
commit
60791dc292
1 changed files with 23 additions and 20 deletions
|
@ -174,33 +174,36 @@ pub fn main() {
|
||||||
let addr = window.get_addr().to_string();
|
let addr = window.get_addr().to_string();
|
||||||
if addr.contains(':') {
|
if addr.contains(':') {
|
||||||
window.set_start_enabled(true);
|
window.set_start_enabled(true);
|
||||||
|
|
||||||
let playlists = match monolib::list_playlists(&window.get_addr()) {
|
|
||||||
Some(v) => [vec!["All tracks".to_string()], v].concat(),
|
|
||||||
None => vec!["All tracks".to_string()],
|
|
||||||
};
|
|
||||||
window.set_playlists(ModelRc::new(VecModel::from(
|
|
||||||
playlists.iter().map(SharedString::from).collect::<Vec<_>>(),
|
|
||||||
)));
|
|
||||||
} else {
|
} else {
|
||||||
window.set_start_enabled(false);
|
window.set_start_enabled(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let window_weak = window.as_weak();
|
let window_weak = window.as_weak();
|
||||||
window.on_play(move || match monolib::get_state() {
|
window.on_play(move || {
|
||||||
State::NotStarted => start_playback(window_weak.clone()),
|
match monolib::get_state() {
|
||||||
State::Paused => {
|
State::NotStarted => start_playback(window_weak.clone()),
|
||||||
let window = window_weak.upgrade().unwrap();
|
State::Paused => {
|
||||||
window.set_paused(false);
|
let window = window_weak.upgrade().unwrap();
|
||||||
monolib::toggle();
|
window.set_paused(false);
|
||||||
}
|
monolib::toggle();
|
||||||
State::Resetting => {}
|
}
|
||||||
State::Playing => {
|
State::Resetting => {}
|
||||||
let window = window_weak.upgrade().unwrap();
|
State::Playing => {
|
||||||
window.set_paused(true);
|
let window = window_weak.upgrade().unwrap();
|
||||||
monolib::toggle()
|
window.set_paused(true);
|
||||||
|
monolib::toggle()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
let window = window_weak.upgrade().unwrap();
|
||||||
|
|
||||||
|
let playlists = match monolib::list_playlists(&window.get_addr()) {
|
||||||
|
Some(v) => [vec!["All tracks".to_string()], v].concat(),
|
||||||
|
None => vec!["All tracks".to_string()],
|
||||||
|
};
|
||||||
|
window.set_playlists(ModelRc::new(VecModel::from(
|
||||||
|
playlists.iter().map(SharedString::from).collect::<Vec<_>>(),
|
||||||
|
)));
|
||||||
});
|
});
|
||||||
|
|
||||||
let window_weak = window.as_weak();
|
let window_weak = window.as_weak();
|
||||||
|
|
Loading…
Reference in a new issue