Dave Pickles wrote:
> > I cannot get this function to work; "/api/dvr/entry/stop" (
https://github.com/dave-p/TVH-API-docs/wiki/Dvr#dvrentrystop )
> >
> > Do you know what I am doing wrong? The api returns code 200, so you'd thought everything is ok, but running recording is not stopped. I use 'dvr/entry/cancel' to stop running recording, works ok, but I'm just wondering....
>
> Strange. I use that function to stop a running timer - see
https://github.com/dave-p/TVHadmin/blob/master/timers.php#L10
>
> Looking through the TVH code it seems the only way the function can return an error is if the uuid is not valid - none of the code for stopping the recording returns any status information so is assumed to have succeeded.
Well, thanks for checking it for me. I guess that explains why it returns 200... even though something is amiss. I cannot see what I do different than you, only thing is I check on dvrstatus to determine which command to use, whereas you check the time..... shouldn't matter, right? Here is my function, if you are interested (checking of the status is outside this function):
// NOT USED. Does not stop recording, even though returns 200
$scope.cancelScheduledRecording = function() {
var url = '/api/dvr/entry/stop';
var data = http_build_query({ "uuid": $scope.selectedEpgUnit['data']['dvrUuid'] });
var headers = {headers: {'Content-Type': 'application/x-www-form-urlencoded'}};
$http.post(url, data, headers)
.then(function (response)
{
if (response.data) {
$scope.updateAllChannelsEpg(); // TODO: should update just one, but must know rowIndex
var recordButton = document.getElementById('recordProgram');
var recordSeriesButton = document.getElementById('recordSeries');
recordButton.innerText = 'Record';
angular.element(recordSeriesButton).css("visibility", "visible");
$scope.showInfobox('Scheduled recording was canceled');
}
}, function (response)
{
alert('Sorry, an error occurred. API response was : "(' + response.status + ')"');
});
}