How to retrieve, parse, and search in french TV program?

April 2, 2019

Search for a channel or a program using french TV program and execute some actions with the result, let’s do it!

First at all, retrieve source from ProgramTv repo :

$ git clone https://github.com/gpenverne/program-tv  

It will help you to parse the TV program guide http://www.xmltv.fr/guide/tvguide.xml

Usage

$ ./run.php "documentaire"  
# Ok j'ai mis titre du documentaire sur france5  
$ ./run.php "scènes de ménage"  
# Ok j'ai mis scènes de ménage sur m6  

Customize!

Edit the callback.php file, to customize what to do with result, for example, call the freebox remote endpoint:

<?php  
    // callback.php  
    file_get_contents('http://hd1.freebox.fr/pub/remote_control?code=xxxx&key='.$program->channel)  
  
    /*  
    * Other properties available:  
    * $program->title The program title  
    * $program->channel_name The program channel name  
    * $program->channel The program channel number  
    */  
?>  
  

Auto update the feed

Just exec the cron.sh file :

$ cron.sh  

You can add it to your crontab file using crontab -e and adding the following line:

@daily /home/pi/program-tv/cron.sh  

channels.php

The channels file is helpfull to match channel names and numbers. Commenting a channel will exclude it from the search.

To conclude…

However, you know… I never watch TV because of shitty programs … So… useless ¯\(ツ)

Seen on ProgramTv repo

Let's twitt about it!

When you click on links to various merchants on this site and make a purchase, this can result in this site earning a commission.
Affiliate programs and affiliations include, but are not limited to, the eBay Partner Network and Amazon.