Commit
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,14 +126,16 @@ autorec_cmp(dvr_autorec_entry_t *dae, epg_broadcast_t *e) | |
| return 0; | ||
| } | ||
|
|
||
| if(dae->dae_start >= 0) { | ||
| struct tm a_time; | ||
| struct tm ev_time; | ||
| if(dae->dae_start >= 0 && dae->dae_start_window >= 0) { | ||
| struct tm a_time, ev_time; | ||
| time_t ta, te; | ||
| localtime_r(&e->start, &a_time); | ||
| localtime_r(&e->start, &ev_time); | ||
| ev_time = a_time; | ||
| a_time.tm_min = dae->dae_start % 60; | ||
| a_time.tm_hour = dae->dae_start / 60; | ||
| if(abs(mktime(&a_time) - mktime(&ev_time)) > 900) | ||
| ta = mktime(&a_time); | ||
| te = mktime(&ev_time); | ||
| if(ta > te || te > ta + dae->dae_start_window * 60) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Glenn-1990
Contributor
|
||
| return 0; | ||
| } | ||
|
|
||
|
|
@@ -191,8 +193,8 @@ 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, uint32_t aroundTime, uint32_t weekdays, | ||
| time_t start_extra, time_t stop_extra, | ||
| channel_t *ch, uint32_t start, uint32_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, | ||
| const char *creator, const char *comment) | ||
|
|
@@ -215,8 +217,10 @@ dvr_autorec_create_htsp(const char *dvr_config_name, const char *title, | |
| htsmsg_add_str(conf, "creator", creator ?: ""); | ||
| htsmsg_add_str(conf, "comment", comment ?: ""); | ||
|
|
||
| if (aroundTime) | ||
| htsmsg_add_u32(conf, "start", (aroundTime-1)); | ||
| if (start >= 0) | ||
| htsmsg_add_u32(conf, "start", start); | ||
| if (start_window >= 0) | ||
| htsmsg_add_u32(conf, "start_window", start_window); | ||
| if (ch) | ||
| htsmsg_add_str(conf, "channel", idnode_uuid_as_str(&ch->ch_id)); | ||
|
|
||
|
|
@@ -530,6 +534,12 @@ dvr_autorec_entry_class_time_list_(void *o) | |
| return dvr_autorec_entry_class_time_list(o, "Any"); | ||
| } | ||
|
|
||
| static htsmsg_t * | ||
| dvr_autorec_entry_class_time_window_list(void *o) | ||
| { | ||
| return dvr_entry_class_duration_list(o, "Exact", 24*60, 60); | ||
| } | ||
|
|
||
| static htsmsg_t * | ||
| dvr_autorec_entry_class_extra_list(void *o) | ||
| { | ||
|
|
@@ -841,12 +851,19 @@ const idclass_t dvr_autorec_entry_class = { | |
| { | ||
| .type = PT_STR, | ||
| .id = "start", | ||
| .name = "Starting Around", | ||
| .name = "Start Time", | ||
| .set = dvr_autorec_entry_class_start_set, | ||
| .get = dvr_autorec_entry_class_start_get, | ||
| .list = dvr_autorec_entry_class_time_list_, | ||
| .opts = PO_SORTKEY | ||
| }, | ||
| { | ||
| .type = PT_INT, | ||
| .id = "start_window", | ||
| .name = "Start Window", | ||
| .list = dvr_autorec_entry_class_time_window_list, | ||
| .off = offsetof(dvr_autorec_entry_t, dae_start_window), | ||
| }, | ||
| { | ||
| .type = PT_TIME, | ||
| .id = "start_extra", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -738,7 +738,11 @@ htsp_build_autorecentry(dvr_autorec_entry_t *dae, const char *method) | |
| htsmsg_add_u32(out, "minDuration", dae->dae_minduration); | ||
| htsmsg_add_u32(out, "retention", dae->dae_retention); | ||
| htsmsg_add_u32(out, "daysOfWeek", dae->dae_weekdays); | ||
| htsmsg_add_u32(out, "approxTime", dae->dae_start); | ||
| htsmsg_add_u32(out, "approxTime", | ||
| dae->dae_start_window == 30 && dae->dae_start >= 0 ? | ||
| dae->dae_start + 15 : -1); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
| htsmsg_add_u32(out, "start", dae->dae_start); | ||
| htsmsg_add_u32(out, "startWindow", dae->dae_start_window); | ||
| htsmsg_add_u32(out, "priority", dae->dae_pri); | ||
| htsmsg_add_s64(out, "startExtra", dae->dae_start_extra); | ||
| htsmsg_add_s64(out, "stopExtra", dae->dae_stop_extra); | ||
|
|
@@ -1523,8 +1527,8 @@ htsp_method_addAutorecEntry(htsp_connection_t *htsp, htsmsg_t *in) | |
| dvr_autorec_entry_t *dae; | ||
| const char *dvr_config_name, *title, *creator, *comment; | ||
| int64_t start_extra, stop_extra; | ||
| uint32_t u32, days_of_week, priority, approx_time, | ||
| min_duration, max_duration, retention; | ||
| uint32_t u32, days_of_week, priority, approx_time, start, start_window, | ||
| min_duration, max_duration, retention; | ||
| channel_t *ch = NULL; | ||
|
|
||
| /* Options */ | ||
|
|
@@ -1544,9 +1548,19 @@ htsp_method_addAutorecEntry(htsp_connection_t *htsp, htsmsg_t *in) | |
| if(htsmsg_get_u32(in, "priority", &priority)) | ||
| priority = DVR_PRIO_NORMAL; | ||
| if(htsmsg_get_u32(in, "approxTime", &approx_time)) | ||
| approx_time = 0; | ||
| else | ||
| approx_time++; | ||
| approx_time = -1; | ||
| if(htsmsg_get_u32(in, "start", &start)) | ||
| start = -1; | ||
| if(htsmsg_get_u32(in, "startWindow", &start_window)) | ||
| start_window = -1; | ||
| if (start < 0 || start_window < 0) | ||
| start = start_window = -1; | ||
| if (start < 0 && approx_time >= 0) { | ||
| start = approx_time - 15; | ||
| if (start < 0) | ||
| start += 24 * 60; | ||
| start_window = 60; | ||
| } | ||
This comment has been minimized.
Sorry, something went wrong.
Glenn-1990
Contributor
|
||
| if(htsmsg_get_s64(in, "startExtra", &start_extra)) | ||
| start_extra = 0; // 0 = dvr config | ||
| if(htsmsg_get_s64(in, "stopExtra", &stop_extra)) | ||
|
|
@@ -1559,7 +1573,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, approx_time, days_of_week, | ||
| dae = dvr_autorec_create_htsp(dvr_config_name, title, ch, start, start_window, days_of_week, | ||
| start_extra, stop_extra, priority, retention, min_duration, max_duration, creator, comment); | ||
|
|
||
| /* create response */ | ||
|
|
||
This line should be:
if(ta > te || te > ta + dae->dae_start_window )
The * 60 is too much. 1 Minute in frontend configuration stands for 1 hour start window right now.