Postprocessing
Posted: Thu Oct 07, 2004 1:52 pm
Hi,
First up, thanks for the (very frequent) updates. You've managed to make the whole XMLTV thing a no-brainer for people in the UK.
For those who still need to do a bit more with the output, such as put the channels in a particular order or strip out sections I've got a quick method.
By using the DOS version of the UNIX sed command (I'm using GNU sed 4.0.7) you can make changes to the output file.
I use the following .bat file to download the listing - wait 2 minutes for it to finish - postprocess it with the parameters specified in the sedscript file.
download.bat
RadioTimes\xmltvrt.exe /grab
sleep 120
sed -f sedscript RadioTimes\data.xml > listing.xml
sedscript file
#sed script to fix xmltv
#fix seconds
s/ +0/00 +0/g
#fix channel order (id)
s/channel id="99"/channel id="01"/g
s/channel id="112"/channel id="02"/g
s/channel id="38"/channel id="03"/g
s/channel id="132"/channel id="04"/g
s/channel id="134"/channel id="05"/g
s/channel id="185"/channel id="06"/g
s/channel id="45"/channel id="07"/g
s/channel id="47"/channel id="10"/g
s/channel id="801"/channel id="12"/g
s/channel id="923"/channel id="19"/g
s/channel id="921"/channel id="20"/g
#fix channel order (programme)
s/channel="99"/channel="01"/g
s/channel="112"/channel="02"/g
s/channel="38"/channel="03"/g
s/channel="132"/channel="04"/g
s/channel="134"/channel="05"/g
s/channel="185"/channel="06"/g
s/channel="45"/channel="07"/g
s/channel="47"/channel="10"/g
s/channel="801"/channel="12"/g
s/channel="923"/channel="19"/g
s/channel="921"/channel="20"/g
The above script first adds seconds to all the programme times (not needed by me now that it is an option in the grabber) and second maps the channel ids from the Radio Times to the Freeview channel numbers (as this is the order I want them to list in DVR application I use).
sed could also be used to limit the number of days you give to your application, limit the fields (eg not including <credits>) or tweaking the field names so you application can display the info you want.
The above sedscript runs for me in about 2sec.
None of this would be necessary if all the applications we use had all the functions we want, but at least sed is a quick workaround.
Current setup:
Windows 2003 Server with 2 VisionPlus DVB-t cards
running WebScheduler and XMLTV Radio Times Grabber
allowing recording of about 6 channels at once
Serving recorded content and XMLTV data to
2 x xbox (XBMC)
1 x PC (Media Portal)
1 x PocketPC (XMLTV data only)
First up, thanks for the (very frequent) updates. You've managed to make the whole XMLTV thing a no-brainer for people in the UK.
For those who still need to do a bit more with the output, such as put the channels in a particular order or strip out sections I've got a quick method.
By using the DOS version of the UNIX sed command (I'm using GNU sed 4.0.7) you can make changes to the output file.
I use the following .bat file to download the listing - wait 2 minutes for it to finish - postprocess it with the parameters specified in the sedscript file.
download.bat
RadioTimes\xmltvrt.exe /grab
sleep 120
sed -f sedscript RadioTimes\data.xml > listing.xml
sedscript file
#sed script to fix xmltv
#fix seconds
s/ +0/00 +0/g
#fix channel order (id)
s/channel id="99"/channel id="01"/g
s/channel id="112"/channel id="02"/g
s/channel id="38"/channel id="03"/g
s/channel id="132"/channel id="04"/g
s/channel id="134"/channel id="05"/g
s/channel id="185"/channel id="06"/g
s/channel id="45"/channel id="07"/g
s/channel id="47"/channel id="10"/g
s/channel id="801"/channel id="12"/g
s/channel id="923"/channel id="19"/g
s/channel id="921"/channel id="20"/g
#fix channel order (programme)
s/channel="99"/channel="01"/g
s/channel="112"/channel="02"/g
s/channel="38"/channel="03"/g
s/channel="132"/channel="04"/g
s/channel="134"/channel="05"/g
s/channel="185"/channel="06"/g
s/channel="45"/channel="07"/g
s/channel="47"/channel="10"/g
s/channel="801"/channel="12"/g
s/channel="923"/channel="19"/g
s/channel="921"/channel="20"/g
The above script first adds seconds to all the programme times (not needed by me now that it is an option in the grabber) and second maps the channel ids from the Radio Times to the Freeview channel numbers (as this is the order I want them to list in DVR application I use).
sed could also be used to limit the number of days you give to your application, limit the fields (eg not including <credits>) or tweaking the field names so you application can display the info you want.
The above sedscript runs for me in about 2sec.
None of this would be necessary if all the applications we use had all the functions we want, but at least sed is a quick workaround.
Current setup:
Windows 2003 Server with 2 VisionPlus DVB-t cards
running WebScheduler and XMLTV Radio Times Grabber
allowing recording of about 6 channels at once
Serving recorded content and XMLTV data to
2 x xbox (XBMC)
1 x PC (Media Portal)
1 x PocketPC (XMLTV data only)