NexTView Import
This How-To describes a procedure to harvest EPG data for MythTV using the Next View protocol. This method is only intersting for those who have access to the european continent. This data is not sent in the rest of the world.
Contents
Required Software
nxtvepg - This software provides an interface to the Next View protocol, both in console and as a GUI (X) application. 2.7.5 should be the lowest version that you should install.
Setup and Testing
Get the latest software as described above. Now start nxtvepg to do some tests. Try to get your EPG data. If this works, you can exit nxtvepg. Now try to harvest data to be exported to XMLTV format. This is done with the following command:
nxtvepg -daemon -acqonce full -provider d92 -nodetach
This runs nxtvepg without GUI and aquires the provider d92 (Kabel1 in Germany) and leaves the console locked until the harvesting is done. Now we will try to export the harvested data to a XML file.
nxtvepg -provider d92 -dump xml > /tmp/nxtvepgtest.xml
You should now have a file in /tmp of about 1 Megabyte size. Open it up in your favorite editor to check for correcness. Note down the IDs for each channel, as you might need these later on.
Automatic import channel data
The following script should scan for channels and add these to MythTV. I recommend using this only if you have not added channels manually:
autochannel.sh: Code: #!/bin/bash # Scan tv source for channel information and insert it into MythTV's database # Written by zagibu@gmx.ch # Distributed under the terms of the GNU General Public License v2 # Date: 21.05.2005 version=v0.1 command_list="scantv mysql head tail cut wc" autochannel=scantvdump_$(date +\%d).txt # Verify that each command we use exists for command in $command_list; do path=$(which $command | grep "no $command in") if [ ! -x $(which $command) -a "$path" ]; then echo -e "\n\nERROR: $command not found! Check your \$command_lis t and/or your \$PATH" exit -1 fi done echo -e "\nScanner $version" echo "============" # Scan input for channel information and dump it into a file scantv -a -f europe-west -n PAL -o $autochannel # Count lines of scantv dump lines=$(cat $autochannel | wc -l | cut -f1 -d' ') # Subtract amount of header lines (7) lines=$(expr $lines - 7) # Read each channel entry of scantv dump for (( i=0; i<$lines; i=$i+3 )) do chanid=$(expr $(expr $i + 3) / 3) channum=CH$chanid freqid=$(tail -n$(expr $lines - $(expr $i + 1)) $autochannel | head -n1 | cut -f3 -d' ') name=$(tail -n$(expr $lines - $i) $autochannel | head -n1) name=$(echo $name | cut -f2 -d'[' | cut -f1 -d']') callsign=$(cat cnilist | grep "=$name=" | cut -f3 -d'=') xmltvid=$(cat cnilist | grep "=$name=" | cut -f1 -d'=') # Insert gathered channel info into mythtv's db mysql -umythtv -pmythtv mythconverg -e"INSERT INTO channel (chanid, channum, freqid, sourceid, callsign, name, xmltvid, tvformat) VALUES ($chanid, '$cha nnum', '$freqid', 1, '$callsign', '$name', '$xmltvid', 'PAL');" done
Channel list
Following list of channels should be extended to include those you might need:
cnilist: Code: CNI04C1=SRG Schweizer Fernsehen SF 1=SF 1 CNI04C7=SRG Schweizer Fernsehen SF 2=SF 2 CNI04CC=SFi=SFi CNI0DC1=ARD=ARD CNI0DC2=ZDF=ZDF CNI0DC7=3sat=3SAT CNI0D85=Arte=ARTE CNI0DC9=ARD/ZDF Kinderkanal=[[Ki Ka]] CNI0DCB=BR-3 Landesweit=BR 3 CNI0DFE=MDR-3 Landesweit=MDR3 CNI0DE0=SW 3 Baden-W�rttemberg=SW 3 CNI1DE6=WDR-3 Landesweit=WDR3 CNI0D8D=Deutsches Sportfernsehen=DSF CNI0D91=Eurosport=EUSP CNI0D92=Kabel 1=KAB1 CNI0D8C=n-tv=NTV CNI0487=Pro 7=PRO7 CNI0DAB=RTL=RTL CNI0D8F=RTL 2=RTL2 CNI0DB9=SAT 1=SAT1 CNI0D8A=Super RTL=SRTL CNI0D8E=VOX=VOX CNI0AC1=ORF 1=ORF1 CNI0AC2=ORF 2=ORF2 CNI04C2=SSR T�l�vis. Suisse TSR 1=TSR1 CNI04C8=SSR T�l�vis. Suisse TSR 2=TSR2 CNI33F1=TF1=TF 1 CNI33F2=France 2=FR 2 CNI33F3=France 3=FR 3 CNI33F6=M6=M6 CNI33F8=RTL 9=RTL9 CNIF500=TV5=TV 5 CNI04C3=SSR Televis. svizzera TSI 1=TSI1 CNI04C9=SSR Televis. svizzera TSI 2=TSI2 CNI3901=RAI 1=RAI1 CNI3902=RAI 2=RAI2 CNIFA05=Canale 5=CNL5 CNIFA06=Italia 1=IT 1 CNIFA04=RETE 4=RET4 ???????=TRT-1=TRT1 ???????=BBC Prime=BBC1 ???????=RTP1=RTP1 ???????=Star TV=STAR ???????=CNN International=CNNI ???????=Canal+=CNL+ ???????=Nord-3 (NDR/SFB/RB)=N3 ???????=NEUN LIVE=9LIV
Add nxtvepg data and Sync Clock
The following scrip allows to automate the process we tested above of harvesting epg data. Make sure to change the provider code.
#!/bin/bash # Get time and epg data from teletext, then insert it into MythTV's database # Written by zagibu@gmx.ch # Distributed under the terms of the GNU General Public License v2 # Date: 21.05.2005 version=v0.1 command_list="nxtvepg hwclock mythfilldatabase" epgdump=nxtvepgdump_$(date +\%d).txt # verify that each command we use exists for command in $command_list; do path=$(which $command | grep "no $command in") if [ ! -x $(which $command) -a "$path" ]; then echo -e "\n\nERROR: $command not found! Check your \ $command_list and/or your $PATH" exit -1 fi done echo "Adjusting time (using teletext as reference)..." # Set system time to current teletext time nxtvepg -clock set # Save system time to hardware clock hwclock --systohc echo "Acquiring NexTView EPG from provider SF 1..." # Acquire [[Next View]] EPG from provider "SF 1" nxtvepg -acqonce full -daemon -nodetach -provider 04C1 # Dump current EPG data into a file (xmltv5 format must be set in .nxtvepgrc) nxtvepg -dump xml -provider 04C1 > $epgdump echo "Loading [[Next View]] EPG data into MythTV..." # Insert EPG data into MythTV's database mythfilldatabase --file 1 -1 $epgdump echo "All processes completed. Enjoy your [[Myth Box]]!"
About
This Howto is based on serveral forum threads: