#!/bin/sh
#
# Author: Pr2 for http://www.oscam.to
# Date: 2011-09-30
#
clear
DATFILE="package.list"
echo "Downloading package list from KingOfSat.net"
echo "-------------------------------------------"
wget -O  ${DATFILE} http://en.kingofsat.net/packages.php

		awk -F '>' 'BEGIN { package="none" }
		/target="_blank">/ {	packdisname = substr($3,1,length($3)-3)
			}
		/<TD><A class="A3">/ {	packdisname = substr($3,1,length($3)-3)
			}	
		/<A class="bld" HREF=/ {  
					packurl = substr($4,22,length($4)-22)
					if ( length(packurl) == 0) next
					packcountry = substr($2,1,length($2)-4)	
					printf "# %-25s|%-20s|%s\n", packdisname, packcountry, packurl
							packdisname="NONE"
							packcountry="NONE"
							packurl="NONE"
							next
				}' ${DATFILE} > srvidking.cfg
echo "Done"
echo "--------------------------------------------------------------------"
echo " ** Please edit the file srvidking.cfg and remove "
echo " ** the # from the lines with the packages that you want to generate"
echo "--------------------------------------------------------------------"

