Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
htsp: add enabled flag to autorec and timerec
  • Loading branch information
Glenn-1990 authored and perexg committed Jan 4, 2015
1 parent 306f252 commit 24d24a8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/dvr/dvr.h
Expand Up @@ -485,9 +485,9 @@ dvr_entry_create_(const char *config_uuid, epg_broadcast_t *e,

dvr_autorec_entry_t *
dvr_autorec_create_htsp(const char *dvr_config_name, const char *title,
channel_t *ch, int32_t start, int32_t start_window,
uint32_t days, time_t start_extra, time_t stop_extra,
dvr_prio_t pri, int retention,
channel_t *ch, uint32_t enabled, int32_t start,
int32_t start_window, uint32_t days, time_t start_extra,
time_t stop_extra, dvr_prio_t pri, int retention,
int min_duration, int max_duration,
const char *owner, const char *creator,
const char *comment, const char *name);
Expand Down Expand Up @@ -540,7 +540,7 @@ dvr_timerec_create(const char *uuid, htsmsg_t *conf);

dvr_timerec_entry_t*
dvr_timerec_create_htsp(const char *dvr_config_name, const char *title,
channel_t *ch, uint32_t start, uint32_t stop,
channel_t *ch, uint32_t enabled, uint32_t start, uint32_t stop,
uint32_t weekdays, dvr_prio_t pri, int retention,
const char *owner, const char *creator, const char *comment, const char *name);

Expand Down
4 changes: 2 additions & 2 deletions src/dvr/dvr_autorec.c
Expand Up @@ -206,7 +206,7 @@ dvr_autorec_create(const char *uuid, htsmsg_t *conf)

dvr_autorec_entry_t*
dvr_autorec_create_htsp(const char *dvr_config_name, const char *title,
channel_t *ch, int32_t start, int32_t start_window,
channel_t *ch, uint32_t enabled, int32_t start, int32_t start_window,
uint32_t weekdays, time_t start_extra, time_t stop_extra,
dvr_prio_t pri, int retention,
int min_duration, int max_duration,
Expand All @@ -218,7 +218,7 @@ dvr_autorec_create_htsp(const char *dvr_config_name, const char *title,
conf = htsmsg_create_map();
days = htsmsg_create_list();

htsmsg_add_u32(conf, "enabled", 1);
htsmsg_add_u32(conf, "enabled", enabled > 0 ? 1 : 0);
htsmsg_add_u32(conf, "retention", retention);
htsmsg_add_u32(conf, "pri", pri);
htsmsg_add_u32(conf, "minduration", min_duration);
Expand Down
4 changes: 2 additions & 2 deletions src/dvr/dvr_timerec.c
Expand Up @@ -202,7 +202,7 @@ dvr_timerec_create(const char *uuid, htsmsg_t *conf)

dvr_timerec_entry_t*
dvr_timerec_create_htsp(const char *dvr_config_name, const char *title,
channel_t *ch, uint32_t start, uint32_t stop,
channel_t *ch, uint32_t enabled, uint32_t start, uint32_t stop,
uint32_t weekdays, dvr_prio_t pri, int retention,
const char *owner, const char *creator, const char *comment, const char *name)
{
Expand All @@ -212,7 +212,7 @@ dvr_timerec_create_htsp(const char *dvr_config_name, const char *title,
conf = htsmsg_create_map();
days = htsmsg_create_list();

htsmsg_add_u32(conf, "enabled", 1);
htsmsg_add_u32(conf, "enabled", enabled > 0 ? 1 : 0);
htsmsg_add_u32(conf, "retention", retention);
htsmsg_add_u32(conf, "pri", pri);
htsmsg_add_str(conf, "title", title);
Expand Down
12 changes: 8 additions & 4 deletions src/htsp_server.c
Expand Up @@ -1590,7 +1590,7 @@ htsp_method_addAutorecEntry(htsp_connection_t *htsp, htsmsg_t *in)
dvr_autorec_entry_t *dae;
const char *dvr_config_name, *title, *creator, *comment, *name;
int64_t start_extra, stop_extra;
uint32_t u32, days_of_week, priority, min_duration, max_duration, retention;
uint32_t u32, days_of_week, priority, min_duration, max_duration, retention, enabled;
int32_t approx_time, start, start_window;
channel_t *ch = NULL;

Expand All @@ -1610,6 +1610,8 @@ htsp_method_addAutorecEntry(htsp_connection_t *htsp, htsmsg_t *in)
days_of_week = 0x7f; // all days
if(htsmsg_get_u32(in, "priority", &priority))
priority = DVR_PRIO_NORMAL;
if(htsmsg_get_u32(in, "enabled", &enabled))
enabled = 1;
if(htsmsg_get_s32(in, "approxTime", &approx_time))
approx_time = -1;
if(htsmsg_get_s32(in, "start", &start))
Expand Down Expand Up @@ -1640,7 +1642,7 @@ htsp_method_addAutorecEntry(htsp_connection_t *htsp, htsmsg_t *in)
if (ch && !htsp_user_access_channel(htsp, ch))
return htsp_error("User does not have access");

dae = dvr_autorec_create_htsp(dvr_config_name, title, ch, start, start_window, days_of_week,
dae = dvr_autorec_create_htsp(dvr_config_name, title, ch, enabled, start, start_window, days_of_week,
start_extra, stop_extra, priority, retention, min_duration, max_duration,
htsp->htsp_granted_access->aa_username, creator, comment, name);

Expand Down Expand Up @@ -1696,7 +1698,7 @@ htsp_method_addTimerecEntry(htsp_connection_t *htsp, htsmsg_t *in)
htsmsg_t *out;
dvr_timerec_entry_t *dte;
const char *dvr_config_name, *title, *creator, *comment, *name;
uint32_t u32, days_of_week, priority, retention, start, stop;
uint32_t u32, days_of_week, priority, retention, start, stop, enabled;
channel_t *ch = NULL;

/* Options */
Expand All @@ -1718,6 +1720,8 @@ htsp_method_addTimerecEntry(htsp_connection_t *htsp, htsmsg_t *in)
days_of_week = 0x7f; // all days
if(htsmsg_get_u32(in, "priority", &priority))
priority = DVR_PRIO_NORMAL;
if(htsmsg_get_u32(in, "enabled", &enabled))
enabled = 1;

creator = htsp->htsp_username;
if (!(comment = htsmsg_get_str(in, "comment")))
Expand All @@ -1730,7 +1734,7 @@ htsp_method_addTimerecEntry(htsp_connection_t *htsp, htsmsg_t *in)
return htsp_error("User does not have access");

/* Add actual timerec */
dte = dvr_timerec_create_htsp(dvr_config_name, title, ch, start, stop, days_of_week,
dte = dvr_timerec_create_htsp(dvr_config_name, title, ch, enabled, start, stop, days_of_week,
priority, retention, htsp->htsp_granted_access->aa_username, creator, comment, name);

/* create response */
Expand Down

0 comments on commit 24d24a8

Please sign in to comment.