finishRun(); } else { $mak = $argumentList[1]; } // Require the Composer autoload file. require 'vendor/autoload.php'; // Setup the ProcessBuilder. validateClass('Symfony\\Component\\Process\\ProcessBuilder'); $builder = new Symfony\Component\Process\ProcessBuilder(); // Setup the File Logger $logFile = '/tmp/tivo_verify.log'; $logger = new Apix\Log\Logger(); $logger->add(new Apix\Log\Logger\File($logFile)); // Locate the TiVo. validateClass('JimLind\\TiVo\\TiVoFinder'); $finder = new JimLind\TiVo\TiVoFinder($builder); $finder->setLogger($logger); $ipAddress = $finder->find(); // Report the results of locating the TiVo. if (empty($ipAddress) === false) { print " > Your TiVo was automatically found at `{$ipAddress}` on your network.\n"; } else { print " > Your TiVo could not be automatically located.\n"; print " > Do you have an odd network setup like virtual machines or the like?\n"; } // Exit if no IP can be used. if (empty($ipAddress) && count($argumentList) < 3) { print " > No IP available. You can supply one manually if neccessary.\n"; finishRun($logFile); } // Use the manually entered IP.
<?php require 'vendor/autoload.php'; // Setup the ProcessBuilder dependency. // This is part of the the Process component from Symfony for executing commands. $builder = new Symfony\Component\Process\ProcessBuilder(); // Setup the Guzzle dependency. // This is the best PHP HTTP library around. $guzzle = new GuzzleHttp\Client(); // Use the TiVoFinder service to find a TiVo on your local network. // If it can't find a TiVo for whatever reason it'll return an empty string. // If you have more than one TiVo it'll return the IP of the first one it sees. $tivoFinder = new JimLind\TiVo\TiVoFinder($builder); $ipAddress = $tivoFinder->find(); // Use the XmlDownloader service to download a list of strings representing XML show documents. // Each show is a self contained valid XML string. // The TiVo IP address and MAK (Media Access Key) are needed here. $ip = '192.168.0.1'; $mak = '7678999999'; $xmlDownloader = new JimLind\TiVo\XmlDownloader($ip, $mak, $guzzle); $xmlList = $xmlDownloader->download(); // Use the ShowListFactory to create a list of Show objects. // The factory is setup specifically to use the data output from the NowPlaying service. $showListFactory = new JimLind\TiVo\Factory\ShowListFactory(); $showList = $showListFactory->createShowListFromXmlList($xmlList); // Grab one Show off the top. $show = $showList->offsetGet(0); // Setup the VideoDownloader service. // The TiVo IP address and MAK (Media Access Key) are needed here. $videoDownloader = new JimLind\TiVo\VideoDownloader($mak, $guzzle); // Download preview and complete files from TiVo.