Make sure that we are connected when sending commands to MPD

There was a bug that prevented using the app after the first minute,
since MPD shut down the connection and nobody reconnected.
develop
LEdoian 3 years ago
parent 1b4f943dc3
commit 3859437e7f

@ -21,6 +21,8 @@ namespace QuickPlay
} } } }
public async Task Play(IPlayable song) public async Task Play(IPlayable song)
{ {
// Make sure we are connected
await this.ConnectAsync();
await mpd.SendAsync(new MpcCore.Commands.Player.Stop()); await mpd.SendAsync(new MpcCore.Commands.Player.Stop());
await SetReasonableOptions(); await SetReasonableOptions();
await mpd.SendAsync(new MpcCore.Commands.Queue.ClearQueue()); await mpd.SendAsync(new MpcCore.Commands.Queue.ClearQueue());
@ -29,6 +31,8 @@ namespace QuickPlay
} }
public async Task SetReasonableOptions() public async Task SetReasonableOptions()
{ {
// Make sure we are connected
await this.ConnectAsync();
await mpd.SendAsync(new MpcCore.Commands.Options.SetConsume(true)); await mpd.SendAsync(new MpcCore.Commands.Options.SetConsume(true));
await mpd.SendAsync(new MpcCore.Commands.Options.SetRandom(false)); await mpd.SendAsync(new MpcCore.Commands.Options.SetRandom(false));
await mpd.SendAsync(new MpcCore.Commands.Options.SetRepeat(false)); await mpd.SendAsync(new MpcCore.Commands.Options.SetRepeat(false));

File diff suppressed because it is too large Load Diff

@ -109,7 +109,7 @@ Planned Features
Bugs Bugs
--- ---
- [ ] The MpcCore client seems to disconnect after some time for no apparent reason. None currently known :-)
The far future The far future
--- ---

Loading…
Cancel
Save