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:
                             Dieter Hametner <dh+vdr@gekrumbel.de>
                             Christian Wieninger <cwieninger@gmx.de>

Project's homepage:          http://live.vdr-developer.org

Latest version available at: http://live.vdr-developer.org

See the file COPYING for license information.


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

This is the last version of LIVE which will work with Tntnet <
1.6.0.6.

Since Nov 17 2007 version 1.6.0.6 of Tntnet has been released with new
features and binary incompatible changes. This version of LIVE works
with that version and still maintains backwards compatibilty to older
versions of Tntnet.

Future versions of LIVE will start to use the new Tntnet
features. This means that backwards compatibility can not be
maintained from that point in time onwards.

We therefore strongly suggest you upgrade to Tntnet with at least
version 1.6.0.6. This new Tntnet version is supported by the current
version of LIVE. Just update Tntnet and recompile LIVE from scratch.


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 >= 1.4.0-2

gcc >= 3.1
if gcc < 4.0:
boost >= 1.32.0		- http://www.boost.org
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 configuration 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 <plugin-config-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)

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

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 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)
===========================

Since the release of VDR 1.5.7 the way how VDR (and its plugins) are
localized changed dramatically. The system now uses GNU gettext. This
has the advantage that more languages can be supported. Also the
translations are now local to a language specific message file. So
simultaneous translations of different languages are much better
supported. Message files are located in the po subdirectory.

The downside to this is that, in order to provide new live-plugin
versions for VDR versions less than 1.5.7, it means one has to
maintain old i18n.c file and the new message files. Since this would
be an ongoing source of complications we decided to actively support
only the new internationalization scheme from VDR 1.5.7 and above.

To be able to support versions of VDR prior to 1.5.7 we generate a
backward compatible i18n-generated.h file from the new message
files. This generation step is *not* done automatically on every
build. It is only neccessary if the localized strings have changed or
if translations have been added. So if one of above is true you can
regenerate i18n-generated.h with the make target 'generate-i18n' prior
to creating the live plugin. In this case you need the CPAN perl
module Locale::PO installed on your system.


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.
