This is a "plugin" for the Video Disk Recorder (VDR).

Written by:                  Thomas Keil <tkeil@datacrystal.de>
                             Sascha Volkenandt <sascha@akv-soft.de>

Currently maintained by:
                             Markus Ehrnsperger ( MarkusE @ https://www.vdr-portal.de)

Previously Maintained by:
                             Dieter Hametner <dh+vdr@gekrumbel.de>
                             Christian Wieninger <cwieninger@gmx.de>
                             Jasmin Jessich <jasmin@anw.at>

Project's homepage:          https://github.com/MarkusEh/vdr-plugin-live
Project's old homepage:      http://live.vdr-developer.org

Latest version available at: https://github.com/MarkusEh/vdr-plugin-live

See the file COPYING for license information.


IMPORTANT:
==========

This version of LIVE does not support VDR versions older than 2.0.0
any more (maybe still some older VDR devel versions leading to VDR
2.0.0 but that is not tested).

The release_0-3-1 tag is the last commit by Dieter Hametner. It is was
the live version used by many distributions.


Description:
============

Live, the "Live Interactive VDR Environment", is a plugin providing the
possibility to interactively control the VDR and some of it's plugins by
a web interface.

Unlike external utility programs that communicate with VDR and it's plugins
by SVDRP, Live has direct access to VDR's data structures and is thus very
fast.


Requirements:
=============

VDR >= 2.0.0

gcc >= 4.8.1
PCRE >= 8.0.2     	- http://www.pcre.org/
Tntnet >= 1.5.3		- http://www.tntnet.org/download.hms
Cxxtools >= 1.4.3	- http://www.tntnet.org/download.hms

Tntnet provides basic webserver functions for live and needs cxxtools.
Boost provides some data structures we need. While currently relying on the
full blown package we might provide a stripped down version in the future.

PCRE provides filtering for recordings. Some older versions pcre-config tool
doesn't contain C++ wrapper option, but filtering support can be forced via
commandline:

make HAVE_LIBPCRECPP="-lpcrecpp -lpcre"


If you optionaly want to regenerate the i18n-generated.h header file
for backward compatible i18n (VDR version prior to 1.5.7) you also
need: (See also the Internationalization section below)

Locale::PO 		- perl module from CPAN www.cpan.org

The default i18n-generated.h header contains all
translations from GIT. Users that just want to stay on bleeding development
edge of live do not need Locale::PO installed.

How to get Locale::PO
- Use search function on www.cpan.org to obtain module.
- Check if your distribution provides the package.
  (e.g. in Debian the package name is liblocale-po-perl)

If you added new translations in your language specific .po file and
still want to use an VDR older than version 1.5.7 you must regenerate
i18n-generated.h by calling make with the target generate-i18n. Only
in this case you need to have Locale::PO installed on your system.


Installation:
=============

If you compile the plugin outside of the VDR source codes you must
copy the resulting binary to VDRs directory where the other plugins
are expected.

In order to work correctly you must copy the subdirectory 'live' from
the source distribution to the directory where the vdr plugins look
for their resource files. The pure VDR default for this config
directory is: /video/plugins, but this depends also from the
parameters -c or -v (see 'vdr --help' for details).

cp -a <live-src-dir>/live <vdr-resource-dir>/plugins


Setup
=====

Live provides a username/password protection, so that it can be used from
the internet. The default username and password are:

	admin/live

The default port is 8008.

You can also specifiy this parameter via commandline:

  -p PORT,  --port=PORT     use PORT to listen for incoming connections
                            (default: 8008)
  -i IP,    --ip=IP         bind server only to specified IP, may appear
                            multiple times
                            (default: 0.0.0.0, ::0)

Additional SSL options are available now. See "How to make LIVE listen
for ssl connections" section below on hints how to setup SSL.

To display images, you can use:

  -e <...>  --epgimages=/path/to/epgimages		use EPG images created by plugins like tvm2vdr
  -t <...>  --tvscraperimages=/path/to/tvscraperimages	use images created by tvscraper
Example:
  --tvscraperimages=/var/cache/vdr/plugins/tvscraper


The rest of the parameters can be adjusted in VDR's OSD or in the web
interface.

The password is stored as a MD5 hash.
"Last Channel" is the last channel in the channels list, that live displays.
This is especially useful if you have VDR's automatic channel update active.
For example, you can add a group seperator ":@1000 Found automatically" to
channels.conf an set this parameter to "1000". Thus, everything VDR finds
during scanning (which can after a few months be well more than 3000
channels) won't be displayed.


How to make LIVE listen for ssl connections
===========================================

To make LIVE listen for incoming ssl connections you`ll have to use a
Tntnet version > 1.6.0.6. By default it will listen on port 8443.

	* Example: https://localhost:8443

In order to start the SslListener LIVE requires a SSL certificate. If
no SSL certificate is specified via commandline option, LIVE will try
to use the default certificate location
'$VDRDIR/plugins/live/live.pem'.

If neither the default nor the custom certificate (given by the
commandline option) could be found, LIVE will only start the default
HTTP Listener (default: 8008)

Note: Since the gnutls SslListener was broken in Tntnet versions prior
to SVN revision 1035 you will have to recompile Tntnet with
"./configure --with-ssl=openssl" to make it work. Alternatively
install version 1.6.2 or higher of tntnet on your system.


SSL Commandline options
=======================

  -s PORT,  --sslport=PORT     use PORT to listen for incoming ssl connections
                               (default: 8443)
  -c CERT,  --cert=CERT        path to a custom ssl certificate file
  			       (default: $CONFIGDIR/live.pem)
  -k KEY,   --cert=CERT        path to a custom ssl certificate key file
  			       (default: $CONFIGDIR/live-key.pem)


Creating a self-signed SSL server certificate
=============================================

To create a self-signed certificate file you`ll have to run this litte
command.

  $> cd /put/your/path/here/vdr/plugins/live
  $> openssl req -new -x509 -keyout live-key.pem -out live.pem -days 365 -nodes

While generating the certifcate you`ll be asked to answer a couple of
questions.  When it prompts to enter the "Common Name" you`ll have to
specify the full qualified dns server name of the machine LIVE is
running on (eg. vdr.example.com).  If your vdr doesn`t have a full
qualified dns name, you should use the ip LIVE is listening on.

Note: This is just a quick'n dirty way to create a SSL self-signed
certicate.  Recent browsers (like Firefox 3) will complain about it
because the certificate wasn´t signed by a known Certificate Authority
(CA).


So how does LIVE work?
======================

Basically, Live itself is a Tntnet webserver integrated into the
plugin structure VDR needs.

This webserver, running in VDR's environment, is provided with all
public data structures VDR provides for plugins and thus has very fast
access to information like the EPG, timers or recordings.

Live's "pages" are written in "ecpp", a language integrating C++ and
HTML in one file, very much like e.g. PHP or ASP weave functionality
and "static" content information together.


Contribute!
===========
If you would like to contribute, please read doc/dev-contribute.txt
and doc/TODO.txt.


Internationalization (i18n)
===========================

LIVE uses the same i18n support like VDR does since version 1.5.7.
This version of LIVE can not support i18n compatible with VDR versions
older than 1.5.7.

All localization files are found in the po subdirectory of the LIVE
plugin source.


Security consideratios
======================

Live uses the tntnet MapUrl mechanism to map different request urls to
tntnet components. One component 'content.ecpp' delivers files found
in the file system. When given the wrong 'path' it could retrieve any
file from the server where live runs on.  Therefore content.ecpp has
beem enhanced to check the paths before returning files.  A second
measure against missuse is to limit the mappings from MapUrl to only
valid files. In the current version this approach has been taken. But
due to the 'difficulty' to fully understand regular expressions, this
might get spoiled again by 'unchecked' code contribution.

