diff options
author | TheTroll <trolldev@gmail.com> | 2010-03-16 17:27:48 +0100 |
---|---|---|
committer | TheTroll <trolldev@gmail.com> | 2010-03-16 17:27:48 +0100 |
commit | c3a730a1a20ad9ec86d23f348621a058472d7e3f (patch) | |
tree | f05e6e817f03a0f710e109db2d844939c71a43e7 | |
parent | f2e41b6e909f90560d877e07ead06c4bcd156a72 (diff) | |
download | istreamdev-c3a730a1a20ad9ec86d23f348621a058472d7e3f.tar.gz istreamdev-c3a730a1a20ad9ec86d23f348621a058472d7e3f.tar.bz2 |
Speed up chan listing
-rwxr-xr-x | bin/vdr.php | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/bin/vdr.php b/bin/vdr.php index 8e12f69..fc03c12 100755 --- a/bin/vdr.php +++ b/bin/vdr.php @@ -165,6 +165,10 @@ function vdrgetchannels($category, $now) $cat_found = 0; + // Get NOW epg + if ($now) + $epgnow = vdrsendcommand("LSTE NOW"); + while ($line = fgets($fp, 1024)) { if (!$cat_found) @@ -197,8 +201,40 @@ function vdrgetchannels($category, $now) $tmpchan['number'] = vdrgetchannum($channame); if ($now) { - $info = vdrgetchaninfo($tmpchan['number']); - $tmpchan['now_title'] = $info['now_title']; + // Extract now + $chanfound = 0; + $count = count($epgnow); + $info = ""; + for ($i = 0; $i < $count; $i++) + { + // Find the right chan (take the first one) + if ($chanfound == 0) + { + if (strstr($epgnow[$i], $channame) == $channame) + $chanfound = 1; + } + else + { + // Now find T or C + if(ereg("^C", $epgnow[$i])) + { + if (!strstr($epgnow[$i], $channame) == $channame) + { + $chanfound = 0; + continue; + } + } + else if(ereg("^T", $epgnow[$i])) + { + $info=substr($epgnow[$i], 2); + if (!is_utf8($info)) + $info = utf8_encode($info); + break; + } + } + } + + $tmpchan['now_title'] = $info; } $chanlist[] = $tmpchan; } |