mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Check playing state before sending next/previous
This commit is contained in:
parent
693ce17c4d
commit
9ec70e76b0
@ -87,11 +87,11 @@ class MPDClient {
|
||||
|
||||
// Transport commands
|
||||
case .prevTrack:
|
||||
mpd_run_previous(connection)
|
||||
sendPreviousTrack()
|
||||
case .nextTrack:
|
||||
mpd_run_next(connection)
|
||||
sendNextTrack()
|
||||
case .stop:
|
||||
mpd_run_stop(connection)
|
||||
sendStop()
|
||||
case .playPause:
|
||||
sendPlay()
|
||||
|
||||
@ -103,6 +103,22 @@ class MPDClient {
|
||||
print(getLastErrorMessage()!)
|
||||
}
|
||||
|
||||
func sendNextTrack() {
|
||||
if getState() == .playing {
|
||||
mpd_run_next(connection)
|
||||
}
|
||||
}
|
||||
|
||||
func sendPreviousTrack() {
|
||||
if getState() == .playing {
|
||||
mpd_run_previous(connection)
|
||||
}
|
||||
}
|
||||
|
||||
func sendStop() {
|
||||
mpd_run_stop(connection)
|
||||
}
|
||||
|
||||
func sendPlay() {
|
||||
if getState() == .stopped {
|
||||
mpd_run_play(connection)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user