1
0
mirror of https://github.com/danbee/mpd-client synced 2025-03-04 08:39:09 +00:00
mpd-client/assets/js/controllers/transport.controller.js

18 lines
456 B
JavaScript

mpdClient.controller('transport', function ($rootScope, $scope, $http) {
var Status = $http({ method: 'GET', url: '/api/status' })
$rootScope.status = { time: [] }
Status.success(function (data, status, headers, config) {
$rootScope.status = data
})
$scope.sendCommand = function (command) {
$http({ method: 'PUT', url: '/api/control/' + command })
}
$scope.playing = function () {
return $scope.status.state == 'play'
}
})