#!/bin/sh # # Scipt to fetch all channels.conf from VDR-Wiki and from LinowSat # Written by Helmut Auer 2009 # VDR_WIKI_URL="http://www.vdr-wiki.de" LINOWSAT_URL="http://www.linowsat.de/settings/vdr" # recode Filter - set to "" if not needed or recode is not available RECODE="recode utf-8..latin1" function conv_chan() { FOUND=0 NAME="channels.conf.$1" [ -f "channels.conf.$NAME" ]&& rm "channels.conf.$NAME" echo "Checking $1 ..." if [ "$RECODE" != "" ] ; then CCN="$1.rec" cat "$1" | $RECODE > $CCN rm "$1" else CCN="$1" fi cat "$CCN" | while read i ; do if [ "$FOUND" = "0" ] ; then if [ "${i/h1 class=/}" != "$i" ] ; then NAME="${i#*>}" NAME=${NAME%<*} NAME=${NAME#* } NAME=${NAME// /-} NAME="${NAME//\//-}" NAME="${NAME//ä/ae}" NAME="${NAME//ö/oe}" NAME="$(echo "${NAME//ü/ue}" |sed -e "s/[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_\-]/_/g")" [ -f "channels.conf.$NAME" ]&& rm "channels.conf.$NAME" fi if [ "${i/
/}" != "$i" ] ; then
            FOUND=1
            i=${i#*
}
         fi
      fi
      if [ "$FOUND" = "1" ] ; then
         if [ "${i/<\/pre>/}" != "$i" ] ; then
            FOUND=0
            i=${i%
*} fi if [ "${i// /}" != "" ] ; then ln=${i//&/&} ln=${ln// / } echo "$ln" >> "channels.conf.$NAME" fi [ "$FOUND" = "0" ] && break fi done rm "$CCN" } if [ "$1" != "" ] ; then echo "Syntax: $0" echo " $0 will fetch all channellists from vdr-wiki and some from linowsat" echo " and pu these into the current directory" exit fi # get channels.conf from vdr-wiki for i in S C T ; do wget -O - "$VDR_WIKI_URL/wiki/index.php/DVB-${i}_channels.conf" 2>/dev/null | grep "Channels.conf.DVB${i}" | sed -e "s#a href=\"/wiki#a\nhref=\"/wiki#g" | grep "php/Channels.conf.DVB${i}" | cut -f 2,4 -d '"' | grep -v "TEMPLATE" | while read chan ; do LNK="$VDR_WIKI_URL/${chan%\"*}" NAME="${chan#*\"}" NAME="${NAME//\//-}" CC="channels.conf.html.${NAME#Channels.conf }" wget -O - "$LNK" 2>/dev/null > "$CC" conv_chan "$CC" done done # get channels.conf from linowsat wget -O channels.conf.DVBS-S19.2-Astra-FTA-Linowsat "$LINOWSAT_URL/0192/fta/channels.conf" wget -O channels.conf.DVBS-S19.2-Astra-All-Linowsat "$LINOWSAT_URL/0192/ca/channels.conf" wget -O channels.conf.DVBS-S19.2S13-Astra-Hotbird-FTA-Linowsat "$LINOWSAT_URL/01300192/fta/channels.conf" wget -O channels.conf.DVBS-S19.2S13-Astra-Hotbird-All-Linowsat "$LINOWSAT_URL/01300192/ca/channels.conf" wget -O channels.conf.DVBS-S19.2S13S28-Astra12-Hotbird-FTA-Linowsat "$LINOWSAT_URL/013001920282/fta/channels.conf" wget -O channels.conf.DVBS-S19.2S13S28-Astra12-Hotbird-All-Linowsat "$LINOWSAT_URL/013001920282/ca/channels.conf"