Difference between revisions of "NexTView Import"
m (→Acquiring EPG-data and Sync Clock) |
m (changed channel in the script) |
||
Line 240: | Line 240: | ||
# Remember to change this to your NexTView provide of choice | # Remember to change this to your NexTView provide of choice | ||
− | echo "* * Acquiring NexTView EPG from provider | + | echo "* * Acquiring NexTView EPG from provider Kabel 1... started `date +%k:%M` * *" |
− | nxtvepg -acqonce full -daemon -nodetach -provider | + | nxtvepg -acqonce full -daemon -nodetach -provider 0D92 |
# Dump current EPG data into a file (xmltv5 format must be set in .nxtvepgrc) | # Dump current EPG data into a file (xmltv5 format must be set in .nxtvepgrc) | ||
echo "* finished acquiring `date +%k:%M` *" | echo "* finished acquiring `date +%k:%M` *" | ||
− | nxtvepg -dump xml -provider | + | nxtvepg -dump xml -provider 0D92 > $epgdump |
echo "Loading [[Next View]] EPG data into MythTV..." | echo "Loading [[Next View]] EPG data into MythTV..." |
Revision as of 03:33, 3 April 2008
This How-To describes a procedure to harvest EPG data for MythTV using the nexTView protocol. This method is only interesting for those who have access to the European continent. This data is not sent in the rest of the world.
Note: With MythTV trunk and 0.21 the --file command used in the scripts below no longer accepts the <offset> argument (-1).
Note: The scripts and methods used to import Nextview data into MythTV shown on this page are not officially supported or recommended. The preferred solution would be to create a fully XMLTV compliant grabber. This would be much easier to setup and changes within mythtv would not require scripts to be changed or re-written.
Contents
Required Software
nxtvepg - This software provides an interface to the nexTView protocol, both in console and as a GUI (X) application. 2.7.5 should be the lowest version that you should install.
Install 'nxtvepg'
sudo apt-get install nxtvepg
Install 'scantv'
sudo apt-get install scantv
Setup and Testing
Get the latest software as described above. Now start 'nxtvepg' to do some tests, try to get your EPG data.
nxtvepg
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 acquires the provider d92 (Kabel1 in Germany) and leaves the console locked until the harvesting is done. Be patient - this may take a long time (in the range of 20 minutes to 50min). 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 correctness. Note down the IDs for each channel, as you might need these later on.
Scripts
At first copy these 2 Scripts and the cnilist to a folder e.g. /home/yourname/epg give the them the name they have. After that, come back here and follow the rest of the How to.
Channel list
Following list of channels should be extended to include those you might need:
# CNI-Code | Name (must fit to scantvdump and is Case Sensitive) | callsign # This list is based on SF 1, you may have to change to your needs. CNI04C1=SF 1=SF 1 CNI04C7=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=BR 3 CNI0DFE=MDR-3 Landesweit=MDR3 CNI0DE0=SW 3 Baden-Wuerttemberg=SW 3 CNI1DE6=WDR-3 Landesweit=WDR3 CNI0D8D=DSF=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=TSR 1=TSR1 CNI04C8=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=TSI 1=TSI1 CNI04C9=TSI 2=TSI2 CNI3901=RAI 1=RAI1 CNI3902=RAI 2=RAI2 CNIFA05=Canale 5=CNL5 CNIFA06=Italia 1=IT 1 CNIFA04=RETE 4=RET4 CNI9001=TRT-1=TRT1 CNI0DD4=Nord-3 (NDR/SFB/RB)=N3 CNI0DBA=NEUN LIVE=9LIV CNI0DCF=Hessischer Rundfunk=HR 3 CNI0D82=Radio Berlin-Brandenburg=RBB CNI0D88=VIVA 1=VIVA CNI0D7A=N 24=N24 CNI0D78=Tele 5=Tele5 ???????=BBC Prime=BBC1 ???????=RTP1=RTP1 CNI0x0486=Star TV=STAR CNI0x01F2=CNN International=CNNI ???????=Canal+=CNL+ CNI0x0481=TeleZüri=TZ
Automatic import channel data
The following script scans for channels then combines the channels with the cnilist and adds these to MythTV.
To test it run the command: (for Hauppauge read further down)
scantv -o /home/yours/scantv_output
Hauppauge PVR owner
I testet the script with PVR-350 and PVR-500(2x150inside). I had to do this change in the script:
# Scan input for channel information and dump it into a file #scantv -a -f europe-west -n PAL-BGH -o $autochannel # comment out the line above for PVR and use this instead scantv -a -f europe-west -n PAL-BGH -c /dev/video0 -C /dev/vbi0 -o $autochannel
The script autochannel.sh will run a full scan and takes 30 - 60min, you will see the lines in the bash passing by, while scanning. In the path you start it, it will create a file called scantvdump_(day-number).txt .
It is recommended using this only if you have not added channels manually, this is because it will mix up your already entered channels.
If you can live with it, go ahead.
First you need to make it executeable sudo chmod 777 autochannel.sh. Then enter your
password in this script (it is in the 4 line before bottom) for the MySQL-Database you can find it in /etc/mythtv/mysql.txt.
#!/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 # Script update: 27.01.2008 added line for HPG PVR's, MySQl options changed to REPLACE, hint about password, removed CH for channel entry 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_list 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-BGH -o $autochannel # comment out the line above for PVR and use this instead #scantv -a -f europe-west -n PAL-BGH -c /dev/video0 -C /dev/vbi0 -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=$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 # If you use the short option form (-p), you CANNOT have a space between the option and the password mysql -u mythtv -pyour_passw -D mythconverg -e"INSERT INTO channel (chanid, channum, freqid, sourceid, callsign, name, xmltvid, tvformat) VALUES ($chanid, '$channum', '$freqid', 1, '$callsign', '$name', '$xmltvid', 'PAL');" done
Acquiring EPG-data and Sync Clock
The following script allows to automate the process we tested above of harvesting EPG-data. Make sure to change the provider code - see nexTView Provider Table
First you need to make it executeable sudo chmod 777 harvest.sh
It must be tested (started/run) as myth-user otherwise you don't have the rights to write into database and so on. Go to the to the directory you saved it and start it with:
./harvest.sh
While it is acquiring data, you can stop it any time with Ctrl+c to see if it works instead of waiting 20-50min.
To let MythTV use this script simply adjust Configuration - General - Mythfilldatabase accordingly:
- change mythfilldatabase Path to /where/you/copied/harvest.sh
- change mythfilldatabase Log Path to /where/you/copied/harvest.log to check if it works
- modify mythfilldatabase Execution Start & End (keep in mind that nxtvepg might block your tv-card while running)
#!/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 # Script update: 27.01.2008 added start-/finshtime to print 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 # Remember to change this to your NexTView provide of choice echo "* * Acquiring NexTView EPG from provider Kabel 1... started `date +%k:%M` * *" nxtvepg -acqonce full -daemon -nodetach -provider 0D92 # Dump current EPG data into a file (xmltv5 format must be set in .nxtvepgrc) echo "* finished acquiring `date +%k:%M` *" nxtvepg -dump xml -provider 0D92 > $epgdump echo "Loading [[Next View]] EPG data into MythTV..." # Insert EPG data into MythTV's database, do not add more channels mythfilldatabase --update --file 1 $epgdump echo "All processes completed. Enjoy your [[Myth Box]]!"
experiences - problems
27. Jan. 2008, by Tido, I tested it with Mythbuntu 7.10 PVR-500 and PVR-350 it runs fine. Aferwards I worked a lot on this page to make it better for the next. So please leave comment here.
About
This Howto is based on serveral forum threads: