| Main Information | |
| http://www.tvrage.com/quickinfo.php?show=Alias | Will give you information about the show Alias |
| Episode Information | |
| http://www.tvrage.com/quickinfo.php?show=Alias&ep=2x04 | Will give you information from Alias and the episode 4 from season 2 |
| Exact Information | http://www.tvrage.com/quickinfo.php?show=Show Name&exact=1 | Only shows that match exactly will be given. |
| Analyze Rules | |
| The Section And Information are split by "@". The Information for Latest/Next/episode information is split by "^" Possible Options Are:
| |
Usage: "$show_info = get_show("Show Name","exact","episode");"
Show Name: Name Of The Show
Exact: 0 or 1 value
Episode: SEASONxEPISODE (2x4)
Result
$show_info[0] // Show Name
$show_info[1] // Show URL
$show_info[2] // Show Premiere
$show_info[3] // Latest Episode
$show_info[4] // Next Episode
$show_info[5] // Episode Information
$show_info[6] // Episode URL
$show_info[7] // Show Country
$show_info[8] // Show Status
$show_info[9] // Show Classification
$show_info[10] // Show Genres
$show_info[11] // Show Network
$show_info[12] // Show Airtime
Begin Code
function get_show($show,$exact="",$episode="") {
if ( !$show ) { return FALSE; }
if ( $fp = fopen("http://www.tvrage.com/quickinfo.php?show=".urlencode($show)."&ep=".urlencode($episode)."&exact=".urlencode($exact),"r") )
{
while ( !feof($fp))
{
$line = fgets($fp,1024);
list ($sec,$val) = explode('@',$line,2);
if ($sec == "Show Name" )
{
$ret[0] = $val;
}
elseif ( $sec == "Show URL" )
{
$ret[1] = $val;
}
elseif ( $sec == "Premiered" )
{
$ret[2] = $val;
}
elseif ($sec == "Country" )
{
$ret[7] = $val;
}
elseif ( $sec == "Status" )
{
$ret[8] = $val;
}
elseif ( $sec == "Classification" )
{
$ret[9] = $val;
}
elseif ( $sec == "Genres" )
{
$ret[10] = $val;
}
elseif ( $sec == "Network" )
{
$ret[11] = $val;
}
elseif ( $sec == "Airtime" )
{
$ret[12] = $val;
}
elseif ( $sec == "Latest Episode" )
{
list ($ep,$title,$airdate) = explode('^',$val);
$ret[3] = $ep.", \"".$title."\" aired on ".$airdate;
}
elseif ( $sec == "Next Episode" )
{
list ($ep,$title,$airdate) = explode('^',$val);
$ret[4] = $ep.", \"".$title."\" airs on ".$airdate;
}
elseif ( $sec == "Episode Info" )
{
list ($ep,$title,$airdate) = explode('^',$val);
$ret[5] = $ep.", \"".$title."\" aired on ".$airdate;
}
elseif ( $sec == "Episode URL" )
{
$ret[6] = $val;
}
}
fclose($fp);
if ( $ret[0] )
{
return $ret;
}
}
else
{
return FALSE;
}
}
End Code
Example Perl Function
Usage: "@show_info = &get_show("Show Name","exact","episode");"
Show Name: Name Of The Show
Exact: 0 or 1 value
Episode: SEASONxEPISODE (2x4)
Result
$show_info[0] // Show Name
$show_info[1] // Show URL
$show_info[2] // Show Premiere
$show_info[3] // Latest Episode
$show_info[4] // Next Episode
$show_info[5] // Episode Information
$show_info[6] // Episode URL
$show_info[7] // Show Country
$show_info[8] // Show Status
$show_info[9] // Show Classification
$show_info[10] // Show Genres
$show_info[11] // Show Network
$show_info[12] // Show Airtime
Begin Code
# Including Perl Package
use LWP::Simple;
# Function
sub get_show {
my ($show) = $_[0];
my ($exact ) = $_[1];
my ($episode) = $_[2];
my @ret = "";
if ( $show ne "" )
{
my $site = get "http://www.tvrage.com/quickinfo.php?show=".$show."&ep=".$episode."&exact=".$exact;
foreach $line (split("\n",$site) )
{
my ($sec,$val) = split('\@',$line,2);
if ($sec eq "Show Name" )
{
$ret[0] = $val;
}
elsif ( $sec eq "Show URL" )
{
$ret[1] = $val;
}
elsif ( $sec eq "Premiered" )
{
$ret[2] = $val;
}
elsif ($sec eq "Country" )
{
$ret[7] = $val;
}
elsif ( $sec eq "Status" )
{
$ret[8] = $val;
}
elsif ( $sec eq "Classification" )
{
$ret[9] = $val;
}
elsif ( $sec == "Genres" )
{
$ret[10] = $val;
}
elsif ( $sec == "Network" )
{
$ret[11] = $val;
}
elsif ( $sec == "Airtime" )
{
$ret[12] = $val;
}
elsif ( $sec eq "Latest Episode" )
{
my($ep,$title,$airdate) = split('\^',$val);
$ret[3] = $ep.", \"".$title."\" aired on ".$airdate;
}
elsif ( $sec eq "Next Episode" )
{
my($ep,$title,$airdate) = split('\^',$val);
$ret[4] = $ep.", \"".$title."\" airs on ".$airdate;
}
elsif ( $sec eq "Episode Info" )
{
my($ep,$title,$airdate) = split('\^',$val);
$ret[5] = $ep.", \"".$title."\" aired on ".$airdate;
}
elsif ( $sec eq "Episode URL" )
{
$ret[6] = $val;
}
}
if ( $ret[0] )
{
return @ret;
}
else
{
return 0;
}
}
return 0;
}End Code