Feature #5686

Allow keeping up to a specified amount of epg data

Added by Michaël Arnauts over 4 years ago. Updated about 3 years ago.

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


Estimated time:


Currently, it seems that old epg data is removed. It would be usefull to keep old data for up to a specified amount of days (like 7 days for example).

This old data can be used to search for recently aired programs online (and this works really nice when integrated with Kodi addons for example that do just that).



Updated by saen acro over 4 years ago

It's useless when there is no live event from past ;)
If some one make timeshift option usefully for this case it can be done.


Updated by Michaël Arnauts over 4 years ago

It's not as useless as you might think. I use Kodi as a the client for tvheadend, and I can use the guide to play old programs from an add-on associated with the channel.

This makes it really easy to play old programs that aren't recorded in tvheadend, but are available online.

Looking at the code, the change seems really simple. Would this be accepted as a pull request?


Updated by saen acro over 4 years ago

Export epg end save for this add-on's
Same thing do Ministra portal


Updated by Michaël Arnauts over 4 years ago

This would mean a big change in the tvheadend integration in kodi ( since this uses the tvheadend api to provide guide data to kodi.

I use the kodi pvr guide to play recent broadcasts (with the help of a contextmenu, see, so exporting the epg every few hours doesn't help here.

This is the change I'm proposing:


Updated by Michaël Arnauts over 4 years ago

Hmm, never mind, I took a closer look at the source and it seems tvheadend quite extensive depends on the first item to be the current airing item :(


Updated by saen acro over 4 years ago

install Ministra portal there is all you need to store epg to database


Updated by Em Smith over 4 years ago

On Kodi settings for PVR & LiveTV, go to expert settings, then go to Guide and increase "Past Days to Display". Then Kodi will keep the previous days in the tv guide, up to.a maximum of 31 days.

Note: This is Kodi settings, not Kodi pvr.hts settings or Tvheadend settings.


Updated by Sami Markkanen about 3 years ago

I've been developing a Python-based HTTP server providing a mobile-friendly TV guide for Tvheadend (with some optional Kodi integration like switching channels and notifying about favorites). Accessing old EPG data would be very useful, as my guide tries to be helpful with all the reruns by letting users browse past episodes from last 2 weeks (by default) to easily see which ones were recorded or missed.

Right now my software works around this by cloning all EPG data (including asynchronous changes) to another database, which is troublesome, to say the least. I'm not sure if my project will ever be polished enough for a public release, but access to old data sure would help simplifying things and ironing out glitches.


Updated by Michaël Arnauts about 3 years ago

I've made a patch a while ago for TVHeadend to keep 7 days of EPG data.

You can find it here:


Updated by Sami Markkanen about 3 years ago

Thanks, Michael. That's a good start, so I'll start testing with a patched version. Hardcoding is a bad habit, of course, so ultimately the timespan should be configurable, perhaps even through the API.

Have you noticed any side effects running with the patch?


Updated by Michaël Arnauts about 3 years ago

The web UI would also display the past programs, making the EPG view a bit confusing. Other then that, I don't think it causes any issues.

Also available in: Atom PDF