From 41a4757a97129c43a33ea5aca57732e1ded87d7e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 5 Sep 2014 21:00:54 +0200 Subject: [PATCH] DVR fixes: creator, duration = 0, remove url from grid --- src/api/api_dvr.c | 13 ++++++------- src/dvr/dvr_autorec.c | 6 +++--- src/dvr/dvr_db.c | 8 +++++--- src/webui/static/app/dvr.js | 4 ++-- src/webui/static/app/idnode.js | 10 ++++++---- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/api/api_dvr.c b/src/api/api_dvr.c index 92a5b5e2..8c559f1b 100644 --- a/src/api/api_dvr.c +++ b/src/api/api_dvr.c @@ -165,11 +165,11 @@ api_dvr_entry_create pthread_mutex_lock(&global_lock); s1 = htsmsg_get_str(conf, "config_name"); s2 = api_dvr_config_name(perm, s1); - if (strcmp(s1 ?: "", s2 ?: "")) { - htsmsg_delete_field(conf, "config_name"); - if (s2) - htsmsg_add_str(conf, "config_name", s2); - } + if (strcmp(s1 ?: "", s2 ?: "")) + htsmsg_set_str(conf, "config_name", s2 ?: ""); + + if (perm->aa_representative) + htsmsg_set_str(conf, "creator", perm->aa_representative); if ((de = dvr_entry_create(NULL, conf))) dvr_entry_save(de); @@ -272,9 +272,8 @@ api_dvr_autorec_create if (!(conf = htsmsg_get_map(args, "conf"))) return EINVAL; - htsmsg_delete_field(conf, "creator"); if (perm->aa_representative) - htsmsg_add_str(conf, "creator", perm->aa_representative); + htsmsg_set_str(conf, "creator", perm->aa_representative); pthread_mutex_lock(&global_lock); dae = dvr_autorec_create(NULL, conf); diff --git a/src/dvr/dvr_autorec.c b/src/dvr/dvr_autorec.c index 077547fd..c259cfa1 100644 --- a/src/dvr/dvr_autorec.c +++ b/src/dvr/dvr_autorec.c @@ -464,7 +464,7 @@ dvr_autorec_entry_class_time_list(void *o) char buf[16]; e = htsmsg_create_map(); htsmsg_add_str(e, "key", ""); - htsmsg_add_str(e, "val", "Not set"); + htsmsg_add_str(e, "val", "Any"); htsmsg_add_msg(l, NULL, e); for (i = 0; i < 24*60; i += 10) { snprintf(buf, sizeof(buf), "%02d:%02d", i / 60, (i % 60)); @@ -479,13 +479,13 @@ dvr_autorec_entry_class_time_list(void *o) static htsmsg_t * dvr_autorec_entry_class_minduration_list(void *o) { - return dvr_entry_class_duration_list(o, "Not set", 24*60); + return dvr_entry_class_duration_list(o, "Any", 24*60); } static htsmsg_t * dvr_autorec_entry_class_maxduration_list(void *o) { - return dvr_entry_class_duration_list(o, "Not set", 24*60); + return dvr_entry_class_duration_list(o, "Any", 24*60); } static int diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index 95befdf3..39ac41ee 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -1446,6 +1446,8 @@ dvr_entry_class_disp_title_set(void *o, const void *v) { dvr_entry_t *de = (dvr_entry_t *)o; const char *s = ""; + if (v == NULL || *((char *)v) == '\0') + v = "UnknownTitle"; if (de->de_title) s = lang_str_get(de->de_title, NULL); if (strcmp(s, v ?: "")) { @@ -1864,14 +1866,14 @@ const idclass_t dvr_entry_class = { .id = "episode", .name = "Episode", .get = dvr_entry_class_episode_get, - .opts = PO_RDONLY | PO_NOSAVE, + .opts = PO_RDONLY | PO_NOSAVE | PO_HIDDEN, }, { .type = PT_STR, .id = "url", .name = "URL", .get = dvr_entry_class_url_get, - .opts = PO_RDONLY | PO_NOSAVE, + .opts = PO_RDONLY | PO_NOSAVE | PO_HIDDEN, }, { .type = PT_S64, @@ -1885,7 +1887,7 @@ const idclass_t dvr_entry_class = { .id = "status", .name = "Status", .get = dvr_entry_class_status_get, - .opts = PO_RDONLY | PO_NOSAVE, + .opts = PO_RDONLY | PO_NOSAVE | PO_HIDDEN, }, { .type = PT_STR, diff --git a/src/webui/static/app/dvr.js b/src/webui/static/app/dvr.js index 4debd557..1f438a2f 100644 --- a/src/webui/static/app/dvr.js +++ b/src/webui/static/app/dvr.js @@ -320,13 +320,13 @@ tvheadend.autorec_editor = function(panel, index) { url: 'api/dvr/autorec', params: { list: 'enable,title,channel,tag,content_type,minduration,' + - 'maxduration,weekdays,approx_time,pri,config_name,comment', + 'maxduration,weekdays,start,pri,config_name,comment', }, create: { } }, del: true, list: 'enable,title,channel,tag,content_type,minduration,' + - 'maxduration,weekdays,approx_time,pri,config_name,creator,comment', + 'maxduration,weekdays,start,pri,config_name,creator,comment', sort: { field: 'name', direction: 'ASC' diff --git a/src/webui/static/app/idnode.js b/src/webui/static/app/idnode.js index 7054080a..35739444 100644 --- a/src/webui/static/app/idnode.js +++ b/src/webui/static/app/idnode.js @@ -194,11 +194,13 @@ tvheadend.IdNodeField = function(conf) if (this.type === 'time') { if (this.duration) return function(v) { - v = parseInt(v / 60); /* Nevermind the seconds */ - if (v === 0 && v !== '0') + if (v < 0 || v === '') return "Not set"; - var hours = parseInt(v / 60); - var min = parseInt(v % 60); + var i = parseInt(v / 60); /* Nevermind the seconds */ + if (i === 0) + return "0"; + var hours = parseInt(i / 60); + var min = parseInt(i % 60); if (hours) { if (min === 0) return hours + ' hrs';