DVR fixes: creator, duration = 0, remove url from grid

This commit is contained in:
Jaroslav Kysela 2014-09-05 21:00:54 +02:00
parent 3a9c5d5a05
commit 41a4757a97
5 changed files with 22 additions and 19 deletions

View file

@ -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);

View file

@ -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

View file

@ -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,

View file

@ -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'

View file

@ -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';