diff options
author | TheTroll <trolldev@gmail.com> | 2010-03-25 13:39:15 +0100 |
---|---|---|
committer | TheTroll <trolldev@gmail.com> | 2010-03-25 13:39:15 +0100 |
commit | 1fcf072e7d5642aa7a2da75d6698982627e245fd (patch) | |
tree | e8a5a057aae16f3f8d32f8e20edbdc7fe50635e5 /bin/vdr.php | |
parent | e289b52f7761137a1c051357f1126e42ac28002a (diff) | |
download | istreamdev-1fcf072e7d5642aa7a2da75d6698982627e245fd.tar.gz istreamdev-1fcf072e7d5642aa7a2da75d6698982627e245fd.tar.bz2 |
changed getepg format
Diffstat (limited to 'bin/vdr.php')
-rwxr-xr-x | bin/vdr.php | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/bin/vdr.php b/bin/vdr.php index 849548d..08ee13e 100755 --- a/bin/vdr.php +++ b/bin/vdr.php @@ -343,9 +343,19 @@ function vdrgetfullepgat($channel, $at, $programs) $channelname = vdrgetchanname($channel); } + // Generate the epgout squeletum + $categories = vdrgetcategories(); + for ($i=0; $i<count($categories); $i++) + { + $catentry = array(); + $catentry['name'] = $categories[$i]['name']; + $catentry['channel'] = array(); + + $epgout[] = $catentry; + } + // For all epg - $count1 = count($epgin); - for ($i = 0; $i < $count1; $i++) + for ($i=0; $i<count($epgin); $i++) { // Find chan if(ereg("^C", $epgin[$i])) @@ -364,7 +374,6 @@ function vdrgetfullepgat($channel, $at, $programs) // Create a new chan entry $chanentry['name'] = $channame; $chanentry['number'] = vdrgetchannum($channame); - $chanentry['category'] = vdrgetchancat($channame); $chanentry['epg'] = array(); $programscounter = 0; @@ -380,8 +389,17 @@ function vdrgetfullepgat($channel, $at, $programs) { if ($programscounter && $validchan) { - // Add new entry - $epgout[] = $chanentry; + // Add new entry in the right category + $chancat = vdrgetchancat($chanentry['name']); + for ($j=0; $j<count($epgout); $j++) + { + if ($chancat == $epgout[$j]['name']) + { + $epgout[$j]['channel'][] = $chanentry; + break; + } + } + $addedchans[] = $chanentry['name']; if ($channel != "all") @@ -466,13 +484,19 @@ function vdrgetfullepgat($channel, $at, $programs) } } - if (count($epgout)) + + for ($i=0; $i<count($epgout); $i++) { - // Sort it - foreach ($epgout as $key => $row) - $channum[$key] = $row['number']; + if (count($epgout[$i]['channel'])) + { + $channum = array(); + + // Sort it + foreach ($epgout[$i]['channel'] as $key => $row) + $channum[$key] = $row['number']; - array_multisort($channum, SORT_ASC, $epgout); + array_multisort($channum, SORT_ASC, $epgout[$i]['channel']); + } } return $epgout; |