Fix bug in recoridng page
This commit is contained in:
parent
2177ef9814
commit
33209c3b33
@ -288,8 +288,9 @@
|
|||||||
fetch(this.apiBase + '/All', { headers: this.getHeaders() })
|
fetch(this.apiBase + '/All', { headers: this.getHeaders() })
|
||||||
.then(function(r) { return r.json(); })
|
.then(function(r) { return r.json(); })
|
||||||
.then(function(recordings) {
|
.then(function(recordings) {
|
||||||
|
var activeStates = ['Scheduled', 'WaitingForStream', 'Recording', 0, 1, 2];
|
||||||
var active = recordings.filter(function(r) {
|
var active = recordings.filter(function(r) {
|
||||||
return r.state === 0 || r.state === 1 || r.state === 2;
|
return activeStates.indexOf(r.state) !== -1;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (active.length === 0) {
|
if (active.length === 0) {
|
||||||
@ -297,8 +298,8 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var stateLabels = {0: 'Scheduled', 1: 'Waiting', 2: 'Recording', 3: 'Completed', 4: 'Failed', 5: 'Cancelled'};
|
var stateLabels = {'Scheduled': 'Scheduled', 'WaitingForStream': 'Waiting', 'Recording': 'Recording', 'Completed': 'Completed', 'Failed': 'Failed', 'Cancelled': 'Cancelled', 0: 'Scheduled', 1: 'Waiting', 2: 'Recording', 3: 'Completed', 4: 'Failed', 5: 'Cancelled'};
|
||||||
var stateColors = {0: '#2196F3', 1: '#FF9800', 2: '#4CAF50', 4: '#f44336', 5: '#9E9E9E'};
|
var stateColors = {'Scheduled': '#2196F3', 'WaitingForStream': '#FF9800', 'Recording': '#4CAF50', 'Failed': '#f44336', 'Cancelled': '#9E9E9E', 0: '#2196F3', 1: '#FF9800', 2: '#4CAF50', 4: '#f44336', 5: '#9E9E9E'};
|
||||||
|
|
||||||
var html = '<table style="width:100%; border-collapse: collapse;">';
|
var html = '<table style="width:100%; border-collapse: collapse;">';
|
||||||
html += '<thead><tr style="text-align:left; border-bottom: 1px solid #444;">';
|
html += '<thead><tr style="text-align:left; border-bottom: 1px solid #444;">';
|
||||||
@ -314,7 +315,7 @@
|
|||||||
html += '<td style="padding: 8px;"><span style="color:' + (stateColors[r.state] || '#fff') + ';">' + (stateLabels[r.state] || r.state) + '</span></td>';
|
html += '<td style="padding: 8px;"><span style="color:' + (stateColors[r.state] || '#fff') + ';">' + (stateLabels[r.state] || r.state) + '</span></td>';
|
||||||
html += '<td style="padding: 8px;">' + SRFPlayRecordings.formatDate(r.validFrom) + '</td>';
|
html += '<td style="padding: 8px;">' + SRFPlayRecordings.formatDate(r.validFrom) + '</td>';
|
||||||
html += '<td style="padding: 8px;">';
|
html += '<td style="padding: 8px;">';
|
||||||
if (r.state === 2) {
|
if (r.state === 2 || r.state === 'Recording') {
|
||||||
html += '<button is="emby-button" type="button" class="raised emby-button" ';
|
html += '<button is="emby-button" type="button" class="raised emby-button" ';
|
||||||
html += 'onclick="SRFPlayRecordings.stopRecording(\'' + r.id + '\')"><span>Stop</span></button>';
|
html += 'onclick="SRFPlayRecordings.stopRecording(\'' + r.id + '\')"><span>Stop</span></button>';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user