Main Page‎ > ‎

Mythtv

Mythtv

Contents

 [hide]

install mythtv

Note that I do not use the following sources:

deb http://dijkstra.csh.rit.edu:8088/~mdz/debian woody mythtv
deb-src http://dijkstra.csh.rit.edu:8088/~mdz/debian woody mythtv

because it is not meant for the epia M 9000 (compiled for pentiumpro architecture) and I want to have a single installation for my M1000 and M9000 boxes.

Important note

In order to have mythtv working with the VIA CLE266 MPEG decoding engine you _*need*_ to run both mythbackend and mythtv as _*root*_ otherwise all you will get a black screen and a big fat segfault. Gryle revealed me that it comes from the fact that libddmpeg has some hardware I/O instructions (inb or outb) and only root or the kernel is allowed to do that. The solution would be to integrate that part of the code in the kernel (via_v4l_drv module) or in the X server...

  • get latest cvs snapshot:
cvs -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs login
passwd: 'mythtv'
cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythtv
cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythgallery
cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythgame
cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythmusic
cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythvideo
cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythweather
cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythweb
cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythnews
cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythbrowser
  • for all users add in their path:
export PATH=/opt/mythtv:${PATH}:
export PATH=${PATH}:/usr/share/qt3
export QTDIR=/usr/lib/qt3
  • build the core and plugins. In order to avoid conflict with a classical debian package and also in order to enable an easy removal, mythtv is installed in directory /opt/mythtv-cvs
apt-get install libqt3-mt-dev libqt3c102 libqt3c102-mt libqt3c102-mt-mysql libxft-dev

cd mythtv
cp settings.pro settings.pro.new
cp settings.pro.orig settings.pro
cp settings.pro settings.pro.orig
cvs -z3 update -dP
perl -pi -e "s/PREFIX = .*$/PREFIX = \/opt\/mythtv-cvs/g" settings.pro
perl -pi -e "s/-march=pentiumpro/-march=c3/g" settings.pro
perl -pi -e "s/EXTRA_LIBS \+= -L\/usr\/X11R6\/lib/EXTRA_LIBS += -L\/opt\/X11R6\/lib -L\/usr\/X11R6\/lib/g" settings.pro
perl -pi -e "s/#CONFIG \+= using_alsa/CONFIG += using_alsa/g" settings.pro
perl -pi -e "s/#ALSA_LIBS = -lasound/ALSA_LIBS = -lasound/g" settings.pro
perl -pi -e "s/#CONFIG \+= using_lirc/CONFIG += using_lirc/g" settings.pro
perl -pi -e "s/#LIRC_LIBS = -llirc_client/LIRC_LIBS = -llirc_client/g" settings.pro
perl -pi -e "s/#CONFIG \+= using_viahwslice/CONFIG += using_viahwslice/g" settings.pro
perl -pi -e "s/#DEFINES \+= USING_VIASLICE/DEFINES += USING_VIASLICE/g" settings.pro
perl -pi -e "s/#EXTRA_LIBS \+= -lddmpeg/EXTRA_LIBS += -lddmpeg/g" settings.pro
./configure
qmake mythtv.pro
make
make install
mysql -uroot -prootmysqlpasswd < ./database/mc.sql
cp setup/setup /opt/mythtv-cvs/bin/mythtv-setup
  • create /etc/init.d/mythbackend inspired from contrib/etc.rc.d.init.d.mythbackend but tailored to debian
update-rc.d mythbackend defaults
  • mysql root passwd is empty: how to change it:
/usr/bin/mysqladmin -u root password 'rootmysqlpasswd'
mysql -uroot -prootmysqlpasswd < /usr/share/mythtv/sql/mc.sql
mysql -uroot -prootmysqlpasswd
  grant all on mythconverg.* to mythtv@"localhost" identified by "mythtv";
  quit
  • mythvideo turn
cd mythvideo
cp settings.pro settings.pro.new
cp settings.pro.orig settings.pro
cp settings.pro settings.pro.orig
cvs -z3 update -dP
perl -pi -e "s/PREFIX = .*$/PREFIX = \/opt\/mythtv-cvs/g" settings.pro
perl -pi -e "s/-march=pentiumpro/-march=c3/g" settings.pro
qmake mythvideo.pro
make
make install
mysql -umythtv -pmythtv < mythvideo-0.12/videodb/metadata.sql
  • mythgallery turn
cd mythgallery
cp settings.pro settings.pro.new
cp settings.pro.orig settings.pro
cp settings.pro settings.pro.orig
cvs -z3 update -dP
perl -pi -e "s/PREFIX = .*$/PREFIX = \/opt\/mythtv-cvs/g" settings.pro
perl -pi -e "s/-march=pentiumpro/-march=c3/g" settings.pro
qmake mythgallery.pro
make
make install
mysql -umythtv -pmythtv < mythgallery-0.12/database/gallery.sql
  • mythweather turn
cd mythweather
cp settings.pro settings.pro.new
cp settings.pro.orig settings.pro
cp settings.pro settings.pro.orig
cvs -z3 update -dP
perl -pi -e "s/PREFIX = .*$/PREFIX = \/opt\/mythtv-cvs/g" settings.pro
perl -pi -e "s/-march=pentiumpro/-march=c3/g" settings.pro
qmake mythweather.pro
make
make install
  • mythmusic turn
cd mythmusic
apt-get install libmad0-dev libid3tag0-dev libvorbis-dev libflac-dev libflac-dev libcdaudio0-dev libid3tag0-dev fftw-dev libcdparanoia0-dev
cp settings.pro settings.pro.new
cp settings.pro.orig settings.pro
cp settings.pro settings.pro.orig
cvs -z3 update -dP
perl -pi -e "s/PREFIX = .*$/PREFIX = \/opt\/mythtv-cvs/g" settings.pro
perl -pi -e "s/-march=pentiumpro/-march=c3/g" settings.pro
./configure --enable-all
qmake mythmusic.pro
make
make install
#cd musicdb
#mysql -u root < metadata.sql
mysql -umythtv -pmythtv < mythmusic-0.12/musicdb/metadata.sql
vi ~mythtv/.cdserverrc
adduser mythtv cdrom
  • mythdvd turn
cd mythdvd
cp settings.pro settings.pro.new
cp settings.pro.orig settings.pro
cp settings.pro settings.pro.orig
cvs -z3 update -dP
perl -pi -e "s/PREFIX = .*$/PREFIX = \/opt\/mythtv-cvs/g" settings.pro
perl -pi -e "s/-march=pentiumpro/-march=c3/g" settings.pro
apt-get install a52dec-dev libdvdread3-dev libfame-dev
./configure --enable-transcode --enable-vcd
qmake mythdvd.pro
make
make install
mysql -umythtv -pmythtv < mythdvd-0.12/dvddb/metadata.sql
  • mythnews turn
cd mythnews
cp settings.pro settings.pro.new
cp settings.pro.orig settings.pro
cp settings.pro settings.pro.orig
cvs -z3 update -dP
perl -pi -e "s/PREFIX = .*$/PREFIX = \/opt\/mythtv-cvs/g" settings.pro
perl -pi -e "s/-march=pentiumpro/-march=c3/g" settings.pro
qmake mythnews.pro
make
make install
  • mythgame turn
cd mythgame
apt-get install fceu-sdl fceu-doc zsnes xmame xmame-x
cp settings.pro settings.pro.new
cp settings.pro.orig settings.pro
cp settings.pro settings.pro.orig
cvs -z3 update -dP
perl -pi -e "s/PREFIX = .*$/PREFIX = \/opt\/mythtv-cvs/g" settings.pro
perl -pi -e "s/-march=pentiumpro/-march=c3/g" settings.pro
qmake mythgame.pro
make
make install
mysql -umythtv -pmythtv < mythgame-0.12/gamedb/metadata.sql
mysql -umythtv -pmythtv < mythgame-0.12/gamedb/nesdb.sql
mysql -umythtv -pmythtv < mythgame-0.12/gamedb/snesdata.sql
  • mythweb turn
cd mythweb
mkdir /usr/local/share/mythweb
cp -dprf . /usr/local/share/mythweb
vi /etc/apache/httpd.conf

add line at the end:

Alias /mythweb/ /usr/local/share/mythweb/

Edit the /var/www/html/mythweb/config/conf.php file if required. By default, MythWeb uses an Apache .htaccess file to restrict access to the website and to configure some variables. To create the password file for Apache (if your system doesn't already have one), you could do something like this:

cd /var/www
htpasswd -c htpasswd mythtv
New password: mynewpasswd
Re-type new password: mynewpasswd
  • mythbrowser turn
cd mythbrowser
apt-get install kdelibs4 kdelibs4-dev
cp settings.pro settings.pro.new
cp settings.pro.orig settings.pro
cp settings.pro settings.pro.orig
cvs -z3 update -dP
perl -pi -e "s/PREFIX = .*$/PREFIX = \/opt\/mythtv-cvs/g" settings.pro
perl -pi -e "s/-march=pentiumpro/-march=c3/g" settings.pro
qmake mythbrowser.pro
make
make install

Configure mythtv

mysql -uroot -prootmysqlpasswd < databases/mc.sql
mysql -uroot -prootmysqlpasswd
  grant all on mythconverg.* to mythtv@"localhost" identified by "mythtv";
  quit
su - mythtv
#cp /etc/mythtv/mysql.txt .
cp /opt/mythtv-cvs/share/mythtv/mysql.txt ~mythtv/.mythtv
# edit mysql.txt -> DBPassword=mythtv
mkdir store record gallery music
  • run mythtv-setup and define general setup capture card source and link capture card tuner to source and use the following external script to change channels: /usr/local/bin/ptune.pl
  • create a .xawtv file containing the exact frequencies of your channels:
defaults
color = 32768
bright = 36000
hue =  32768
contrast = 32000
norm = SECAM
source = Television
freqtab = france

#
# Channel options
#
TF1
channel = 50

France2
channel = 52

France3
channel = 55

Canal+
channel = 63
fine = 4
capture = grab

Arte
channel = 47
fine = 1

M6
channel = 68

Planete
channel = 23
fine = 2

Serie club
channel = 26
fine = 2

RTL9
channel = 29
fine = 2

LCI
channel = 31
fine = 2

Jimmy
channel = 34
fine = 2

TMC
channel = 36
fine = 3

Eurosport
channel = 39
fine = 2

MCM
channel = 42
fine = 2

Odyssee
channel = 44
fine = 2

Teva
channel = 45
fine = 2

MTV
channel = 58
fine = 3

Info sports
channel = 60
fine = 2

Paris premiere
channel = 66
  • identify source id of your cardinput using
mysql -uroot -prootmysqlpasswd
use mythconverg
select * from cardinput\G
*************************** 1. row ***************************
    cardinputid: 8
         cardid: 10
       sourceid: 13
      inputname: Tuner 0
externalcommand: /usr/local/bin/chchan.sh
     preference: NULL
      shareable: N
       tunechan: 50
      startchan: 50
1 row in set (0.01 sec)

here sourceid is 13

  • and then populate database (substitute 13 by your sourceid):
mythfilldatabase --xawchannels 13 .xawtv
  • verify acquisition
mysql -uroot -prootmysqlpasswd
use mythconverg
select xmltvid from channel;
mysql> select xmltvid from channel;
+----------------+
| xmltvid        |
+----------------+
| TF1            |
| France2        |
| France3        |
| Canal+         |
| Arte           |
| M6             |
| Planete        |
| Serie club     |
| RTL9           |
| LCI            |
| Jimmy          |
| TMC            |
| Eurosport      |
| MCM            |
| Odyssee        |
| Teva           |
| MTV            |
| Info sports    |
| Paris premiere |
+----------------+
19 rows in set (0.00 sec)
  • perform adjustments if required e.g.:
mysql> update channel set xmltvid='France2' where name='France 2';
mysql> update channel set xmltvid='France3' where name='France 3';
mysql> update channel set xmltvid='France5/Arte' where freqid=30;
mysql> update channel set callsign='France 5 / Arte' where xmltvid='France5/Arte';
mysql> update channel set name='France 5 / Arte' where xmltvid='France5/Arte';
mysql> update channel set xmltvid='France2' where name='France 2';
mysql> update channel set xmltvid='France3' where name='France 3';
mysql> update channel set xmltvid='France5' where freqid=30;
mysql> update channel set callsign='France 5' where xmltvid='France5';
mysql> update channel set name='France 5' where xmltvid='France5';
mysql> insert into channel values('1031','31','31','1','Arte','Arte',NULL, '0',NULL,'Arte','0','32768','32768','32
mysql> update channel set channum='30' where name='Arte';
mysql> update channel set freqid='30' where name='Arte';
  • verify a last time
mysql> select channum,sourceid,callsign,name,xmltvid from channel;
+---------+----------+----------------+----------------+----------------+
| channum | sourceid | callsign       | name           | xmltvid        |
+---------+----------+----------------+----------------+----------------+
| 50      |       13 | TF1            | TF1            | TF1            |
| 52      |       13 | France2        | France2        | France2        |
| 55      |       13 | France3        | France3        | France3        |
| 63      |       13 | Canal+         | Canal+         | Canal+         |
| 47      |       13 | Arte           | Arte           | Arte           |
| 68      |       13 | M6             | M6             | M6             |
| 23      |       13 | Planete        | Planete        | Planete        |
| 26      |       13 | Serie club     | Serie club     | Serie club     |
| 29      |       13 | RTL9           | RTL9           | RTL9           |
| 31      |       13 | LCI            | LCI            | LCI            |
| 34      |       13 | Jimmy          | Jimmy          | Jimmy          |
| 36      |       13 | TMC            | TMC            | TMC            |
| 39      |       13 | Eurosport      | Eurosport      | Eurosport      |
| 42      |       13 | MCM            | MCM            | MCM            |
| 44      |       13 | Odyssee        | Odyssee        | Odyssee        |
| 45      |       13 | Teva           | Teva           | Teva           |
| 58      |       13 | MTV            | MTV            | MTV            |
| 60      |       13 | Info sports    | Info sports    | Info sports    |
| 66      |       13 | Paris premiere | Paris premiere | Paris premiere |
+---------+----------+----------------+----------------+----------------+
19 rows in set (0.00 sec)
tv_grab_fr > allprogs.xml
  • tv_grab_fr uses a horrid Windows font that replaces a-grave with an r-acute. Change the font:
cat allprogs.xml | sed 's/Windows-1250/ISO-8859-1/g'  > myprogs.xml
  • If have one station for France 5 / Arte should do this instead
cat allprogs.xml | sed 's/\"Arte\"/\"France5\/Arte:\"/g' | sed 's/\"France5\"/\"France5\/Arte:\"/g' | sed 's/Windows-1250/ISO-8859-1/g'  > myprogs.xml
  • Now fill the program guide (13 is my sourceid)
mythfilldatabase --file 13 -1 myprogs.xml
  • This version leaves channel data in place
mythfilldatabase --update --file 13 -1 prog.xml
rm allprogs.xml myprogs.xml

tv_grab_fr > allprogs.xml
cat allprogs.xml | sed 's/Windows-1250/ISO-8859-1/g'  > myprogs.xml
cat myprogs.xml | sed 's/France5/Arte/g' > finalprogs.xml
mythfilldatabase --file 13 -1 finalprogs.xml

Debian init script

  • create the following /etc/init.d/mythbackend script
#! /bin/sh
#
# mythbackend
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/mythtv-cvs/bin/mythbackend
NAME=mythbackend
DESC="mythbackend"
MBE_LOGFILE="/var/tmp/mythbackend.log"

test -x $DAEMON || exit 0

set -e

case "$1" in
  start)
        echo -n "Starting $DESC: $NAME"
        $DAEMON -v all -d -l ${MBE_LOGFILE} &
        echo "."
        ;;
  stop)
        echo -n "Stopping $DESC: $NAME "
        killall $DAEMON
        echo "."
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop}" >&2
        exit 1
        ;;
esac

exit 0
  • make it executable on boot update-rc.d mythbackend defaults

Compilation on both ezra and nehemiah architectures

Finally I decided to make a custom compilation for both architectures. The overall idea is to do the following (warning untested yet):

#!/bin/sh

disp()
{
  echo "$@" >&1
}

warn()
{
  echo "WARNING: $@" >&2
}

die()
{
  echo "FAILURE: $@" >&2
  exit 1
}

 $# -ne 1  && die "Usage : $0 <arch>
where <arch> stands for ezra or nehemiah"

arch=$1

#arch=ezra
#arch=nehemiah

mkdir /opt/mythtv-$arch
ln -s /opt/mythtv-$arch /opt/mythtv-cvs

export PATH=/opt/mythtv:${PATH}:
export PATH=${PATH}:/usr/share/qt3
export QTDIR=/usr/lib/qt3

#echo passwd: 'mythtv'
#cvs -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs login
#for module in mythtv mythvideo mythgallery mythweather mythmusic mythdvd mythgame mythweb mythbrowser mythnews
#do
#  cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout $module || die "checkout failed on $module"
#done

for module in mythtv mythvideo mythgallery mythweather mythmusic mythdvd mythgame mythweb mythbrowser mythnews
do
  echo =======================================================================
  echo compiling $module
  echo =======================================================================
  cd $module
  make distclean
  rm settings.pro
  cvs -z3 update -PAd || die "update failed on $module"
  case $arch in
  ezra)
    perl -pi -e "s/PREFIX = .*$/PREFIX = \/opt\/mythtv-ezra/g" settings.pro
    perl -pi -e "s/-march=pentiumpro/-march=c3 -mmmx -m3dnow/g" settings.pro
    ;;
  nehemiah)
    perl -pi -e "s/PREFIX = .*$/PREFIX = \/opt\/mythtv-nehemiah/g" settings.pro
    perl -pi -e "s/-march=pentiumpro/-march=i686 -msse -mmmx/g" settings.pro
    ;;
  esac
  case $module in
  mythtv)
    perl -pi -e "s/EXTRA_LIBS \+= -L\/usr\/X11R6\/lib/EXTRA_LIBS += -L\/opt\/X11R6\/lib -L\/usr\/X11R6\/lib/g" settings.pro
    perl -pi -e "s/#CONFIG \+= using_alsa/CONFIG += using_alsa/g" settings.pro
    perl -pi -e "s/#ALSA_LIBS = -lasound/ALSA_LIBS = -lasound/g" settings.pro
    perl -pi -e "s/#CONFIG \+= using_lirc/CONFIG += using_lirc/g" settings.pro
    perl -pi -e "s/#LIRC_LIBS = -llirc_client/LIRC_LIBS = -llirc_client/g" settings.pro
    perl -pi -e "s/#CONFIG \+= using_viahwslice/CONFIG += using_viahwslice/g" settings.pro
    perl -pi -e "s/#DEFINES \+= USING_VIASLICE/DEFINES += USING_VIASLICE/g" settings.pro
    perl -pi -e "s/#EXTRA_LIBS \+= -lddmpeg/EXTRA_LIBS += -lddmpeg/g" settings.pro
    ./configure
    ;;
  mythmusic)
    ./configure --enable-all
    ;;
  mythdvd)
    ./configure --enable-transcode --enable-vcd
    ;;
  esac

  qmake ${module}.pro
  make && make install

  case $module in
  mythtv)
    cp setup/setup /opt/mythtv-${arch}/bin/mythtv-setup
    ;;
  esac

  cd ..
done
Comments