From: Jaroslav Kysela Date: Sat, 24 Feb 2018 18:25:51 +0000 (+0100) Subject: DVR: try to fix the late running flag update, issue #4958 X-Git-Tag: v4.2.6~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d2e55e40198b06aadcc8eeae6e305d20c0c67de2;p=thirdparty%2Ftvheadend.git DVR: try to fix the late running flag update, issue #4958 --- diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index 983070928..fd857f009 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -2264,6 +2264,17 @@ dvr_entry_start_recording(dvr_entry_t *de, int clone) tvhinfo(LS_DVR, "\"%s\" on \"%s\" recorder starting", lang_str_get(de->de_title, NULL), DVR_CH_NAME(de)); + /* + * The running flag is updated only on the event change. When the DVR + * entry is added too late, the running timers might not be updated. + */ + if (de->de_bcast && de->de_running_start == 0 && de->de_running_stop == 0) { + epg_broadcast_t *ebc = epg_broadcast_get_prev(de->de_bcast); + if (de->de_bcast->running != EPG_RUNNING_NOTSET || + (ebc && ebc->running != EPG_RUNNING_NOTSET)) + de->de_running_stop = gclk(); + } + if (!clone && (r = dvr_rec_subscribe(de)) < 0) { dvr_entry_completed(de, r == -EPERM ? SM_CODE_USER_ACCESS : (r == -EOVERFLOW ? SM_CODE_USER_LIMIT : diff --git a/src/epg.c b/src/epg.c index 5ede01463..c26c913bb 100644 --- a/src/epg.c +++ b/src/epg.c @@ -2108,10 +2108,16 @@ int epg_broadcast_set_description changed, EPG_CHANGED_DESCRIPTION); } -epg_broadcast_t *epg_broadcast_get_next ( epg_broadcast_t *broadcast ) +epg_broadcast_t *epg_broadcast_get_prev ( epg_broadcast_t *b ) { - if ( !broadcast ) return NULL; - return RB_NEXT(broadcast, sched_link); + if (!b) return NULL; + return RB_PREV(b, sched_link); +} + +epg_broadcast_t *epg_broadcast_get_next ( epg_broadcast_t *b ) +{ + if (!b) return NULL; + return RB_NEXT(b, sched_link); } const char *epg_broadcast_get_title ( epg_broadcast_t *b, const char *lang ) diff --git a/src/epg.h b/src/epg.h index 4d2d65e5b..65b673faa 100644 --- a/src/epg.h +++ b/src/epg.h @@ -583,7 +583,8 @@ int epg_broadcast_set_serieslink __attribute__((warn_unused_result)); /* Accessors */ -epg_broadcast_t *epg_broadcast_get_next ( epg_broadcast_t *b ); +epg_broadcast_t *epg_broadcast_get_prev( epg_broadcast_t *b ); +epg_broadcast_t *epg_broadcast_get_next( epg_broadcast_t *b ); const char *epg_broadcast_get_title ( epg_broadcast_t *b, const char *lang ); const char *epg_broadcast_get_subtitle