update timer listings

This commit is contained in:
Luke Pulverenti 2016-10-04 01:15:39 -04:00
parent c2290dd41d
commit cf3aa152cf
39 changed files with 368 additions and 287 deletions

View file

@ -117,7 +117,7 @@
parent.querySelector('.seriesRecordingButton .buttonText').innerHTML = globalize.translate('sharedcomponents#RecordSeries');
}
if (program.TimerId) {
if (program.TimerId && program.TimerStatus != 'Cancelled') {
parent.querySelector('.btnManageRecording').classList.remove('visibilityHide');
parent.querySelector('.singleRecordingButton .recordingIcon').classList.add('recordingIcon-active');
parent.querySelector('.singleRecordingButton .buttonText').innerHTML = globalize.translate('sharedcomponents#DoNotRecord');
@ -138,6 +138,7 @@
return apiClient.getLiveTvProgram(options.programId, apiClient.getCurrentUserId()).then(function (program) {
instance.TimerId = program.TimerId;
instance.TimerStatus = program.TimerStatus;
instance.SeriesTimerId = program.SeriesTimerId;
loadData(options.parent, program, apiClient);
@ -161,7 +162,7 @@
var options = this.options;
if (!this.TimerId) {
if (!this.TimerId || this.TimerStatus == 'Cancelled') {
return;
}
@ -212,8 +213,10 @@
var button = dom.parentWithTag(e.target, 'BUTTON');
var isChecked = !button.querySelector('i').classList.contains('recordingIcon-active');
var hasEnabledTimer = this.TimerId && this.TimerStatus != 'Cancelled';
if (isChecked) {
if (!this.TimerId) {
if (!hasEnabledTimer) {
loading.show();
recordingHelper.createRecording(apiClient, options.programId, false).then(function () {
events.trigger(self, 'recordingchanged');
@ -222,7 +225,7 @@
});
}
} else {
if (this.TimerId) {
if (hasEnabledTimer) {
loading.show();
recordingHelper.cancelTimer(apiClient, this.TimerId, true).then(function () {
events.trigger(self, 'recordingchanged');

View file

@ -59,16 +59,18 @@
});
}
function toggleRecording(serverId, programId, timerId, seriesTimerId) {
function toggleRecording(serverId, programId, timerId, timerStatus, seriesTimerId) {
var apiClient = connectionManager.getApiClient(serverId);
if (seriesTimerId && timerId) {
var hasTimer = timerId && timerStatus != 'Cancelled';
if (seriesTimerId && hasTimer) {
// cancel
return cancelTimer(apiClient, timerId, true);
} else if (timerId && programId) {
} else if (hasTimer && programId) {
// change to series recording, if possible
// otherwise cancel individual recording