Delete channel-bound autorecordings when a channel is destroyed.
This commit is contained in:
parent
ac0100c73d
commit
c0ec865d54
5 changed files with 42 additions and 7 deletions
|
@ -383,6 +383,8 @@ channel_delete(channel_t *ch)
|
|||
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) {
|
||||
|
@ -399,8 +401,6 @@ channel_delete(channel_t *ch)
|
|||
|
||||
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);
|
||||
|
|
10
src/dtable.c
10
src/dtable.c
|
@ -214,3 +214,13 @@ dtable_record_store(dtable_t *dt, const char *id, htsmsg_t *r)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -72,4 +72,6 @@ htsmsg_t *dtable_record_get_all(dtable_t *dt);
|
|||
|
||||
void dtable_record_store(dtable_t *dt, const char *id, htsmsg_t *r);
|
||||
|
||||
void dtable_record_erase(dtable_t *dt, const char *id);
|
||||
|
||||
#endif /* DTABLE_H__ */
|
||||
|
|
|
@ -175,4 +175,6 @@ void dvr_autorec_add(const char *title, const char *channel,
|
|||
|
||||
void dvr_autorec_check(event_t *e);
|
||||
|
||||
void autorec_destroy_by_channel(channel_t *ch);
|
||||
|
||||
#endif /* DVR_H */
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#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;
|
||||
|
@ -256,7 +258,7 @@ autorec_record_update(void *opaque, const char *id, htsmsg_t *values,
|
|||
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;
|
||||
}
|
||||
|
@ -333,11 +335,9 @@ static const dtable_class_t autorec_dtc = {
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -442,3 +442,24 @@ dvr_autorec_check_just_enabled(dvr_autorec_entry_t *dae)
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue