Update epg2xml.php
This commit is contained in:
parent
362ac826a0
commit
09f7ef6b28
35
epg2xml.php
35
epg2xml.php
@ -295,7 +295,7 @@ function getEPG() {
|
|||||||
}
|
}
|
||||||
fprintf($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
fprintf($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||||
fprintf($fp, "<!DOCTYPE tv SYSTEM \"xmltv.dtd\">\n\n");
|
fprintf($fp, "<!DOCTYPE tv SYSTEM \"xmltv.dtd\">\n\n");
|
||||||
fprintf($fp, "<tv generator-info-name=\"epg2xml.php %s\">\n", VERSION);
|
fprintf($fp, "<tv generator-info-name=\"epg2xml %s\">\n", VERSION);
|
||||||
foreach ($Channeldatas as $Channeldata) : #Get Channel & Print Channel info
|
foreach ($Channeldatas as $Channeldata) : #Get Channel & Print Channel info
|
||||||
if($Channeldata['Enabled'] == 1) :
|
if($Channeldata['Enabled'] == 1) :
|
||||||
$ChannelId = $Channeldata['Id'];
|
$ChannelId = $Channeldata['Id'];
|
||||||
@ -399,7 +399,7 @@ function GetEPGFromEPG($ChannelInfo) {
|
|||||||
$hour = $hour." PM";
|
$hour = $hour." PM";
|
||||||
else :
|
else :
|
||||||
$hour = $hour." AM";
|
$hour = $hour." AM";
|
||||||
$thisday = date("Ymd", strtotime("+1 days"));
|
$thisday = date("Ymd", strtotime($day." +1 days"));
|
||||||
endif;
|
endif;
|
||||||
break;
|
break;
|
||||||
endswitch;
|
endswitch;
|
||||||
@ -493,12 +493,17 @@ function GetEPGFromKT($ChannelInfo) {
|
|||||||
#programName, startTime, rating, category
|
#programName, startTime, rating, category
|
||||||
$startTime = date("YmdHis", strtotime($day." ".trim($cells->item(0)->nodeValue)));
|
$startTime = date("YmdHis", strtotime($day." ".trim($cells->item(0)->nodeValue)));
|
||||||
$rating = str_replace("all", 0, str_replace("세 이상", "", trim($cells->item(2)->nodeValue)));
|
$rating = str_replace("all", 0, str_replace("세 이상", "", trim($cells->item(2)->nodeValue)));
|
||||||
$epginfo[]= array(trim($cells->item(1)->nodeValue), $startTime, $rating, trim($cells->itme(4)->nodeValue));
|
$epginfo[]= array(trim($cells->item(1)->nodeValue), $startTime, $rating, trim($cells->item(4)->nodeValue));
|
||||||
endforeach;
|
endforeach;
|
||||||
$zipped = array_slice(array_map(NULL, $epginfo, array_slice($epginfo,1)),0,-1);
|
$zipped = array_slice(array_map(NULL, $epginfo, array_slice($epginfo,1)),0,-1);
|
||||||
foreach($zipped as $epg) :
|
foreach($zipped as $epg) :
|
||||||
$programName = $epg[0][0] ?: "";
|
$programName = "";
|
||||||
$subprogramName = "";
|
$subprogramName = "";
|
||||||
|
preg_match('/^(.*?)( <(.*)>)?$/', $epg[0][0], $matches);
|
||||||
|
if($matches) :
|
||||||
|
$programName = $matches[1] ?: "";
|
||||||
|
$subprogramName = $matches[3] ?: "";
|
||||||
|
endif;
|
||||||
$startTime = $epg[0][1] ?: "";
|
$startTime = $epg[0][1] ?: "";
|
||||||
$endTime = $epg[1][1] ?: "";
|
$endTime = $epg[1][1] ?: "";
|
||||||
$desc = "";
|
$desc = "";
|
||||||
@ -563,18 +568,16 @@ function GetEPGFromLG($ChannelInfo) {
|
|||||||
$response = str_replace(array('<재>', ' [..', ' (..'), array('<재>', '', ''), $response);
|
$response = str_replace(array('<재>', ' [..', ' (..'), array('<재>', '', ''), $response);
|
||||||
$dom->loadHTML($response);
|
$dom->loadHTML($response);
|
||||||
$xpath = new DomXPath($dom);
|
$xpath = new DomXPath($dom);
|
||||||
$query = "//table[@class='datatable06 datatable06_type01']/tbody/tr";
|
$query = "//div[@class='tblType list']/table/tbody/tr";
|
||||||
$rows = $xpath->query($query);
|
$rows = $xpath->query($query);
|
||||||
foreach($rows as $row) :
|
foreach($rows as $row) :
|
||||||
$cells = $row->getElementsByTagName('td');
|
$cells = $row->getElementsByTagName('td');
|
||||||
|
$programName = trim($cells->item(1)->childNodes->item(0)->nodeValue);
|
||||||
$startTime = date("YmdHis", strtotime($day." ".trim($cells->item(0)->nodeValue)));
|
$startTime = date("YmdHis", strtotime($day." ".trim($cells->item(0)->nodeValue)));
|
||||||
$images = $cells[1]->getElementsByTagName('img');
|
$spans = $cells->item(1)->getElementsByTagName('span');
|
||||||
$rating = 0;
|
$rating = trim($spans->item(1)->nodeValue)=="All" ? 0 : trim($spans->item(1)->nodeValue);
|
||||||
foreach($images as $image) :
|
|
||||||
if(preg_match('/(\d+)세이상 관람가/', $image->attributes->getNamedItem('alt')->nodeValue, $ratings)) $rating = $ratings[1];
|
|
||||||
endforeach;
|
|
||||||
#programName, startTime, rating, category
|
#programName, startTime, rating, category
|
||||||
$epginfo[]= array(trim($cells->item(1)->nodeValue), $startTime, $rating, trim($cells->item(2)->nodeValue));
|
$epginfo[]= array($programName, $startTime, $rating, trim($cells->item(2)->nodeValue));
|
||||||
endforeach;
|
endforeach;
|
||||||
$zipped = array_slice(array_map(NULL, $epginfo, array_slice($epginfo,1)),0,-1);
|
$zipped = array_slice(array_map(NULL, $epginfo, array_slice($epginfo,1)),0,-1);
|
||||||
foreach($zipped as $epg) :
|
foreach($zipped as $epg) :
|
||||||
@ -737,15 +740,15 @@ function GetEPGFromSKY($ChannelInfo) {
|
|||||||
else :
|
else :
|
||||||
$programs = $data['scheduleListIn'];
|
$programs = $data['scheduleListIn'];
|
||||||
foreach($programs as $program) :
|
foreach($programs as $program) :
|
||||||
$programName = str_replace(array('<', '>', '&'), array('<', '>', '&'),$program['program_name']) ?: "";
|
$programName = htmlspecialchars_decode($program['program_name']) ?: "";
|
||||||
$subprogramName = str_replace(array('<', '>', '&'), array('<', '>', '&'),$program['program_subname']) ?: "";
|
$subprogramName = str_replace(array('amp;'), array('&'),$program['program_subname']) ?: "";
|
||||||
$startTime = $program['starttime'];
|
$startTime = $program['starttime'];
|
||||||
$endTime = $program['endtime'];
|
$endTime = $program['endtime'];
|
||||||
if ($GLOBALS['addverbose'] == "y") :
|
if ($GLOBALS['addverbose'] == "y") :
|
||||||
$actors = trim(str_replace('...', '',$program['cast']), ', ') ?: "";
|
$actors = trim(str_replace('...', '',$program['cast']), ', ') ?: "";
|
||||||
$producers = trim(str_replace('...', '',$program['dirt']), ', ') ?: "";
|
$producers = trim(str_replace('...', '',$program['dirt']), ', ') ?: "";
|
||||||
$description = str_replace(array('<', '>', '&'), array('<', '>', '&'),$program['description']) ?: "";
|
$description = str_replace(array('lt;', 'gt;', 'amp;'), array('<', '>', '&'),$program['description']) ?: "";
|
||||||
$summary = str_replace(array('<', '>', '&'), array('<', '>', '&'),$program['summary']) ?: "";
|
$summary = str_replace(array('lt;', 'gt;', 'amp;'), array('<', '>', '&'),$program['summary']) ?: "";
|
||||||
$desc = $description ?: "";
|
$desc = $description ?: "";
|
||||||
if($summary) :
|
if($summary) :
|
||||||
$desc = $desc."\n".$summary;
|
$desc = $desc."\n".$summary;
|
||||||
@ -844,7 +847,7 @@ function GetEPGFromNaver($ChannelInfo) {
|
|||||||
endfor;
|
endfor;
|
||||||
$zipped = array_slice(array_map(NULL, $epginfo, array_slice($epginfo,1)),0,-1);
|
$zipped = array_slice(array_map(NULL, $epginfo, array_slice($epginfo,1)),0,-1);
|
||||||
foreach($zipped as $epg) :
|
foreach($zipped as $epg) :
|
||||||
$programName = $epg[0][0] ?: "";
|
$programName = htmlspecialchars_decode($epg[0][0], ENT_XML1) ?: "";
|
||||||
$subprogramName = "";
|
$subprogramName = "";
|
||||||
$startTime = $epg[0][1] ?: "";
|
$startTime = $epg[0][1] ?: "";
|
||||||
$endTime = $epg[1][1] ?: "";
|
$endTime = $epg[1][1] ?: "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user