Created
November 12, 2010 02:11
-
-
Save raytiley/673618 to your computer and use it in GitHub Desktop.
nowPlaying.php Revambed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Configure Script | |
$server = "http://frontdoor.ctn5.org/"; //include trailing backslash | |
$channelID = 1; //Cablecast Channel ID | |
$defualtSource = "Community Bulletin Board"; | |
date_default_timezone_set("America/New_York"); | |
//End Configure | |
$server = $server."CablecastWS/CablecastWS.asmx?WSDL"; | |
$client = new SoapClient($server); | |
//Some funky Time Calculations | |
$offset = 0; | |
$day = 60*60*24; | |
$currentDay = date("Y-m-d")."T00:00:00"; | |
$currentDayTime = date("Y-m-d")."T".date("H:i:s"); | |
$convertedDayTime = strtotime($currentDayTime); | |
$searchTimestr = $convertedDayTime-$day+($offset * 60 * 60); | |
$searchTime = date("Y-m-d", $searchTimestr)."T".date("H:i:s", $searchTimestr); | |
$result = $client->GetScheduleInformation(array( | |
'ChannelID' => $channelID, | |
'FromDate' => $currentDay, | |
'ToDate' => $searchTime, | |
'restrictToShowID' => 0)); | |
$resultNumber = count($result->GetScheduleInformationResult->ScheduleInfo); | |
if($resultNumber == 0) | |
{ | |
echo $defualtSource; | |
} | |
if($resultNumber == 1) | |
{ | |
echo $defualtSource; | |
} | |
if($resultNumber > 1) | |
{ | |
$count = 0; | |
$beginingTime; | |
$endingTime; | |
$testNumber = 0; | |
while ($count <= ($resultNumber - 1)) | |
{ | |
$beginingTime = strtotime($result->GetScheduleInformationResult->ScheduleInfo[$count]->StartTime); | |
$endingTime = strtotime($result->GetScheduleInformationResult->ScheduleInfo[$count]->EndTime); | |
if(($beginingTime <= ($convertedDayTime + ($offset * 60 * 60))) && ($endingTime > ($convertedDayTime + ($offset * 60 * 60)))) | |
{ | |
$testNumber = $count; | |
} | |
$count++; | |
} | |
if ($testNumber == '0') | |
{ | |
echo $defualtSource; | |
} | |
else | |
{ | |
echo $result->GetScheduleInformationResult->ScheduleInfo[$testNumber]->ShowTitle; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment