mirror of
https://github.com/danbee/mpd-client
synced 2025-03-04 08:39:09 +00:00
23 lines
523 B
JavaScript
23 lines
523 B
JavaScript
mpdClient.factory('api', function ($rootScope, $http, $resource) {
|
|
|
|
var apiUrl = '/api'
|
|
|
|
return {
|
|
sendCommand: function (command) {
|
|
$http({ method: 'PUT', url: apiUrl + '/control/' + command })
|
|
},
|
|
|
|
playTrack: function (pos) {
|
|
$http({ method: 'PUT', url: apiUrl + '/control/play', params: { pos: pos } })
|
|
},
|
|
|
|
getStatus: function () {
|
|
return $http({ method: 'GET', url: apiUrl + '/status' })
|
|
},
|
|
|
|
getQueue: function () {
|
|
return $resource(apiUrl + '/queue')
|
|
}
|
|
}
|
|
})
|