Xmltv2vdr-plugin: Difference between revisions

From VDR Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 45: Line 45:
* The second line contains the maximum number of days, the source is providing EPG-Data for.
* The second line contains the maximum number of days, the source is providing EPG-Data for.
* Starting from the third line, each line specifies:
* Starting from the third line, each line specifies:
** one binding channelname for which the source is providing EPG-Data
** a channel ID present in the xmltv source
** the channelname can optionally be followed by a semi-colon and any data the third-party source might want to put there; this data is ignored by the xmltv2vdr plugin
** the channelname can optionally be followed by a semi-colon and any data the third-party source might want to put there; this data is ignored by the xmltv2vdr plugin


Line 77: Line 77:
====Example of a simple executable file====
====Example of a simple executable file====
Below is an example of a very simple executable file in the form of a bash script that provides the data in a file and not as a stream. It has to have the same name as the control file; for example if the control file is named myepg, the executable file also has to be named myepg. The executable file has to be located in the path with the executables; it can for example be saved into the /usr/bin directory. (Don't forget to set the executable bit on the binary file.)
Below is an example of a very simple executable file in the form of a bash script that provides the data in a file and not as a stream. It has to have the same name as the control file; for example if the control file is named myepg, the executable file also has to be named myepg. The executable file has to be located in the path with the executables; it can for example be saved into the /usr/bin directory. (Don't forget to set the executable bit on the binary file.)
'''Remark: ''' The example does not adjust the channel IDs in the xmltv file to make them conformant. This is not necessary, if you don't use multiple sources that have different channel IDs for the same channel in their xmltv file. If you happen to switch to a different source with other channel IDs, the simplest is to stop the VDR and remove the xmltv2vdr channel settings from the setup.conf file of the VDR.
<pre>
<pre>
#!/bin/sh
#!/bin/sh
Line 96: Line 95:
exit 0
exit 0
</pre>
</pre>

'''Remark: ''' The example does not adjust the channel IDs in the xmltv file to make them conformant. This is not necessary, if you don't use multiple sources that have different channel IDs for the same channel in their xmltv file. If you happen to switch to a different source with other channel IDs, the simplest is to stop the VDR and remove the xmltv2vdr channel settings from the setup.conf file of the VDR.


====Enable the new source in xmltv2vdr====
====Enable the new source in xmltv2vdr====

Latest revision as of 17:44, 12 March 2019

This page is a loose translation of the page about the xmltv2vdr-plugin available in the german wiki.

Current Version

Version 0.1.1

Description

xmltv2vdr is a plugin for the VDR that imports EPG-Data into the VDR. By itself, it does not fetch any EPG-Data; the EPG-Data has to be supplied by third-party software to xmltv2vdr in xmltv format.

The third-party software to fetch the EPG-Data is not part of xmltv2vdr because of legal issues (cf VG_Media).

Software Requirements

libxml2, libsqlite3, libpcre

VDR >= 1.6.0

Configuration

Assuming that the xmltv2vdr plugin has been installed on the VDR in conjunction to third-party software that uses the xmltv2vdr plugin to get the EPG-Data into the VDR, the configuration about

  • what EPG-Data sources to use
  • what channels of the source correspond to what channels of the VDR
  • other configurations like frequency of updates, etc.

is completely done in the OSD of the VDR.

The OSD of the xmltv2vdr plugin can be accessed under the plugins settings.

Third-party EPG-Data Sources

For the end-user

The configuration and usage of the third-party EPG-Data sources will not be discussed here.

The third-party software to fetch the EPG-Data is not part of xmltv2vdr because of legal issues (cf VG_Media).

For the developers of the third-party software providing EPG-Data

The interface between the xmltv2vdr plugin and the third-party software providing the EPG-Data has been defined like this:

  • Every source must have a control file in the /var/lib/epgsources directory. The control file is a text file that informs the xmltv2vdr plugin whether the epg data is streamed to the plugin, or whether it has to read the epg data from an xmltv file. It also informs the xmltv2vdr plugin about what channel are contained in the xmltv file. The name of the control file can be chosen freely, but must not have an extension. The control file on the VDR must be readable by the vdr-user. (Please, have a look below for examples of valid control files.)
  • Every source must have an executable file that offers the EPG-Data in the appropriate format to the xmltv2vdr plugin. The binary file has to be in the path of the executables of the VDR. (It can usually be put into the /usr/bin directory.) The binary file must have the same name as the control file, to which it corresponds. The executable is called with the following parameters: Number of days, Pin, Channelnames (example: 5 &#145;&#145; ard.de zdf.de)
  • The return code of the executable is used by xmltv2vdr to find out if there was an error during the execution of the executable. The number 0 means that everything went fine; a number between 1 and 126 means that there was an error and xmltv2vdr tries two additional times to run the executable with an interval of one minute.
  • The EPG-Data has to be a valid xmltv format and is passed to the xmltv2vdr plugin by using a pipe or a file. (Please, have a look below for an example of a valid xmltv file.)
  • The xmltv2vdr plugin uses an own set of channelnames to which the developers of the third-party plugins should conform. This list of channelnames is far from being complete and is available near the end of the german wiki page of the xmltv2vdr plugin. If you need channelnames, that are not yet available in the list, you should use the following format to define them: channelname.countrycode; for example, ard.de, orf.at, dk1.dk, france2.fr, rai1.it, detski-mir.ru, kanal-7-int.tr, sf1.ch,... Please, let us know about the new channels that you have defined by adding them to the german wiki page.

More details about the control file

  • The first line of the control file starts with the word file or pipe.
    • If the first word is file, the executable file has to put a file with the epg data in xmltv format into the /var/lib/epgsources directory with the EPG-Data in valid xmltv format. The file with the EPG-Data must have the same name of the control file followed by the xmltv extension. For example, if the control file is named myEPG, the file with the data has to be named myEPG.xmltv.
    • The words file and pipe can optionally be followed by:
      • a semi-colon and the time of the day at which it has to be run
      • a semi-colon and a flag (0/1) to indicate whether the source needs a Pin
  • The second line contains the maximum number of days, the source is providing EPG-Data for.
  • Starting from the third line, each line specifies:
    • a channel ID present in the xmltv source
    • the channelname can optionally be followed by a semi-colon and any data the third-party source might want to put there; this data is ignored by the xmltv2vdr plugin

Examples of control files

Two example control files when the data is provided in the form of a stream to the xmltv2vdr plugin:

pipe
16
rtl.de;004
sat1.de;005
prosieben.de;006
pipe;00:00;1
10
rtl.de
sat1.de
prosieben.de

Here another example of a control file that provides the data in an xmltv file. If the control file is named for example myepg, the file with the epg data has to use the same name with the extension xmltv; in other words, it has to be named myepg.xmltv. Both files have to be located in the /var/lib/epgsources directory.

file
7
rtl.de
sat1.de
nickcomedy.de

Example of a simple executable file

Below is an example of a very simple executable file in the form of a bash script that provides the data in a file and not as a stream. It has to have the same name as the control file; for example if the control file is named myepg, the executable file also has to be named myepg. The executable file has to be located in the path with the executables; it can for example be saved into the /usr/bin directory. (Don't forget to set the executable bit on the binary file.)

#!/bin/sh
#
/usr/bin/logger "xmltv2vdr: myepg script started"
#
# Download epg
/usr/bin/logger "xmltv2vdr: downloading the epg data"
/usr/bin/wget -q -O /var/lib/epgsources/myepg.xmltv http://address.of.the.source/...
if [ $? -ne 0 ]
then
    /usr/bin/logger "xmltv2vdr: an error occurred while downloading the epg data - terminating script with error 1"
    exit 1
fi
#
# Exit with code 0; this tells xmltv2vdr that everything went ok and that it can import the data
/usr/bin/logger "xmltv2vdr: myepg.xmltv is ready for import by xmltv2vdr; quitting script with exit 0"
exit 0

Remark: The example does not adjust the channel IDs in the xmltv file to make them conformant. This is not necessary, if you don't use multiple sources that have different channel IDs for the same channel in their xmltv file. If you happen to switch to a different source with other channel IDs, the simplest is to stop the VDR and remove the xmltv2vdr channel settings from the setup.conf file of the VDR.

Enable the new source in xmltv2vdr

Once the new grabber has been installed, xmltv2vdr does not automatically import the data. The user has to configure to tell xmltv2vdr what channels to import and it has to map the channels from the xmltv file to the channels of the VDR. All this is done by going to the OSD of the xmltv2vdr plugin on the VDR.

  • On the main OSD screen of the xmltv2vdr plugin, navigate to the name of the grabber that you installed and select it. You will get the list of all the channel IDs present in the control file.
  • Select the channel IDs that you want xmltv2vdr to import.
  • Go back to the main OSD screen of the xmltv2vdr plugin. You will see the selected channel IDs below on the screen.
  • Select a channel ID. You will get to a new screen with a lot of settings for that channel ID. Here the two most important:
    • Choose between merge and create: merge only enhances the data of already existing epg data; thus if you have a channel on the VDR with no data, you have to choose create.
    • Navigate to the bottom of the screen and map what VDR channels correspond to the selected channel ID. It is also possible to map several VDR channels to one channel ID of the xmltv file.

More details about the xmltv file

  • The xmltv structure, that gets passed to the xmltv2vdr plugin has to be a valid xmltv structure. In the case of a file, the validity of the structure can checked by the tv_validate_file executable of xmltv.
  • There is an extension of the xmltv format for the Event-ID, that does not cause troubles to the validators cited above: the Event-ID, that in fact consists of only one number, is simply add as a category. (Please have a look at the following example.)


Example of a valid xmltv structure:

<?xml version="1.0" encoding="utf-8"?>
<tv generator-info-name="tvm2xmltv">
<channel id="rtl.de">
<display-name lang="de">rtl.de</display-name>
</channel>
<programme start="20110103002500 +0000" stop="20110103015500 +0000" channel="rtl.de" showview="6-851-241">
<title lang="de">Samba in Mettmann</title>
<title>Samba in Mettmann</title>
<desc lang="de">Eine attraktive Verlobte, ein sicherer Job ...</desc>
<credits>
<director>Angelo Colagrossi</director>
<actor>Doris Kunstmann</actor>
<actor>Hape Kerkeling</actor>
<writer>Angelo Colagrossi</writer>
<writer>Hape Kerkeling</writer>
<producer>Amo Müller</producer>
<producer>Matthias Wendlandt</producer>
<composer>Darius Zahir</composer>
<editor>Sabine Brose</editor>
</credits>
<date>2003</date>
<category lang="de">Spielfilm</category>
<category lang="de">Komödie</category>
<category lang="de">16023614</category>
<country>D</country>
<video>
<aspect>16:9</aspect>
</video>
<audio>
<stereo>dolby</stereo>
</audio>
<rating system="FSK"><value>6</value></rating>
<review type="text">Schade - Hape kanns eigentlich besser!</review>
</programme>
</tv>

List of already defined and binding channelnames

To avoid having the channelnames scattered around different pages or to have two list that are not always synchronised, the list will not be duplicated here. Please, use the list of the binding channelnames maintained at section 6.3 on the german wikipage of the xmltv2vdr plugin.

Links

  1. Plugin-Homepage
  2. XMLTV Homepage