DVR autorec: change start_window meaning to start up to
This commit is contained in:
parent
56d8c8fc2a
commit
e2bd233a4f
4 changed files with 63 additions and 28 deletions
|
@ -79,15 +79,13 @@ The maximal duration of a matching event - in other words, only match programmes
|
||||||
<dd>
|
<dd>
|
||||||
On which specific days of the week to find matching programmes.
|
On which specific days of the week to find matching programmes.
|
||||||
<p>
|
<p>
|
||||||
<dt><b>Starting Around</b>
|
<dt><b>Start Time</b>
|
||||||
<dd>
|
<dd>
|
||||||
An approximate starting time for matching programmes.
|
An event which starts between this "start time" and "start time up to" will be matched (including).
|
||||||
<br>
|
<p>
|
||||||
<br>
|
<dt><b>Start Up To</b>
|
||||||
I'd need to check the code to see how this works to expand on this any further. It used to be:
|
<dd>
|
||||||
<br>
|
The start up to limit.
|
||||||
<br>
|
|
||||||
Only record events if they are scheduled +-15 minutes from this given time.
|
|
||||||
<p>
|
<p>
|
||||||
<dt><b>Priority</b>
|
<dt><b>Priority</b>
|
||||||
<dd>
|
<dd>
|
||||||
|
|
10
src/config.c
10
src/config.c
|
@ -1128,16 +1128,20 @@ config_dvr_autorec_start_set(const char *s, int *tm)
|
||||||
static void
|
static void
|
||||||
config_modify_dvrauto( htsmsg_t *c )
|
config_modify_dvrauto( htsmsg_t *c )
|
||||||
{
|
{
|
||||||
int tm = -1;
|
int tm = -1, tw = -1;
|
||||||
char buf[16];
|
char buf[16];
|
||||||
|
|
||||||
if (config_dvr_autorec_start_set(htsmsg_get_str(c, "start"), &tm) > 0 && tm >= 0) {
|
if (config_dvr_autorec_start_set(htsmsg_get_str(c, "start"), &tm) > 0 && tm >= 0) {
|
||||||
tm -= 15;
|
tm -= 15;
|
||||||
if (tm < 0)
|
if (tm < 0)
|
||||||
tm += 24 * 60;
|
tm += 24 * 60;
|
||||||
|
tw = tm + 30;
|
||||||
|
if (tw >= 24 * 60)
|
||||||
|
tw -= 24 * 60;
|
||||||
snprintf(buf, sizeof(buf), "%02d:%02d", tm / 60, tm % 60);
|
snprintf(buf, sizeof(buf), "%02d:%02d", tm / 60, tm % 60);
|
||||||
htsmsg_set_str(c, "start", tm <= 0 ? "Any" : buf);
|
htsmsg_set_str(c, "start", buf);
|
||||||
htsmsg_set_u32(c, "start_window", 30);
|
snprintf(buf, sizeof(buf), "%02d:%02d", tw / 60, tw % 60);
|
||||||
|
htsmsg_set_str(c, "start_window", buf);
|
||||||
} else {
|
} else {
|
||||||
htsmsg_delete_field(c, "start");
|
htsmsg_delete_field(c, "start");
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,18 +126,30 @@ autorec_cmp(dvr_autorec_entry_t *dae, epg_broadcast_t *e)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dae->dae_start >= 0 && dae->dae_start_window >= 0) {
|
if(dae->dae_start >= 0 && dae->dae_start_window >= 0 &&
|
||||||
|
dae->dae_start < 24*60 && dae->dae_start_window < 24*60) {
|
||||||
struct tm a_time, ev_time;
|
struct tm a_time, ev_time;
|
||||||
time_t ta, te;
|
time_t ta, te, tad;
|
||||||
localtime_r(&e->start, &a_time);
|
localtime_r(&e->start, &a_time);
|
||||||
ev_time = a_time;
|
ev_time = a_time;
|
||||||
a_time.tm_min = dae->dae_start % 60;
|
a_time.tm_min = dae->dae_start % 60;
|
||||||
a_time.tm_hour = dae->dae_start / 60;
|
a_time.tm_hour = dae->dae_start / 60;
|
||||||
ta = mktime(&a_time);
|
ta = mktime(&a_time);
|
||||||
te = mktime(&ev_time);
|
te = mktime(&ev_time);
|
||||||
if(ta > te || te > ta + dae->dae_start_window * 60)
|
if(dae->dae_start > dae->dae_start_window) {
|
||||||
|
ta -= 24 * 3600; /* 24 hours */
|
||||||
|
tad = ((24 * 60) - dae->dae_start + dae->dae_start_window) * 60;
|
||||||
|
if(ta > te || te > ta + tad) {
|
||||||
|
ta += 24 * 3600;
|
||||||
|
if(ta > te || te > ta + tad)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
tad = (dae->dae_start_window - dae->dae_start) * 60;
|
||||||
|
if(ta > te || te > ta + tad)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
duration = difftime(e->stop,e->start);
|
duration = difftime(e->stop,e->start);
|
||||||
|
|
||||||
|
@ -499,6 +511,13 @@ dvr_autorec_entry_class_start_set(void *o, const void *v)
|
||||||
return dvr_autorec_entry_class_time_set(o, v, &dae->dae_start);
|
return dvr_autorec_entry_class_time_set(o, v, &dae->dae_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
dvr_autorec_entry_class_start_window_set(void *o, const void *v)
|
||||||
|
{
|
||||||
|
dvr_autorec_entry_t *dae = (dvr_autorec_entry_t *)o;
|
||||||
|
return dvr_autorec_entry_class_time_set(o, v, &dae->dae_start_window);
|
||||||
|
}
|
||||||
|
|
||||||
static const void *
|
static const void *
|
||||||
dvr_autorec_entry_class_time_get(void *o, int tm)
|
dvr_autorec_entry_class_time_get(void *o, int tm)
|
||||||
{
|
{
|
||||||
|
@ -519,6 +538,13 @@ dvr_autorec_entry_class_start_get(void *o)
|
||||||
return dvr_autorec_entry_class_time_get(o, dae->dae_start);
|
return dvr_autorec_entry_class_time_get(o, dae->dae_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const void *
|
||||||
|
dvr_autorec_entry_class_start_window_get(void *o)
|
||||||
|
{
|
||||||
|
dvr_autorec_entry_t *dae = (dvr_autorec_entry_t *)o;
|
||||||
|
return dvr_autorec_entry_class_time_get(o, dae->dae_start_window);
|
||||||
|
}
|
||||||
|
|
||||||
htsmsg_t *
|
htsmsg_t *
|
||||||
dvr_autorec_entry_class_time_list(void *o, const char *null)
|
dvr_autorec_entry_class_time_list(void *o, const char *null)
|
||||||
{
|
{
|
||||||
|
@ -539,12 +565,6 @@ dvr_autorec_entry_class_time_list_(void *o)
|
||||||
return dvr_autorec_entry_class_time_list(o, "Any");
|
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, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static htsmsg_t *
|
static htsmsg_t *
|
||||||
dvr_autorec_entry_class_extra_list(void *o)
|
dvr_autorec_entry_class_extra_list(void *o)
|
||||||
{
|
{
|
||||||
|
@ -863,11 +883,13 @@ const idclass_t dvr_autorec_entry_class = {
|
||||||
.opts = PO_SORTKEY
|
.opts = PO_SORTKEY
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.type = PT_INT,
|
.type = PT_STR,
|
||||||
.id = "start_window",
|
.id = "start_window",
|
||||||
.name = "Start Window",
|
.name = "Start Up To",
|
||||||
.list = dvr_autorec_entry_class_time_window_list,
|
.set = dvr_autorec_entry_class_start_window_set,
|
||||||
.off = offsetof(dvr_autorec_entry_t, dae_start_window),
|
.get = dvr_autorec_entry_class_start_window_get,
|
||||||
|
.list = dvr_autorec_entry_class_time_list_,
|
||||||
|
.opts = PO_SORTKEY,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.type = PT_TIME,
|
.type = PT_TIME,
|
||||||
|
|
|
@ -732,6 +732,7 @@ static htsmsg_t *
|
||||||
htsp_build_autorecentry(dvr_autorec_entry_t *dae, const char *method)
|
htsp_build_autorecentry(dvr_autorec_entry_t *dae, const char *method)
|
||||||
{
|
{
|
||||||
htsmsg_t *out = htsmsg_create_map();
|
htsmsg_t *out = htsmsg_create_map();
|
||||||
|
int tad;
|
||||||
|
|
||||||
htsmsg_add_str(out, "id", idnode_uuid_as_str(&dae->dae_id));
|
htsmsg_add_str(out, "id", idnode_uuid_as_str(&dae->dae_id));
|
||||||
htsmsg_add_u32(out, "enabled", dae->dae_enabled);
|
htsmsg_add_u32(out, "enabled", dae->dae_enabled);
|
||||||
|
@ -739,9 +740,17 @@ htsp_build_autorecentry(dvr_autorec_entry_t *dae, const char *method)
|
||||||
htsmsg_add_u32(out, "minDuration", dae->dae_minduration);
|
htsmsg_add_u32(out, "minDuration", dae->dae_minduration);
|
||||||
htsmsg_add_u32(out, "retention", dae->dae_retention);
|
htsmsg_add_u32(out, "retention", dae->dae_retention);
|
||||||
htsmsg_add_u32(out, "daysOfWeek", dae->dae_weekdays);
|
htsmsg_add_u32(out, "daysOfWeek", dae->dae_weekdays);
|
||||||
|
if (dae->dae_start >= 0 && dae->dae_start_window >= 0) {
|
||||||
|
if (dae->dae_start > dae->dae_start_window)
|
||||||
|
tad = 24 * 60 - dae->dae_start + dae->dae_start_window;
|
||||||
|
else
|
||||||
|
tad = dae->dae_start_window - dae->dae_start;
|
||||||
|
} else {
|
||||||
|
tad = -1;
|
||||||
|
}
|
||||||
htsmsg_add_s32(out, "approxTime",
|
htsmsg_add_s32(out, "approxTime",
|
||||||
dae->dae_start_window == 30 && dae->dae_start >= 0 ?
|
dae->dae_start >= 0 && tad >= 0 ?
|
||||||
dae->dae_start + 15 : -1);
|
((dae->dae_start + tad / 2) % (24 * 60)) : -1);
|
||||||
htsmsg_add_u32(out, "start", dae->dae_start);
|
htsmsg_add_u32(out, "start", dae->dae_start);
|
||||||
htsmsg_add_u32(out, "startWindow", dae->dae_start_window);
|
htsmsg_add_u32(out, "startWindow", dae->dae_start_window);
|
||||||
htsmsg_add_u32(out, "priority", dae->dae_pri);
|
htsmsg_add_u32(out, "priority", dae->dae_pri);
|
||||||
|
@ -1563,7 +1572,9 @@ htsp_method_addAutorecEntry(htsp_connection_t *htsp, htsmsg_t *in)
|
||||||
start = approx_time - 15;
|
start = approx_time - 15;
|
||||||
if (start < 0)
|
if (start < 0)
|
||||||
start += 24 * 60;
|
start += 24 * 60;
|
||||||
start_window = 60;
|
start_window = start + 30;
|
||||||
|
if (start_window >= 24 * 60)
|
||||||
|
start_window -= 24 * 60;
|
||||||
}
|
}
|
||||||
if(htsmsg_get_s64(in, "startExtra", &start_extra))
|
if(htsmsg_get_s64(in, "startExtra", &start_extra))
|
||||||
start_extra = 0; // 0 = dvr config
|
start_extra = 0; // 0 = dvr config
|
||||||
|
|
Loading…
Add table
Reference in a new issue