diff options
author | TheTroll <trolldev@gmail.com> | 2010-03-24 21:13:32 +0100 |
---|---|---|
committer | TheTroll <trolldev@gmail.com> | 2010-03-24 21:13:32 +0100 |
commit | d8f483cd159d6c9380c58d67cf3029be936cd769 (patch) | |
tree | 43c4fdd8de3e94c4c767414552d98254a7fb462c /bin | |
parent | a02c43d36c20990ae5f6e1bcf29441269fba3177 (diff) | |
download | istreamdev-d8f483cd159d6c9380c58d67cf3029be936cd769.tar.gz istreamdev-d8f483cd159d6c9380c58d67cf3029be936cd769.tar.bz2 |
Epg optimization
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/vdr.php | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/bin/vdr.php b/bin/vdr.php index a1b69e4..39170df 100755 --- a/bin/vdr.php +++ b/bin/vdr.php @@ -318,7 +318,7 @@ function vdrgetepgat($channum, $at) return array($date, $time, $title, $desc, $endtime); } -function vdrgetfullepgat($at, $programs) +function vdrgetfullepgat($channel, $at, $programs) { $chanentry = array(); $chanepg = array(); @@ -326,6 +326,11 @@ function vdrgetfullepgat($at, $programs) $addedchans = array(); + if ($channel != "all") + $channel = vdrgetchanname($channel); + else + $channel = "all"; + // Update EPG is needed if ($_SESSION['fullepg'] == "") $_SESSION['fullepg'] = vdrsendcommand("LSTE"); @@ -341,6 +346,9 @@ function vdrgetfullepgat($at, $programs) $channames = explode(" ", $channame); $channame = substr($channame, strlen($channames[0])+1); + if (($channel != "all") && ($channame != $channel)) + continue; + // Dont add chans twice if (count(preg_grep(quotemeta('"' .$channame .'"'), $addedchans))) continue; @@ -364,9 +372,14 @@ function vdrgetfullepgat($at, $programs) { if ($programscounter && $validchan) { - // Add new entry - $fullepg[] = $chanentry; - $addedchans[] = $chanentry['name']; + if ($channel == "all") + { + // Add new entry + $fullepg[] = $chanentry; + $addedchans[] = $chanentry['name']; + } + else + return $chanentry; } $validchan = 0; @@ -455,39 +468,13 @@ function vdrgetepg($channel, $time, $day, $programs, $extended) // Comput requested date $requesteddate = $currentday + ((int)$day * (3600*24)) + $requestedtime - 3600; - // Single chan case - if ($channel != "all") + if ($extended) { - // Create a new chan entry in epg - $chanentry = array(); - $chanentry['name'] = vdrgetchanname($channel); - $chanentry['number'] = $channel; - $chanentry['category'] = vdrgetchancat($$chanentry['name']); - - $chanentry['epg'] = array(); - - if ($extended) - list ($chanentry['date'], $chanentry['time'], $chanentry['title'], $chanentry['desc']) = vdrgetepgat($channel, "at " .$requesteddate); - else - { - $chanentry['epg'] = array(); - $attime = $requesteddate; - $nbprograms = 0; - while ($nbprograms < $programs) - { - list ($date, $chanepg['time'], $chanepg['title'], $desc, $endtime) = vdrgetepgat($channel, "at " .$attime); - $chanentry['epg'][] = $chanepg; - - $attime = $endtime+1; - $nbprograms ++; - } - } - + list ($chanentry['date'], $chanentry['time'], $chanentry['title'], $chanentry['desc']) = vdrgetepgat($channel, "at " .$requesteddate); return $chanentry; } - - // All chans - return vdrgetfullepgat($requesteddate, $programs); + else + return vdrgetfullepgat($channel, $requesteddate, $programs); } function vdrgetrecinfo($rec) |