<?php include "../include/json.php"; $rawdata = "./astra.tv.json"; if (!file_exists($rawdata)) { $rawjson = file_get_contents("http://www.astra.de/webservice/v3/channels" . "?limit=9999&page=1&sort_by=name&sort_direction=asc" . "&domain_identifier=d3d3LmFzdHJhLmRl&free=yes&pay=yes&mode=tv"); $json = json_decdat($rawjson); file_put_contents($rawdata, json_encdat($json)); }
function readEPG($epgdatabase) { $fd = fopen($epgdatabase, "r"); while (!feof($fd)) { $length = readInt($fd, 4); if ($length < 0) { break; } //echo "$length\n"; $json = array(); decodeLength($fd, $length, $json); if (isset($json["__section__"])) { $section = $json["__section__"]; echo json_encdat($json) . "\n"; continue; } if ($section != "broadcasts") { continue; } $channel = $json["channel"]; $channel = $GLOBALS["channels"][$channel]; $service = $channel["services"]; $service = $GLOBALS["services"][$service[0]]; if (isset($service["svcname"])) { $json["channel"] = $service["svcname"]; } if (isset($service["provider"])) { $json["provider"] = $service["provider"]; } if (isset($service["networkname"])) { $json["network"] = $service["networkname"]; } $json["tags"] = array(); $tags = $channel["tags"]; for ($inx = 0; $inx < count($tags); $inx++) { $json["tags"][] = $GLOBALS["tags"][$tags[$inx]]["name"]; } unset($json["grabber"]); unset($json["episode"]); echo json_encdat($json) . "\n"; } }