Bug #4635
open
DVR log doesn't track files if it crashes during recording
Added by Em Smith over 7 years ago.
Updated over 7 years ago.
Description
It seems that filename information is only recorded in the dvr/log after the recording completes rather than when it starts.
However, this means that if Tvheadend crashes during recording then we lose track of the files to which we are writing and means they never get deleted.
For example I have a recorded filename bob.ts, <crash> and then bob-1.ts but only bob-1.ts is in any file in dvr/log. I expect both bob.ts and bob-1.ts in the same entry in the dvr/log.
Assuming the user has a normal environment (not some cut-down environment where tools don't quite work) then the following will show files that exist in the recording directory (assumed to be /media/recordings) but do not exist in the dvr log files:
cd ~hts/.hts/tvheadend/dvr/log;
find /media/recordings/ -type f | grep -v -f <(grep \"filename\": * | awk -F\" '{print $4}' | xargs -d'\n' realpath) |& grep -v -e jpg$ -e nfo$ -e txt$
The "realpath" is there because I have some symlinks as mount points have moved around, and the final grep is to remove common clutter that may be created such as images, nfo files or cut lists.
I couldn't use "jq" since a few of my files contained invalid characters in parent/child such as:
"parent": "<C0>^H"
and
"child": "<C0>^H",
and this prevented parsing.
I think the child/parent accessors should use prop_sbuf, but since I don't know how they are used I haven't made the change.
Also available in: Atom
PDF