; Get TV Data
alias GetTVData {
sockopen checktv www.tvrage.com 80
}
on *:sockopen:checktv: {
sockwrite checktv GET www.tvrage.com/quickinfo.php?show= $+ %checktv $+ &exact=1 $+ $crlf
}
on *:sockread:checktv: {
;if (. !isin $read(release.txt, 9)) { halt }
if ($sockerr) { return }
var %data
sockread %data
set %show.name $gettok(%data,2,64)
while ((!$sockerr) && ($sockbr)) {
%checktv.data = %checktv.data $+ %data
sockread %data
if (url isin %data) { set %show.url $gettok(%data,2,64) }
if (country isin %data) { set %show.country $gettok(%data,2,64) }
if (classification isin %data) { set %show.type $gettok(%data,2,64) }
if (genres isin %data) { set %show.genres $replace($remove($gettok(%data,2,64),$chr(32)),$chr(124),.) }
if (premiered isin %data) { set %show.prem $gettok(%data,2,64) }
if (status isin %data) { set %show.status $gettok(%data,2,64) }
}
}
on *:sockclose:checktv:{
if ( %show.type != "" && %show.type != $null ) {
writeini -n %extradatafile TV %prerls $+( %show.type, $chr(124), %show.country, $chr(124), %show.genres, $chr(124), %show.prem, $chr(124), %show.status )
}
unset %checktv*
unset %show*
}