Connect(); $allepg = $svdrp->Command("LSTE NOW"); $svdrp->Disconnect(); $allepgfilled = 1; } $channame = $stream; } else { $infofile = $stream ."/info"; if (file_exists($infofile)) $info= file_get_contents($infofile); else { $infofile = $stream ."/info.vdr"; if (file_exists($infofile)) $info= file_get_contents($infofile); else $info=""; } $allepg = explode("\n", $info); } if ($ischan) $chanfound = 0; else $chanfound = 1; $epgtitlefound = 0; $epgtitle=""; $epgdesc=""; // For all epg $count = count($allepg); for ($i = 0; $i < $count; $i++) { // Find the right chan (take the first one) if ($chanfound == 0) { $streamArray = explode(",",$stream); if (strstr($allepg[$i], $streamArray[0]) == $streamArray[0]) $chanfound = 1; } else { // Now find T or C if(ereg("^C", $allepg[$i])) { // Check if it is our chan too, else search again if ($ischan) { if(!ereg("$stream$", $allepg[$i])) { $chanfound = 0; continue; } } else { $channame = substr($allepg[$i], 2); $channames = explode(" ", $channame); $channame = substr($channame, strlen($channames[0])+1); } } else if(ereg("^T", $allepg[$i])) $epgtitle=substr($allepg[$i], 2); else if(ereg("^D", $allepg[$i])) $epgdesc=substr($allepg[$i], 2); } } // Convert if needed if (!is_utf8($epgtitle)) $epgtitle = utf8_encode($epgtitle); if (!is_utf8($epgdesc)) $epgdesc = utf8_encode($epgdesc); return array($epgtitle, $epgdesc, $channame); } function vdrgetchannum($chan = "NULL") { global $svdrpip, $svdrpport; $svdrp = new SVDRP($svdrpip, $svdrpport); $svdrp->Connect(); $channels = $svdrp->Command("LSTC"); $svdrp->Disconnect(); // Get channel number $channels = preg_grep(quotemeta('"'.$chan.';|'.$chan.':"'), $channels); reset($channels); $channels = explode(" ", $channels[key($channels)]); $channum = $channels[0]; return $channum; } function vdrlistcategories() { global $vdrchannels; // All chans print "
  • All channels
  • \r\n"; print "
    \r\n"; $fp = fopen ($vdrchannels,"r"); while ($line = fgets($fp, 1024)) { // Check if it is a categorie if ($line[0] == ":") { // Remove : and @ $cat = substr($line, 1, -1); if($cat[0] == '@') { $cat_array = explode(' ', $cat); $cat = substr($cat, strlen($cat_array[0])+1); } $cat2 = addslashes($cat); print "
  • $cat
  • \r\n"; print "
    \r\n"; } } fclose($fp); } function vdrlistchannels($category = "NULL") { global $epgtitle; global $vdrchannels; if ($category == "All") $cat_found=1; else $cat_found=0; $fp = fopen ($vdrchannels,"r"); while ($line = fgets($fp, 1024)) { if ($cat_found) { if ($line[0] == ":") { if ($category == "All") continue; else break; } $channels = explode(":", $line); $channels = explode(";", $channels[0]); $chan = $channels[0]; // Get EPG title $epgtitle = NULL; list($epgtitle, $epgdesc, $channame) = vdrgetinfostream($chan, 1); print "
  • "; $chan2=addslashes($chan); print " \r\n"; if (!file_exists('logos/'.$chan.'.png')) print " \r\n"; else print " \r\n"; print " $chan\r\n"; print " $epgtitle\r\n
  • \r\n"; print "
    "; print " "; print " "; print " "; print "
    \r\n"; } else { if ($line[0] == ":") { // Remove : and @ $cat = substr($line, 1, -1); if($cat[0] == '@') { $cat_array = explode(' ', $cat); $cat = substr($cat, strlen($cat_array[0])+1); } // Check category if ("$cat" == "$category") $cat_found = 1; } } } fclose($fp); } ?>