uint32_t dvr_rerecord_errors;
uint32_t dvr_retention_days;
uint32_t dvr_removal_days;
+ uint32_t dvr_autorec_max_count;
+ uint32_t dvr_autorec_max_sched_count;
char *dvr_charset;
char *dvr_charset_id;
char *dvr_postproc;
void dvr_autorec_completed( dvr_entry_t *de, int error_code );
+uint32_t dvr_autorec_get_max_sched_count(dvr_autorec_entry_t *dae);
+
/**
*
*/
struct dvr_autorec_entry_queue autorec_entries;
+/*
+ *
+ */
+static uint32_t dvr_autorec_get_max_count(dvr_autorec_entry_t *dae)
+{
+ uint32_t max_count = dae->dae_max_count;
+ if (max_count == 0)
+ max_count = dae->dae_config ? dae->dae_config->dvr_autorec_max_count : 0;
+ return max_count;
+}
+
+/*
+ *
+ */
+uint32_t dvr_autorec_get_max_sched_count(dvr_autorec_entry_t *dae)
+{
+ uint32_t max_count = dae->dae_max_sched_count;
+ if (max_count == 0)
+ max_count = dae->dae_config ? dae->dae_config->dvr_autorec_max_sched_count : 0;
+ return max_count;
+}
+
/**
* Unlink - and remove any unstarted
*/
uint32_t count, total = 0;
dvr_entry_t *de_prev;
dvr_autorec_entry_t *dae = de->de_autorec;
+ uint32_t max_count = dvr_autorec_get_max_count(dae);
if (dae == NULL) return;
- if (dae->dae_max_count <= 0) return;
+ if (max_count <= 0) return;
while (1) {
count = 0;
de_prev = NULL;
}
if (total == 0)
total = count;
- if (count < dae->dae_max_count)
+ if (count < max_count)
break;
if (de_prev) {
tvhinfo("dvr", "autorec %s removing recordings %s (allowed count %u total %u)",
- dae->dae_name, idnode_uuid_as_sstr(&de_prev->de_id), dae->dae_max_count, total);
+ dae->dae_name, idnode_uuid_as_sstr(&de_prev->de_id), max_count, total);
dvr_entry_cancel_delete(de_prev, 0);
}
}
{
.type = PT_U32,
.id = "maxcount",
- .name = N_("Maximum count (0=unlimited)"),
+ .name = N_("Maximum count (0=default)"),
.off = offsetof(dvr_autorec_entry_t, dae_max_count),
.opts = PO_HIDDEN,
},
{
.type = PT_U32,
.id = "maxsched",
- .name = N_("Maximum schedules limit (0=unlimited)"),
+ .name = N_("Maximum schedules limit (0=default)"),
.off = offsetof(dvr_autorec_entry_t, dae_max_sched_count),
.opts = PO_HIDDEN,
},
.def.u32 = 1,
.group = 1,
},
+ {
+ .type = PT_U32,
+ .id = "autorec-maxcount",
+ .name = N_("Autorec maximum count (0=unlimited)"),
+ .off = offsetof(dvr_config_t, dvr_autorec_max_count),
+ .group = 1,
+ },
+ {
+ .type = PT_U32,
+ .id = "autorec-maxsched",
+ .name = N_("Autorec maximum schedules limit (0=unlimited)"),
+ .off = offsetof(dvr_config_t, dvr_autorec_max_sched_count),
+ .group = 1,
+ },
{
.type = PT_STR,
.id = "postproc",
dvr_entry_retention_timer(de);
// Trigger autorec update in case of max schedules limit
- if (dae && dae->dae_max_sched_count > 0)
+ if (dae && dvr_autorec_get_max_sched_count(dae) > 0)
dvr_autorec_changed(dae, 0);
}
char buf[512];
char ubuf[UUID_HEX_SIZE];
dvr_entry_t *de;
- uint32_t count = 0;
+ uint32_t count = 0, max_count;
/* Identical duplicate detection
NOTE: Semantic duplicate detection is deferred to the start time of recording and then done using _dvr_duplicate_event by dvr_timer_start_recording. */
}
/* Handle max schedules limit for autorrecord */
- if (dae->dae_max_sched_count > 0){
+ if ((max_count = dvr_autorec_get_max_sched_count(dae)) > 0){
count = 0;
LIST_FOREACH(de, &dae->dae_spawns, de_autorec_link)
if ((de->de_sched_state == DVR_SCHEDULED) ||
(de->de_sched_state == DVR_RECORDING)) count++;
- if (count >= dae->dae_max_sched_count) {
+ if (count >= max_count) {
tvhlog(LOG_DEBUG, "dvr", "Autorecord \"%s\": Not scheduling \"%s\" because of autorecord max schedules limit reached",
dae->dae_name, lang_str_get(e->episode->title, NULL));
return;
dvr_entry_retention_timer(de);
// Trigger autorecord update in case of schedules limit
- if (dae && dae->dae_max_sched_count > 0)
+ if (dae && dvr_autorec_get_max_sched_count(dae) > 0)
dvr_autorec_changed(de->de_autorec, 0);
}