WEBUI JS: Add back the download button for finished recordings

This commit is contained in:
Jaroslav Kysela 2014-09-05 17:04:25 +02:00
parent 7c4ff817b3
commit 3faeb82e88
3 changed files with 35 additions and 5 deletions

View file

@ -90,7 +90,7 @@ tvheadend.dvr_upcoming = function(panel, index) {
name: 'abort',
builder: function() {
return new Ext.Toolbar.Button({
tooltip: 'Abort selected recording',
tooltip: 'Abort the selected recording',
iconCls: 'cancel',
text: 'Abort',
disabled: true,
@ -176,6 +176,30 @@ tvheadend.dvr_finished = function(panel, index) {
var actions = tvheadend.dvrRowActions();
var downloadButton = {
name: 'download',
builder: function() {
return new Ext.Toolbar.Button({
tooltip: 'Download the selected recording',
iconCls: 'save',
text: 'Download',
disabled: true
});
},
callback: function(conf, e, store, select) {
var r = select.getSelections();
if (r.length > 0) {
var url = r[0].data.url;
window.location = url;
}
}
};
function selected(s, abuttons) {
var count = s.getCount();
abuttons.download.setDisabled(count < 1);
}
tvheadend.idnode_grid(panel, {
url: 'api/dvr/entry',
gridURL: 'api/dvr/entry/grid_finished',
@ -187,7 +211,7 @@ tvheadend.dvr_finished = function(panel, index) {
del: true,
list: 'disp_title,episode,start_real,stop_real,' +
'duration,filesize,channelname,creator,' +
'sched_status',
'sched_status,url',
sort: {
field: 'start',
direction: 'DESC'
@ -206,6 +230,8 @@ tvheadend.dvr_finished = function(panel, index) {
'?title=' + encodeURIComponent(title) + '">Play</a>';
}
}],
tbar: [downloadButton],
selected: selected,
help: function() {
new tvheadend.help('DVR', 'config_dvr.html');
},

View file

@ -1175,7 +1175,8 @@ tvheadend.idnode_grid = function(panel, conf)
}
abuttons[t.name] = b;
buttons.push(b);
}
} else if (t.name)
buttons.push(t.name);
}
}
@ -1479,7 +1480,8 @@ tvheadend.idnode_form_grid = function(panel, conf)
}
abuttons[t.name] = b;
buttons.push(b);
}
} else if (t.name)
buttons.push(t.name);
}
}

View file

@ -1125,7 +1125,9 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque)
pthread_mutex_lock(&global_lock);
de = dvr_entry_find_by_id(atoi(remain));
de = dvr_entry_find_by_uuid(remain);
if (de == NULL)
de = dvr_entry_find_by_id(atoi(remain));
if(de == NULL || de->de_filename == NULL) {
pthread_mutex_unlock(&global_lock);
return 404;