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
|
// Transport commands
|
||||||
case .prevTrack:
|
case .prevTrack:
|
||||||
mpd_run_previous(connection)
|
sendPreviousTrack()
|
||||||
case .nextTrack:
|
case .nextTrack:
|
||||||
mpd_run_next(connection)
|
sendNextTrack()
|
||||||
case .stop:
|
case .stop:
|
||||||
mpd_run_stop(connection)
|
sendStop()
|
||||||
case .playPause:
|
case .playPause:
|
||||||
sendPlay()
|
sendPlay()
|
||||||
|
|
||||||
@ -103,6 +103,22 @@ class MPDClient {
|
|||||||
print(getLastErrorMessage()!)
|
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() {
|
func sendPlay() {
|
||||||
if getState() == .stopped {
|
if getState() == .stopped {
|
||||||
mpd_run_play(connection)
|
mpd_run_play(connection)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user