Project

General

Profile

Massive recording with TvHeadend - Record every movie!

Added by Sébastien Aubry almost 4 years ago

Hi,

I share here the setup I have been using for months now.

Objective :
The purpose is to record every single movie aired on TV, in such a way to always have hundreds of available « on-demand », free movies.
When disk space is missing, the oldest movies are automatically deleted.

Hardware :

I have got 2 physical TV tuners :
  • a 10-year-old but solid PCI Hauppauge WinTV Nova-T-500 double tuner
  • a more recent AverTV Volar HD 2 DVB-T USB stick single tuner

In addition, I get IPTV from my internet provider, Free (France), which allows the recording of 2 simultaneous channels.

→ This makes 5 flows at the same time, giving more than 5 movies if some of them are on the same multiplex.

adapters.png

Software :

I use TvHeadend, integrated to LibreElec (and before to OpenElec).

Channels :

I get all the free channels on the French digital terrestrial television (26 unencrypted channels) as well as a lot IPTV channels. Only a few of these IPTV channels air some movies : Paramount Channel, TV5 Monde, AB1, RTL9.

This makes a total of about 30 channels from which I get movies:

channels.png

Setup :

I get a complete EPG for these channels and many other ones every night and update TvHeadend. This EPG includes some quite interesting (at least in my opinion) movie ratings.
Then a Python script, which I can share, is executed. This script :
  • connects to the TvHeadend server
  • retrieves all the past recorded programs (i.e. files on hard disk)
  • check for duplicates between these past recordings. If duplicates are found, only the most recent are kept (since the files are deleted in chronological recording order).
  • browses the EPG for the next few days and for each program :
    • if this is an encrypted channel, only consider it if it is during the unencrypted hours
    • if this program is already planned for recording, skip it
    • else if this is a new program :
      • if it is rated more than 60 % in the EPG, or it is more than 1-hour-long and rated more than 20 % (these are my custom values, I do not only record movies but also good shows), add it to the planned recordings
      • depending on the rating, adjust the priority of the recording (from Unimportant to Low – I keep the higher levels for manual recordings).
        When running out of disk space, TvHeadend automatically deletes the oldest recordings. With a 1.5 TB disk, this makes more than 200 movies aired since September 30th (for 18 days).

Usage and conclusion :

This setup has been working great for months now, and is very stable. It is a free and legal way to get hundreds of on-demand movies... we always find something which suits us.
When we have watched a movie, we can choose to delete it or to move it elsewhere if we want to keep it.

For instance, this evening, when writing this article, I am recording :

next_recordings.png

I can add some details if needed.
Hope this helps.

Regards
spontex


Replies (9)

RE: Massive recording with TvHeadend - Record every movie! - Added by big big almost 4 years ago

Hello,

Sounds great...

How do you use IPTV, and what is your parameters?

Regards,

Olivier

RE: Massive recording with TvHeadend - Record every movie! - Added by Sébastien Aubry almost 4 years ago

Hello,

My internet provider (Free) gives local access to a .m3u file containing the URL of all the channels (playlist.m3u).

  • Under TVHeadend I add a new Network "Free" using this file. It avoids to enter manually the URL of each channel:

free.jpg

  • Then it works like a DVB tuner: when I scan (which is quite long for about 500 channels), I get some muxes:

free_muxes.jpg

  • and some services, which I can map, if they already exist, to the same channels as the DVB tuners (in order to allow TvHeadend to use the best tuner with regard to the next recordings):

free_services.jpg

RE: Massive recording with TvHeadend - Record every movie! - Added by big big almost 4 years ago

Thanks' for your answer.

I need to find now some IPTV channels in order to test it.

Regards,

Olivier

RE: Massive recording with TvHeadend - Record every movie! - Added by Em Smith about 3 years ago

I'd be interested in the script, or at least the APIs you called to do it.

On mythtv I use "tvwish" where you can give it a set of files containing series, episodes, or movies that you would like to see, such as IMDB top 250 or highest rated Simpsons episodes. Then, if they are ever broadcast it will schedule a recording if it hasn't already been recorded. It sounds like your script does a lot of that difficult work.

RE: Massive recording with TvHeadend - Record every movie! - Added by Sébastien Aubry about 3 years ago

Hi,
As a matter of fact, I use an EPG which provides ratings based on a TV magazine. I just record everything based on this EPG rating (usually 3 to 8 movies per evening and all day long :-) )
You can see this issue to get the program I use (with cron): https://tvheadend.org/issues/3417

RE: Massive recording with TvHeadend - Record every movie! - Added by Em Smith about 3 years ago

Thanks for the quick reply. That script was shorter than I was expecting.

My EPG has no ratings but I had a quick play with the api you showed so I could see the data retrieved and it should be easy to compare event.title against my text file of movies to watch.

I had to change it to use getEvents for a particular channelId since python was taking a very long time to parse all the epg data but otherwise all worked.

Merci beaucoup.

RE: Massive recording with TvHeadend - Record every movie! - Added by Sébastien Aubry about 3 years ago

Cool :-)
I am very happy that it worked.

RE: Massive recording with TvHeadend - Record every movie! - Added by Andrew Knapp 5 months ago

Hi,

I have been looking for a way to record all movies with a good rating automatically and the script you have provided seems to provide this but having real trouble understanding on what I need to run it, bit of a newbie in this. Tried to run your python script under Libreelec with Tvheadend installed and it seems that running Python scripts may be an issue on that, also not clear on how or where to access the Htsp Api library you are using in the script, do I need to install this and where do I obtain it. Any help you can give would be appreciated, thanks

RE: Massive recording with TvHeadend - Record every movie! - Added by Sébastien Aubry 3 months ago

Hi,
Sorry for the late reply, I just saw your message.
You have to install the TvHeadend Python API files (at least htsp.py and htsmsg.py and log.py) in the same folder as the script. You can get these files here: https://github.com/tvheadend/python-htspclient/tree/master/tvh

Regards
Sébastien

    (1-9/9)