Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WEBUI JS: Autorec - Fix the Starting Around loading
  • Loading branch information
perexg committed Sep 10, 2014
1 parent ea60d88 commit 2017103
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/dvr/dvr_autorec.c
Expand Up @@ -397,14 +397,16 @@ dvr_autorec_entry_class_time_set(void *o, const void *v, int *tm)
const char *s = v;
int t;

if(s == NULL || s[0] == '\0')
if(s == NULL || s[0] == '\0' || !isdigit(s[0]))
t = -1;
else if(strchr(s, ':') != NULL)
// formatted time string - convert
t = (atoi(s) * 60) + atoi(s + 3);
else {
t = atoi(s);
}
if (t >= 24 * 60)
t = -1;
if (t != *tm) {
*tm = t;
return 1;
Expand Down Expand Up @@ -460,18 +462,12 @@ static htsmsg_t *
dvr_autorec_entry_class_time_list(void *o)
{
int i;
htsmsg_t *e, *l = htsmsg_create_list();
htsmsg_t *l = htsmsg_create_list();
char buf[16];
e = htsmsg_create_map();
htsmsg_add_str(e, "key", "");
htsmsg_add_str(e, "val", "Any");
htsmsg_add_msg(l, NULL, e);
htsmsg_add_str(l, NULL, "Any");
for (i = 0; i < 24*60; i += 10) {
snprintf(buf, sizeof(buf), "%02d:%02d", i / 60, (i % 60));
e = htsmsg_create_map();
htsmsg_add_str(e, "key", buf);
htsmsg_add_str(e, "val", buf);
htsmsg_add_msg(l, NULL, e);
htsmsg_add_str(l, NULL, buf);
}
return l;
}
Expand Down

0 comments on commit 2017103

Please sign in to comment.