tvhlog(LOG_NOTICE, "channels", "Channel \"%s\" deleted",
ch->ch_name);
+ autorec_destroy_by_channel(ch);
+
dvr_destroy_by_channel(ch);
while((t = LIST_FIRST(&ch->ch_transports)) != NULL) {
epg_unlink_from_channel(ch);
- fprintf(stderr, "!!!!!//autorec_destroy_by_channel(ch);\n");
-
hts_settings_remove("channels/%d", ch->ch_id);
RB_REMOVE(&channel_name_tree, ch, ch_name_link);
{
hts_settings_save(r, "%s/%s", dt->dt_tablename, id);
}
+
+
+/**
+ *
+ */
+void
+dtable_record_erase(dtable_t *dt, const char *id)
+{
+ hts_settings_remove("%s/%s", dt->dt_tablename, id);
+}
#include "dtable.h"
#include "epg.h"
+dtable_t *autorec_dt;
+
TAILQ_HEAD(dvr_autorec_entry_queue, dvr_autorec_entry);
struct dvr_autorec_entry_queue autorec_entries;
LIST_REMOVE(dae, dae_channel_link);
dae->dae_channel = NULL;
}
- if((ch = channel_find_by_name(s, 0)) != NULL) {
+ if((ch = channel_find_by_name(s, 0)) != NULL) {
LIST_INSERT_HEAD(&ch->ch_autorecs, dae, dae_channel_link);
dae->dae_channel = ch;
}
void
dvr_autorec_init(void)
{
- dtable_t *dt;
-
TAILQ_INIT(&autorec_entries);
- dt = dtable_create(&autorec_dtc, "autorec", NULL);
- dtable_load(dt);
+ autorec_dt = dtable_create(&autorec_dtc, "autorec", NULL);
+ dtable_load(autorec_dt);
}
autorec_schedule(ch->ch_epg_current, dae);
}
}
+
+
+/**
+ *
+ */
+void
+autorec_destroy_by_channel(channel_t *ch)
+{
+ dvr_autorec_entry_t *dae;
+ htsmsg_t *m;
+
+ while((dae = LIST_FIRST(&ch->ch_autorecs)) != NULL) {
+ dtable_record_erase(autorec_dt, dae->dae_id);
+ autorec_entry_destroy(dae);
+ }
+
+ /* Notify web clients that we have messed with the tables */
+ m = htsmsg_create_map();
+ htsmsg_add_u32(m, "asyncreload", 1);
+ notify_by_msg("autorec", m);
+}