Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DVR fixes: creator, duration = 0, remove url from grid
  • Loading branch information
perexg committed Sep 8, 2014
1 parent 3a9c5d5 commit 41a4757
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
13 changes: 6 additions & 7 deletions src/api/api_dvr.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/dvr/dvr_autorec.c
Expand Up @@ -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));
Expand All @@ -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
Expand Down
8 changes: 5 additions & 3 deletions src/dvr/dvr_db.c
Expand Up @@ -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 ?: "")) {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/webui/static/app/dvr.js
Expand Up @@ -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'
Expand Down
10 changes: 6 additions & 4 deletions src/webui/static/app/idnode.js
Expand Up @@ -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';
Expand Down

0 comments on commit 41a4757

Please sign in to comment.