Difference between revisions of "MythTV and EPG Data"

From Blue-IT.org Wiki

(Prerequisites)
 
(33 intermediate revisions by 2 users not shown)
Line 9: Line 9:
  
 
=Xmltv_prisma=
 
=Xmltv_prisma=
 +
'''UPDATE: the automatic downloading of EPG Data is not allowed any more and dows not work due to changes on the webpage of tvprisma.de.'''
 +
--[[User:Apos|Apos]] 10:03, 4 October 2010 (CEST)
 +
----
 +
 
After a having a lot of problems with the xmltv grabber, my favorite grabber is [http://sfr.mythwiki.de/ xmltv_prisma]. It uses the [http://www.prisma.de/ webpage of the Prisma TV Guide].
 
After a having a lot of problems with the xmltv grabber, my favorite grabber is [http://sfr.mythwiki.de/ xmltv_prisma]. It uses the [http://www.prisma.de/ webpage of the Prisma TV Guide].
  
Line 37: Line 41:
 
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).
 
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).
  
=Secure Mythweb (german)=
+
== Script for running the grabber==
I got the next informations from a german wiki:[http://www.mythwiki.de/index.php?title=HOWTO_Mythweb-debian-updated#Absichern]
 
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
 
[...]
 
 
=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 ---------------------------------------------------------------------
+
===Script with defined offset===
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.
 
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.
  
Line 125: Line 57:
 
  XMLDIR="$HOME/.xmltv/xml"
 
  XMLDIR="$HOME/.xmltv/xml"
 
  DATE=`date +%F`
 
  DATE=`date +%F`
  DAYS=3
+
  DAYS=1
 
  OFFSET=$1
 
  OFFSET=$1
 +
chmod 770 $XMLDIR
 
   
 
   
  if [ ${OFFSET} -lt 1 ]
+
  if [ "${OFFSET}" = "" ]
  then
+
  then  
        echo Please specify an offset greater than 0.
+
echo WARNING: No offset specified.
        exit 1
+
echo WARNING: An offset of 0 will be assumed.
 +
OFFSET='0'
 +
else
 +
[ ${OFFSET} -lt 0 ] && OFFSET='0'
 
  fi
 
  fi
 
   
 
   
 
  echo ---------------------------------------------------------------------
 
  echo ---------------------------------------------------------------------
 
  echo This is user $USER on $HOSTNAME.
 
  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 $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
+
  echo "This is running $0 script at ${DATE} with offset of ${OFFSET} days." >> /var/log/mythtv/xmltv.log
 
   
 
   
 
  cd ~/.xmltv
 
  cd ~/.xmltv
Line 144: Line 80:
 
  XML=$XMLDIR/prisma_${DATE}-${OFFSET}.xml
 
  XML=$XMLDIR/prisma_${DATE}-${OFFSET}.xml
 
   
 
   
  tv_grab_de_prisma --days ${DAYS} --offset ${OFFSET} --slow --output $XML || exit 1
+
  tv_grab_de_prisma --days ${DAYS} --offset ${OFFSET} --output $XML || exit 0
 
   
 
   
 
  if [ -f $XML ]; then
 
  if [ -f $XML ]; then
     mythfilldatabase --update --no-delete --file 1 0 $XML || exit 1
+
     mythfilldatabase --update --file 1 $XML || exit 0
    #mythfilldatabase --update --no-delete --file 1 -1 $XML
 
 
  fi
 
  fi
 
   
 
   
  exit 0
+
sleep 5
 +
 +
  exit 1
 +
 
 +
It will be invoked running as '''user mythtv''' using something like
 +
ssh mythtv@localhost
 +
mythtv@mythbackend# for day in 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ; \
 +
    do /bin/bash ~/.xmltv/xmltv_prisma_offset.sh $day; done
 +
 
 +
=== Use with cron ===
 +
To grab the data every day in the early morning (5 o'clock) you can use cron.
  
 
Change to user root and edit your crontab entry with
 
Change to user root and edit your crontab entry with
  crontab -e
+
  crontab -e -u mythtv
  
 
Than add the following data
 
Than add the following data
 +
# m h  dom mon dow  command
 
  ## Mythtv EPG Daten grabben
 
  ## Mythtv EPG Daten grabben
  0       5       *       *       1       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 0"
+
  0 5 * * 1 for day in 0 1 2 3; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done
  0       5       *       *       2       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 2"
+
  0 5 * * 2 for day in 4 5 6 7; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done
  0       5       *       *       3       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 4"
+
  0 5 * * 3 for day in 8 9 10 11; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done
  0       5       *       *       4       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 6"
+
  0 5 * * 4 for day in 12 13 14 15; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done
  0       5       *       *       5       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 8"
+
  0 5 * * 5 for day in 16 17 18 19; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done
  0       5       *       *       6       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 10"
+
  0 5 * * 6 for day in 20 21 22 23; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done
  0       5       *       *       7       su mythtv -c "sh /home/mythtv/.xmltv/xmltv_prisma_offset.sh 12"
+
  0 5 * * 7 for day in 24 25 26 27; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done
 
 
  
 
I use the following scheme to grab the data.
 
I use the following scheme to grab the data.
Line 194: Line 139:
 
                         |>offset 12
 
                         |>offset 12
 
                         |---|---|---|---|---|---|---|---|---|---|---|---o---o---o
 
                         |---|---|---|---|---|---|---|---|---|---|---|---o---o---o
 +
 +
=Secure Mythweb (german)=
 +
I got the next informations from a german wiki:[http://www.mythwiki.de/index.php?title=HOWTO_Mythweb-debian-updated#Absichern]
 +
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
 +
[...]
 +
 +
= Troubleshooting =
 +
== Database cannot connect ==
 +
Considering a master backend without frontend the following settings are crucial.
 +
 +
=== mythtv-setup ===
 +
Both ip's in the gneral setting page 1 ''MUST'' point to the servers ip address (''NOT'' 127.0.0.1).
 +
 +
=== database->mythconverg->settings table ===
 +
Attention:
 +
* "OLDPASSWORD" is really written into the field ''hostname''
 +
* "NULL" means this is a NULL field (e.g you have to '''check''' the ''null'' checkbox field in e.g. phpmyadmin)
 +
* Even if the backend server ip settings is the real server ip, here 127.0.0.1 is the right setting.
 +
''value''                ''data''            ''hostname''
 +
BackendServerIP  127.0.0.1  OLDPASSWORD
 +
BackendServerPort 6543         OLDPASSWORD
 +
BackendStatusPort 6544         OLDPASSWORD
 +
MasterServerIP 192.168.0.3 NULL
 +
MasterServerPort 6543         NULL
 +
RecordFilePrefix /mythtv/tv NULL
 +
 +
=== /root/.mythtv ===
 +
'''config.xml'''
 +
<Configuration>
 +
  <UPnP>
 +
    <UDN>
 +
      <MediaRenderer>04f9028d-752c-45e1-abca-534adaf8a8ba</MediaRenderer>
 +
    </UDN>
 +
    <MythFrontend>
 +
      <DefaultBackend>
 +
        <USN>uuid:04f9028d-752c-45e1-abca-534adaf8a8ba::urn:schemas-upnp-org:device:MediaServer:1</USN>
 +
        <SecurityPin></SecurityPin>
 +
<DBHostName>localhost</DBHostName>
 +
        <DBUserName>mythtv</DBUserName>
 +
        <DBPassword>mythtv</DBPassword>
 +
        <DBName>mythconverg</DBName>
 +
        <DBPort>3306</DBPort>
 +
      </DefaultBackend>
 +
    </MythFrontend>
 +
  </UPnP>
 +
</Configuration>
 +
 +
'''mysql.txt'''
 +
DBHostPing=no
 +
DBHostName=localhost
 +
DBUserName=mythtv
 +
DBPassword=PASSWORD
 +
DBName=mythconverg
 +
DBType=
 +
 +
=== /home/mythtv/.mythtv/ ===
 +
'''mysql.txt'''
 +
DBHostName=localhost
 +
DBHostPing=no
 +
DBUserName=mythtv
 +
DBPassword=PASSWORD
 +
DBName=mythconverg
 +
DBType=QMYSQL3
 +
 +
== Error editing videos- No Seektable ==
 +
Myhttv stores the information about video length and seeks in an external databse, called ''seek table'' (see [http://www.gossamer-threads.com/lists/mythtv/users/226752#226752] 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 databas=e 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 doing the job.
 +
 +
=Mytharchive=
 +
==Mythtranscode not found==
 +
On Ubuntu there exists a bug [https://bugs.launchpad.net/ubuntu/+source/mythtv/+bug/92703 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 [https://bugs.launchpad.net/ubuntu/+source/mythplugins/+bug/118700 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 (''chown -R mythtv:mythtv'').
 +
 +
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');
 +
 +
 +
[[Category:MythTV]]

Latest revision as of 20:08, 8 January 2012

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

UPDATE: the automatic downloading of EPG Data is not allowed any more and dows not work due to changes on the webpage of tvprisma.de. --Apos 10:03, 4 October 2010 (CEST)


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

Script for running the grabber

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=1
OFFSET=$1
chmod 770 $XMLDIR

if [ "${OFFSET}" = "" ]
then 
	echo WARNING: No offset specified. 
	echo WARNING: An offset of 0 will be assumed.
	OFFSET='0'
else
	[ ${OFFSET} -lt 0 ] && OFFSET='0'
fi

echo ---------------------------------------------------------------------
echo This is user $USER on $HOSTNAME.
echo "This is running $0 script at ${DATE} with offset of ${OFFSET} days."
echo "This is running $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}  --output $XML || exit 0

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

sleep 5

exit 1

It will be invoked running as user mythtv using something like

ssh mythtv@localhost
mythtv@mythbackend# for day in 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ; \
   do /bin/bash ~/.xmltv/xmltv_prisma_offset.sh $day; done

Use with cron

To grab the data every day in the early morning (5 o'clock) you can use cron.

Change to user root and edit your crontab entry with

crontab -e -u mythtv

Than add the following data

# m h  dom mon dow   command
## Mythtv EPG Daten grabben
0 5 * * 1 for day in 0 1 2 3; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done
0 5 * * 2 for day in 4 5 6 7; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done
0 5 * * 3 for day in 8 9 10 11; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done
0 5 * * 4 for day in 12 13 14 15; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done
0 5 * * 5 for day in 16 17 18 19; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done
0 5 * * 6 for day in 20 21 22 23; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done
0 5 * * 7 for day in 24 25 26 27; do /bin/bash /home/mythtv/.xmltv/xmltv_prisma_offset.sh $day; done

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 [...]

Troubleshooting

Database cannot connect

Considering a master backend without frontend the following settings are crucial.

mythtv-setup

Both ip's in the gneral setting page 1 MUST point to the servers ip address (NOT 127.0.0.1).

database->mythconverg->settings table

Attention:

  • "OLDPASSWORD" is really written into the field hostname
  • "NULL" means this is a NULL field (e.g you have to check the null checkbox field in e.g. phpmyadmin)
  • Even if the backend server ip settings is the real server ip, here 127.0.0.1 is the right setting.
value                 data            hostname
BackendServerIP  	127.0.0.1  	OLDPASSWORD
BackendServerPort 	6543 	        OLDPASSWORD
BackendStatusPort 	6544 	        OLDPASSWORD
MasterServerIP 	192.168.0.3 	NULL
MasterServerPort 	6543 	        NULL
RecordFilePrefix 	/mythtv/tv 	NULL

/root/.mythtv

config.xml

<Configuration>
  <UPnP>
    <UDN>
      <MediaRenderer>04f9028d-752c-45e1-abca-534adaf8a8ba</MediaRenderer>
    </UDN>
    <MythFrontend>
      <DefaultBackend>
        <USN>uuid:04f9028d-752c-45e1-abca-534adaf8a8ba::urn:schemas-upnp-org:device:MediaServer:1</USN>
        <SecurityPin></SecurityPin>
	<DBHostName>localhost</DBHostName>
        <DBUserName>mythtv</DBUserName>
        <DBPassword>mythtv</DBPassword>
        <DBName>mythconverg</DBName>
        <DBPort>3306</DBPort>
      </DefaultBackend>
    </MythFrontend>
  </UPnP>
</Configuration>

mysql.txt

DBHostPing=no
DBHostName=localhost
DBUserName=mythtv
DBPassword=PASSWORD
DBName=mythconverg
DBType=

/home/mythtv/.mythtv/

mysql.txt

DBHostName=localhost
DBHostPing=no
DBUserName=mythtv
DBPassword=PASSWORD
DBName=mythconverg
DBType=QMYSQL3

Error editing videos- No Seektable

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 databas=e 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 doing the job.

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 (chown -R mythtv:mythtv).

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');