Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Web EPG: more DVR icon cleanups, added possibility to delete schedule…
…d recording
  • Loading branch information
perexg committed May 6, 2015
1 parent d9ca940 commit ea9cd4c
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/api/api_epg.c
Expand Up @@ -533,7 +533,7 @@ api_epg_related
}

static int
api_epg_byid
api_epg_load
( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp )
{
uint32_t id = 0, entries = 0;
Expand Down Expand Up @@ -611,7 +611,7 @@ void api_epg_init ( void )
{ "epg/events/grid", ACCESS_ANONYMOUS, api_epg_grid, NULL },
{ "epg/events/alternative", ACCESS_ANONYMOUS, api_epg_alternative, NULL },
{ "epg/events/related", ACCESS_ANONYMOUS, api_epg_related, NULL },
{ "epg/events/byid", ACCESS_ANONYMOUS, api_epg_byid, NULL },
{ "epg/events/load", ACCESS_ANONYMOUS, api_epg_load, NULL },
{ "epg/brand/list", ACCESS_ANONYMOUS, api_epg_brand_list, NULL },
{ "epg/content_type/list", ACCESS_ANONYMOUS, api_epg_content_type_list, NULL },

Expand Down
2 changes: 1 addition & 1 deletion src/dvr/dvr_db.c
Expand Up @@ -802,7 +802,7 @@ dvr_entry_dec_ref(dvr_entry_t *de)
if (de->de_title) lang_str_destroy(de->de_title);
if (de->de_subtitle) lang_str_destroy(de->de_subtitle);
if (de->de_desc) lang_str_destroy(de->de_desc);
if (de->de_bcast) de->de_bcast->putref((epg_object_t*)de->de_bcast);
dvr_entry_assign_broadcast(de, NULL);
free(de->de_channel_name);
free(de->de_episode);

Expand Down
3 changes: 2 additions & 1 deletion src/dvr/dvr_inotify.c
Expand Up @@ -97,7 +97,7 @@ void dvr_inotify_add ( dvr_entry_t *de )
if (_inot_fd < 0)
return;

if (!de->de_filename)
if (!de->de_filename || de->de_filename[0] == '\0')
return;

path = strdup(de->de_filename);
Expand Down Expand Up @@ -131,6 +131,7 @@ void dvr_inotify_del ( dvr_entry_t *de )
{
dvr_entry_t *det;
dvr_inotify_entry_t *e;
lock_assert(&global_lock);
RB_FOREACH(e, &_inot_tree, link) {
LIST_FOREACH(det, &e->entries, de_inotify_link)
if (det == de) break;
Expand Down
62 changes: 48 additions & 14 deletions src/webui/static/app/epg.js
Expand Up @@ -137,9 +137,10 @@ tvheadend.epgDetails = function(event) {

var now = new Date();
var buttons = [];
var recording = event.dvrState.indexOf('recording') == 0;
var recording = event.dvrState.indexOf('recording') === 0;
var scheduled = event.dvrState.indexOf('scheduled') === 0;

if (!recording) {
if (!recording && !scheduled) {
buttons.push(new Ext.Button({
disabled: !event.title,
handler: searchIMDB,
Expand Down Expand Up @@ -181,7 +182,16 @@ tvheadend.epgDetails = function(event) {
handler: stopDVR,
iconCls: 'stopRec',
tooltip: 'Stop recording of this program',
text: "Stop record"
text: "Stop recording"
}));
}

if (scheduled) {
buttons.push(new Ext.Button({
handler: deleteDVR,
iconCls: 'remove',
tooltip: 'Delete scheduled recording of this program',
text: "Delete recording"
}));
}

Expand Down Expand Up @@ -266,7 +276,20 @@ tvheadend.epgDetails = function(event) {
success: function(d) {
win.close();
},
question: 'Do you really want to abort/unschedule this event?'
question: 'Do you really want to abort/unschedule this recording?'
});
}

function deleteDVR() {
tvheadend.AjaxConfirm({
url: 'api/idnode/delete',
params: {
uuid: event.dvrUuid,
},
success: function(d) {
win.close();
},
question: 'Do you really want to remove this recording?'
});
}

Expand All @@ -290,20 +313,31 @@ tvheadend.epgDetails = function(event) {
tvheadend.epg = function() {
var lookup = '<span class="x-linked">&nbsp;</span>';

var detailsfcn = function(grid, rec, act, row) {
new tvheadend.epgDetails(grid.getStore().getAt(row).data);
};

var actions = new Ext.ux.grid.RowActions({
id: 'details',
header: 'Details',
width: 45,
dataIndex: 'actions',
callbacks: {
'recording': detailsfcn,
'recordingError': detailsfcn,
'scheduled': detailsfcn,
'completed': detailsfcn,
'completedError': detailsfcn,
},
actions: [
{
iconCls: 'broadcast_details',
qtip: 'Broadcast details',
cb: function(grid, rec, act, row) {
new tvheadend.epgDetails(grid.getStore().getAt(row).data);
}
cb: detailsfcn,
},
{ iconIndex: 'dvrState' }
{
iconIndex: 'dvrState',
}

]
});
Expand Down Expand Up @@ -874,11 +908,12 @@ tvheadend.epg = function() {
epgStore.remove(r);
}
}
if (m.update || m.dvr_update) {
if (m.update || m.dvr_update || m.dvr_delete) {
var a = m.update || m.dvr_update || m.dvr_delete;
if (m.update && m.dvr_update)
var a = m.update.concat(m.dvr_update);
else
var a = m.update || m.dvr_update;
var a = m.update.concat(m.dvr_update);
if (m.update || m.dvr_update)
a = a.concat(m.dvr_delete);
var ids = [];
for (var i = 0; i < a.length; i++) {
var r = epgStore.getById(a[i]);
Expand All @@ -887,7 +922,7 @@ tvheadend.epg = function() {
}
if (ids) {
Ext.Ajax.request({
url: 'api/epg/events/byid',
url: 'api/epg/events/load',
params: {
eventId: ids
},
Expand All @@ -905,7 +940,6 @@ tvheadend.epg = function() {
r.commit();
}
}
panel.getView().refresh();
},
failure: function(response, options) {
Ext.MessageBox.alert('EPG Update', response.statusText);
Expand Down

0 comments on commit ea9cd4c

Please sign in to comment.