[mythtv-users] A tv_grab_uk_bleb grabber

Chris Moore zmower at ntlworld.com
Tue Feb 3 19:35:29 EST 2004


Small fix.  I'd put http://<domain>/ instead of just domain.  Doh.
You can see some bits in the EPG now but not all of it.  <shrugs>

I'll have to put up a webpage for this stuff..

Chris

-- 
Sig pending!

-------------- next part --------------
#!/bin/bash
# 0.1 02/02/04 Initial release.  Fills the db.
# 0.2 04/02/04 Remove http:// etc from around domain name.  See bits in EPG.

# Configure this!  Choose from channels in ALL_CHANNELS.
MY_CHANNELS="bbc1 bbc2 itv1 itv2"

declare -a -r ALL_CHANNELS=(bbc1 bbc2 bbc3 bbc4 bbc7 bbc_6music bbc_news24 bbc_radio1 bbc_radio1_xtra bbc_radio2 bbc_radio3 bbc_radio4 bbc_radio5_live bbc_radio5_live_sports_extra boomerang bravo british_eurosport cartoon_network cbbc cbeebies ch4 challenge discovery e4 film_four five ftn itv1 itv2 nickelodeon paramount scifi sky_cinema sky_movies1 sky_movies2 sky_movies3 sky_movies4 sky_movies5 sky_movies6 sky_movies7 sky_movies8 sky_one sky_one_mix sky_sports1 sky_sports3 uk_bright_ideas uk_drama uk_gold uk_gold2 uk_history uk_horizons uk_style)

declare -a -r CHANNEL_URLS=(bbc1.bbc.co.uk bbc2.bbc.co.uk bbc3.bbc.co.uk bbc4.bbc.co.uk bbc7.bbc.co.uk bbc_6music news-24.bbc.co.uk radio-1.bbc.co.uk bbc_radio1_xtra radio-2.bbc.co.uk radio-3.bbc.co.uk radio-4.bbc.co.uk radio-5.bbc.co.uk bbc_radio5_live_sports_extra boomerang.cartoonnetwork.com bravo.co.uk british.eurosport.com uk.cartoonnetwork.com cbbc.bbc.co.uk cbeebies.bbc.co.uk channel4.com challengetv.co.uk discoveryeurope.com e4.channel4.com filmfour.channel4.com channel5.co.uk ftn itv1.itv.co.uk itv2.itv.co.uk nickelodeon.co.uk paramountcomedy.com uk.scifi.com 1.cinema.sky.com 1.movies.sky.com 2.movies.sky.com 3.movies.sky.com 4.movies.sky.com 5.movies.sky.com 6.movies.sky.com 7.movies.sky.com 8.movies.sky.com sky-one.sky.com sky_one_mix 1.sports.sky.com 3.sports.sky.com uk_bright_ideas uk-drama.flextech.telewest.co.uk uk-gold.flextech.telewest.co.uk uk-gold-2.flextech.telewest.co.uk uk_history uk-horizons.flextech.telewest.co.uk uk-style.flextech.telewest.co.uk)

TEMP_FILE=`tempfile -s .xml`

function findURL() {
  local CHAN=$1
  local -i i=0
  # Assumes CHAN is in ALL_CHANNELS
  while [[ ! ${ALL_CHANNELS[i]} = $CHAN ]]; do
    let i++
  done
  # URL occupies corresponding position in the other array.
  echo "${CHANNEL_URLS[i]}"
}

# Form the XML file with the channel to URL mappings
# and the program data.
DATE=`date`
cat > $TEMP_FILE << EOF1
<?xml version="1.0" encoding="UTF-8"?>
<!-- produced for the bleb.org TV system at $DATE -->
<root>
EOF1

for CHANNEL in $MY_CHANNELS; do

  URL=`findURL $CHANNEL`
  cat >> $TEMP_FILE << EOF2
<xmltvid blebid="$CHANNEL">$URL</xmltvid>
EOF2

done

# Get the XML files from bleb, delete the first two lines
# and append them to the tempfile.
for CHANNEL in $MY_CHANNELS; do
  wget --user-agent="bleb2xmltv (zmower at ntlworld.com)" --output-document=- http://www.bleb.org/tv/data/listings/0/$CHANNEL.xml | sed -e '1,2d' >> $TEMP_FILE
#  cat $CHANNEL.xml | sed -e '1,2d' >> $TEMP_FILE
  sleep 2
done

cat >> $TEMP_FILE << EOF3
</root>
EOF3

# Do the transform.
xsltproc -o $6 /usr/share/xmltv/tv_grab_uk_bleb/bleb2xmltv.xsl $TEMP_FILE


More information about the mythtv-users mailing list