Previously we added the filename to the dvr_entry at the start of the
recording, but did not persist it. This meant that if tvheadend
crashed before the programme completed then we would leave a file on
disk which is not referenced by any recording, hence will never be
deleted.
So we persist after the file is created/stream opened. This entry then
has filename, stream info, and (actual) start time, but no (actual)
stop time.
return 0;
dvr_rec_set_state(de, DVR_RS_WAIT_PROGRAM_START, 0);
int code = dvr_rec_start(de, ss);
+ /* Persist entry so we save the filename details to avoid orphan
+ * files if we crash before the programme completes recording.
+ */
+ dvr_entry_changed(de);
+ htsp_dvr_entry_update(de);
if(code == 0) {
ret = 1;
*started = 1;