Difference between revisions of "MythTV and EPG Data"

From Blue-IT.org Wiki

(Mytharchive)
(Solution)
Line 237: Line 237:
 
The solution is:
 
The solution is:
  
Manually edit the mythconverg/settings table and fill in the real name of your frontends network name. This solution works on ubuntu feisty (7.04) - both backend and frontend.
+
Exclude all other problems and '''manually edit the mythconverg/settings''' table and fill in the real name of your frontends network name. This solution works on ubuntu feisty (7.04) - both backend and frontend.
 
 
E.g.:
 
  
 
1. Your mythtv masterbackend servers name/ip is:  backendserver  / 192.168.0.10
 
1. Your mythtv masterbackend servers name/ip is:  backendserver  / 192.168.0.10

Revision as of 14:41, 24 June 2007

MyhtTV

MythTV is the well known linux HPTC software.

One of the major advantages is the availability of an electronic program guide, that is fetched from grabbing tv-guide web pages with an external program: the 'grabber'.

On of the major problems setting up the mythtv program guide is, that the 'grabbers' are not part of myhttv and it is not trivial to install them.

None of these grabbers - for a list see xmltv - runs out of the box after installation.

Xmltv_prisma

After a having a lot of problems with the xmltv grabber, my favorite grabber is xmltv_prisma. It uses the webpage of the Prisma TV Guide.

Alter the mythtv channels table

The very first thing you have to do is to add an 'xmltvid' to each channel in the table 'channels' in the mythtv database. This database is named per default is 'mythconverg'.

What is the 'xmltvid' for a certain channel? Very easy. It is exact the string that you can read in your configuration file after you called

tv_grab_de_prisma --configure --gui

This file is located per default in '~/.xmltv/tv_grab_de_prisma.conf'. It looks like this

[...] 
channel 3.br-online.de #BR
channel 3sat.de #3SAT
channel ard.de #ARD
channel arte-tv.com #arte
channel dsf.com #DSF
channel einsplus.ard.de #Einsplus (ARD digital)
channel eurosport.de #Eurospor
[...]

The string after channel is the 'xmltvid'. The following command will give you these id's (uses mawk):

cat /home/whoever/.xmltv/tv_grab_de_prisma.conf  | mawk '{gsub(/^channel /,"");system("echo " $0 "")}'

You have to enter it manually into your database.

This could be done ether by editing the table with e.g. phpmyadmin or add them into the 'configuration' page of 'mythweb' (a plugin for myhttv).

Two scripts for running the grabber

Usual script

The following script grabs all program data for four weeks! this could last more than one day on a pc with slow cpu.

#!/bin/sh
ACTUAL_PATH='pwd'
XMLDIR="$HOME/.xmltv/xml"
DATE=`date +%F`
DAYS=7 
echo ---------------------------------------------------------------------
echo This is user $USER on $HOSTNAME running `pwd`/$0 script.
echo "`pwd`/$0 script running at ${DATE} grabbing data for next ${DAYS} days."
echo "`pwd`/$0 script running at ${DATE} grabbing data for next ${DAYS} days." >>  /var/log/mythtv/xmltv.log

cd ~/.xmltv
[ -d $XMLDIR ] || mkdir -p $XMLDIR

#for offset in 0;
for offset in 0 7 14 21;
do

XML=$XMLDIR/prisma_${DATE}-${offset}.xml

#tv_grab_de_prisma --days ${DAYS} --offset $offset --slow --output $XML
tv_grab_de_prisma --days ${DAYS} --offset $offset --slow --output $XML

if [ -f $XML ]; then
   mythfilldatabase --update --no-delete --file 1 0 $XML
   #mythfilldatabase --update --no-delete --file 1 -1 $XML
fi
done

Script with defined offset

The next script I use in conjunction with several crontab entries. It grabs only 3 days an runs every day. The script uses an offset parameter that controls the prisma grabber to grab date in future.

Prerequisites

The following scripts imply that you

  • have a fully configured tv_grab_de_prisma
  • use /home/mythtv/.xml/ directory to store the data and scripts
  • know how to edit your crontab as root
#!/bin/sh
ACTUAL_PATH='pwd'
XMLDIR="$HOME/.xmltv/xml"
DATE=`date +%F`
DAYS=3
OFFSET=$1

if [ ${OFFSET} -lt 1 ]
then
       echo Please specify an offset greater than 0.
       exit 1
fi

echo ---------------------------------------------------------------------
echo This is user $USER on $HOSTNAME.
echo "This is running `pwd`/$0 script at ${DATE} with offset of ${OFFSET} days."
echo "This is running `pwd`/$0 script at ${DATE} with offset of ${OFFSET} days." >> /var/log/mythtv/xmltv.log

cd ~/.xmltv
[ -d $XMLDIR ] || mkdir -p $XMLDIR

XML=$XMLDIR/prisma_${DATE}-${OFFSET}.xml

tv_grab_de_prisma --days ${DAYS} --offset ${OFFSET} --slow --output $XML || exit 1

if [ -f $XML ]; then
   mythfilldatabase --update --no-delete --file 1 0 $XML || exit 1
   #mythfilldatabase --update --no-delete --file 1 -1 $XML
fi

exit 0

Change to user root and edit your crontab entry with

crontab -e

Than add the following data

## Mythtv EPG Daten grabben
0       5       *       *       1       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 0"
0       5       *       *       2       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 2"
0       5       *       *       3       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 4"
0       5       *       *       4       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 6"
0       5       *       *       5       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 8"
0       5       *       *       6       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 10"
0       5       *       *       7       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 12"


I use the following scheme to grab the data.

|> = day where the grabber runs with a defined offset
|  = offset days
o  = days that will be really grabbed
Mo  Di  Mi  Do  Fr  Sa  So  Mo  Di  Mi  Do  Fr  Sa  So  Mo  Di  Mi  Do  Fr  Sa  So

|>offset 0
o---o---o

    |>offset 2
    |---|---o---o---o

        |>offset 4
        |---|---|---|---o---o---o

            |>offset 6
            |---|---|---|---|---|---o---o---o

                |>offset 8
                |---|---|---|---|---|---|---|---o---o---o      

                    |>offset 10
                    |---|---|---|---|---|---|---|---|---|---o---o---o

                        |>offset 12
                        |---|---|---|---|---|---|---|---|---|---|---|---o---o---o


Secure Mythweb (german)

I got the next informations from a german wiki:[1] After you installed mythweb, the following points should be considered.

[...] Damit Digest überhaupt funktioniert, muss der Apache entsprechend konfiguriert sein.

Unter Debian Sarge mit Apache 1.3.x genügt hierzu ein

echo "LoadModule digest_auth_module /usr/lib/apache/1.3/mod_auth_digest.so" \

>> /etc/apache/modules.conf

Für apache2 geht es folgendermaßen:

a2enmod auth_digest
a2enmod authn_file
a2enmod authz_user
/etc/init.d/apache2 force-reload               

Die .htaccess mit dem Editor öffnen:

vi /usr/share/mythtv/mythweb/.htaccess

Folgender Auszug muss auskommentieren werden:

AuthType           Digest
AuthName           "MythTv"
AuthDigestFile     /var/www/htdigest <- UNBEDINGT IN /var/htdigest ÄNDERN! 
Require            valid-user

Dies bedeutet, dass wir mit dem Tool htdigest eine Datei mit dem Namen /var/htdigest anlegen müssen. Im Gegensatz zur alten Methode spielt hier allerdings auch die AuthName-Zeile eine Rolle, die bei htdigest unter der Bezeichnung Realm (zu deutsch: Bereich) angegeben werden muss.

htdigest akzeptiert laut man-page folgende Parameter:

htdigest [ -c ] passwdfile realm username

was uns also im konkreten Beispiel zu folgender Befehlszeile führt (mit verändertem Pfad):

htdigest -c /var/htdigest MythTV mythtv

Achtung! Die Option -c überschreibt die angegebene Datei, also Vorsicht! Danach ruft man die mythweb.php erneut auf und loggt sich mit seinem Usernamen(hier: mythtv) und dem angegebenen Passwort ein [...]

Error editing videos- No Seeltable

Myhttv stores the information about video length and seeks in an external databse, called seek table (see [2] for a detailed explanation).

If you get the error no seektable, when you like to edit your videos, this is because mythtv has no data about the length of your video. There are several ways to fix this.

Check, if you mysql seektable database is o.k.

mysqlcheck -u mythtv -p -r  mythconverg  recordedseek

If you get the output

mythconverg.recordedseek        OK

Then everything is fine. If not, you should run

mysqlcheck -u mythtv -p --auto-repair  mythconverg  recordedseek && \
mysqlcheck -u mythtv -p -r  mythconverg  recordedseek

Now you should start the commercial detection (as user mythtv) with

mythcommflag --rebuild -f  1501_20070601004300.mpg

1501_20070601004300.mpg is a sample filename for a recording.

Now you should be able to edit you video as usual ;)

A Trick for advanced linuxers: If you have a gigabit connection to your mythtv box and a fast machine, you can mount your myhttv box via nfs and then chroot into it. You can start mythcommflag in that chroot environment and it will use the processor power of your faster machine for

Mytharchive

Mythtranscode not found

On Ubuntu there exists a bug bug #92703. Mythtranscode is part of the mythbackend package. So if you are running mytharchive on the frontend and myhthtranscode fails simply install mythbackend package without configuring it.

sudo apt-get install mythbackend

Error when using mytharchive on seperate frontend

On june/2007 I tried to use mythtarchive on my frontend machine for burning a dvd. The system crashed with the following error:

[...]
AttributeError: 'NoneType' object has no attribute 'endswith'

The reason for this behaviour is, that mytharchive assumes, masterbackend and frontend server are running on the same machine. So the mythconverg database settings table points to the wrong server, when running mytharchive on a sperate frontend machine.

Solution

I googled arround and found bug #118700.

The solution is:

Exclude all other problems and manually edit the mythconverg/settings table and fill in the real name of your frontends network name. This solution works on ubuntu feisty (7.04) - both backend and frontend.

1. Your mythtv masterbackend servers name/ip is: backendserver / 192.168.0.10

2. Your mythtv frontend servers name/ip is: mypc / 192.168.0.5

3. Your backend/frontend servers are configured properly and are working together, user for mysql is mythtv and the password is set to mythtv.

4. The problem might be, that you forget to share the tv-data directory via nfs on both machines. Each paths must be identically and readable for the machine! An /etc/fstab entry on the frontend machine could look like this:

#/etc/fstab
#
[...]
backendserver:/mythtv/tv  /mythtv/tv  nfs  rw,intr,bg,rsize=8192,wsize=8192,user        0       0

Make sure, that the permissions are set correctly. Configure your nfs server on the master backend accordingly e.g:

#/etc/exports
[...]
/mythtv/tv frontendserver(rw,sync,no_root_squash,no_subtree_check)

Additionally it might be usefull to use acl's if your backend runs on different users and make the dierectories read/writable for a common group mythtv . Make shure, that the GID for this group is the same among all machines.

5. The temporary space has enough space and is writable for the frontend. This is also configured in mytharchive settings page.

6. Do the following or manually edit the mythconverg/settings table:

root@mypc$ mysql -h mythtv -u mythtv -p mythconverg
root@mypc$ mysql> insert into settings (value, data, hostname) VALUES ('RecordFilePrefix', '/mythtv/tv', 'backendserver');