1
1
mirror of https://github.com/danbee/persephone synced 2025-03-04 08:39:11 +00:00
persephone/Persephone/MPDClient/Extensions/MPDClient+Command.swift
Dan Barber fe748e2c61
WIP: Refactor MPDClient
This should make handling the queuing side work more reliably.
2019-03-20 20:06:23 -04:00

46 lines
922 B
Swift

//
// CommandQueue.swift
// Persephone
//
// Created by Daniel Barber on 2019/3/15.
// Copyright © 2019 Dan Barber. All rights reserved.
//
import Foundation
extension MPDClient {
func sendCommand(
command: Command,
userData: Dictionary<String, Any> = [:]
) {
switch command {
// Transport commands
case .prevTrack:
sendPreviousTrack()
case .nextTrack:
sendNextTrack()
case .stop:
sendStop()
case .playPause:
sendPlay()
// Status commands
case .fetchStatus:
sendRunStatus()
case .fetchQueue:
sendFetchQueue()
// Album commands
case .fetchAllAlbums:
allAlbums()
case .playAlbum:
guard let album = userData["album"] as? Album else { return }
sendPlayAlbum(album)
case .getAlbumURI:
guard let album = userData["album"] as? Album else { return }
_ = getAlbumURI(for: album)
}
}
}