Feature #5638

Recordings should depend only on files in recordings directory, or store database there

Added by Giles Puckett about 4 years ago. Updated about 3 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


When the TVH system disk fails and needs to be rebuilt (such as a Raspberry Pi memory card) you lose access to TV recordings on a separate hard disk, even though the recordings are unaffected. IMHO this is bad design; the recordings should preferably depend only on the presence of the files. This would also allow files to be dropped into the recordings directory and immediately show up to clients.

If more info is needed it should be stored in the same place, so if TVH needs to be rebuilt, the recordings survive intact.



Updated by g siviero about 4 years ago

You could also schedule a configuration backup (on a different disk or network path) if you are afraid that your Tvheadend configuration could fail.

Also, different Tvheadend servers could use a shared recording path (for example a NAS share), so the path itself or the file presence would not be enough to determine whose are the files.
I don't understand what you mean with "dropping" a file and make it visible to clients (Tvheadend clients?). I think you should use for example a DLNA server for that.


Updated by Giles Puckett about 4 years ago

Shared recording path: It's a use case I hadn't thought of; I would imagine that if I had two TVH servers pointing to the same recording path, I'd want each of them to be able to see all the recordings.

Making recordings visible to clients: some time ago I migrated from WMC to TVH, and had some recordings I wanted to play later. I copied them into TVH's recording path but couldn't make them visible to TVH and its clients (Kodi). This was easily solved by pointing Kodi's video source at them, but it would have been nice to be able to do it.


Updated by Dave Pickles about 4 years ago

To add files to the recordings directory and have them show up in TVHeadend, see


Updated by Giles Puckett almost 4 years ago

Waking this thread up again.... a few days ago TVH froze and had to be rebooted. When it came up all the existing recordings were not showing at all. They were still there on the disk (and can be played by pointing any video player at them). TVH must have been in the middle of writing its index database or whatever it has when it crashed.

Now this underscores my point about the design, diplomatically speaking...

Dave, without really understanding what your python script does, how easy would it be to work it up to simply regenerate the recordings databse from all the files present in the recordings directory?


Updated by Flole Systems almost 4 years ago

You should report the lockup instead so someone can look into that and maybe fix it. You probably don't have a coredump of that lockup now so not much you can do now but make yourself familiar with the debugging steps in the Wiki and go through them next time you experience a lockup.


Updated by Giles Puckett about 3 years ago

Bumping this issue.
Was away from home for a few days, so shut down TVH.(it normally runs 24/7). It was shut down (not lost power)
Rebooted, and not the recordings are all invisible. They are still there on the disk, but the catalog is lost. Can it be regenerated, so Kodi clients can see it? I know they can point to it via recorded videos, so its not a deal breaker, but inconvenient. Again, my point stands: the presence of files in that recordings directory should be the only thing TVH needs to list them as recordings.


Updated by Flole Systems about 3 years ago

There's additional information needed to display it properly, but if you know how that should be implemented feel free to do it.

"Bumping" this issue won't help since there are just a few people authoring code at the moment (meaning nobody committed anything since 6 months or so) and at least I am just doing minor changes for others (mostly reliability issues that cause crashes) or things I need myself.


Updated by Giles Puckett about 3 years ago

The story continues. Worked up Dave Pickles' script to add the files back. Established an entry in the Finished Recordings list for an existing file. So far so good. Started up Kodi to see if it could be viewed, and noticed it had started as a current recording! Fearing an overwrite, I shut TVH down straight away. Upon restart, all the old recordings had reappeared! So a few questions...
- how can the finished recordings list reappear?
- how can a finished recording start up again when all its dates are in the past?
- how can I make files stick as finished recordings and stay in the past?


Updated by Dave Pickles about 3 years ago

Just a guess but maybe your Pi couldn't get the correct time for some reason. With the clock in the past all your recordings would look like timers.

Incidentally I can't claim credit for the Python script you're using, it was written by user "ullix tv".


Updated by Giles Puckett about 3 years ago

My apologies. Wasn't paying attention.

Also available in: Atom PDF