Provide a keyboard shortcut to pull all release groups of an artist #233
@ -140,32 +140,27 @@ impl AppMachine<FetchState> {
|
||||
}
|
||||
|
||||
pub fn app_fetch_next(inner: AppInner, mut fetch: FetchState) -> App {
|
||||
match fetch.try_recv() {
|
||||
loop {
|
||||
let app: App = match fetch.try_recv() {
|
||||
Ok(fetch_result) => match fetch_result {
|
||||
Ok(retval) => Self::handle_mb_api_return(inner, fetch, retval),
|
||||
Ok(MbReturn::Match(next_match)) => {
|
||||
AppMachine::match_state(inner, MatchState::new(next_match, fetch)).into()
|
||||
}
|
||||
Ok(MbReturn::Fetch(_)) => continue,
|
||||
Err(fetch_err) => {
|
||||
AppMachine::error_state(inner, format!("fetch failed: {fetch_err}")).into()
|
||||
}
|
||||
},
|
||||
Err(recv_err) => match recv_err {
|
||||
TryRecvError::Empty => AppMachine::fetch_state(inner, fetch).into(),
|
||||
TryRecvError::Disconnected => {
|
||||
Err(TryRecvError::Empty) => AppMachine::fetch_state(inner, fetch).into(),
|
||||
Err(TryRecvError::Disconnected) => {
|
||||
if fetch.fetch_rx.is_some() {
|
||||
AppMachine::browse_state(inner).into()
|
||||
} else {
|
||||
Self::app_fetch_new(inner)
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_mb_api_return(inner: AppInner, fetch: FetchState, retval: MbReturn) -> App {
|
||||
match retval {
|
||||
MbReturn::Match(next_match) => {
|
||||
AppMachine::match_state(inner, MatchState::new(next_match, fetch)).into()
|
||||
}
|
||||
MbReturn::Fetch(_) => Self::app_fetch_next(inner, fetch),
|
||||
};
|
||||
return app;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user