<?php include_once "includes/contenttype.php"; include_once "includes/config.php"; include_once "includes/header.php"; include_once "includes/recordfunction.php"; $runPVR = "1"; //First check to see if the cache include "refreshcontent.php"; ob_start(); ob_implicit_flush(true); ob_end_flush(); echo "<PRE>"; $dbQuery = "SELECT * FROM PVRList"; $result = mysql_query($dbQuery) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $dbQuery2 = "SELECT * FROM ProgramData WHERE show_name='" . $row['show_name'] . "' AND is_subscriber_only='0'"; echo "Running PVR Searches:" . $row['show_name'] . "<br>"; $result2 = mysql_query($dbQuery2) or die(mysql_error()); while ($row2 = mysql_fetch_array($result2)) { $dbQuery3 = "SELECT * FROM DownloadHistory WHERE HuluID='" . $row2['HuluID'] . "'"; $result3 = mysql_query($dbQuery3) or die(mysql_error()); $rows3 = mysql_num_rows($result3); if ($rows3 > 0) { //This show has been downloaded already so skip it } else { recordshow($row2['HuluID']); } } } print '<br><div class="action"><ul class="action"><li class="action"><a class="action" onclick="window.close()" title="Close">Close</a></li></ul></div>';
$rowsA = mysql_num_rows($resultA); if ($rowsA > 0) { print '<P>This show (' . $row['HuluID'] . ') has already been downloaded, and cannot be downloaded again</p>'; exit; } print '<strong><p>Please leave this page open until the recording completes</p></strong>'; print '<div class="action"><ul class="action"><li class="action"><a class="action" onclick="window.close()" title="Close">Close</a></li></ul></div><p>Recording The Following Programmes</p><ul>'; if ($_GET['quick'] == "true") { $Huluid = explode("/", $_GET['id']); $Huluid = end($Huluid); $QueryURL = "http://www.hulu.com/api/2.0/info/video.json?_user_pgid=1&_content_pgid=67&_device_id=1&type=video&id=" . $Huluid; $handle = fopen($QueryURL, "rb"); $contents = stream_get_contents($handle); fclose($handle); $results = json_decode($contents); $row = array(); $row['show_name'] = addslashes($results->show->name); $row['season_number'] = addslashes($results->season_number); $row['episode_number'] = addslashes($results->episode_number); $row['title'] = addslashes($results->title); print $row['show_name'] . ' - ' . $row['title']; } else { print '<li>' . $row['show_name'] . ' - ' . $row['title'] . '</li>'; $Huluid = $row['HuluID']; } print '</ul><br />'; recordshow($Huluid); print '<br><div class="action"><ul class="action"><li class="action"><a class="action" onclick="window.close()" title="Close">Close</a></li></ul></div>'; ?>