HCN, ISCS 함수 수정, 웹페이지 패치시 시간 간격 추가
This commit is contained in:
parent
6b8200aa2b
commit
ec3ce6f127
81
epg2xml.php
81
epg2xml.php
@ -490,6 +490,7 @@ function GetEPGFromEPG($ChannelInfo) {
|
|||||||
endforeach;
|
endforeach;
|
||||||
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
||||||
|
usleep(1000);
|
||||||
endforeach;
|
endforeach;
|
||||||
endfor;
|
endfor;
|
||||||
else:
|
else:
|
||||||
@ -552,6 +553,7 @@ function GetEPGFromKT($ChannelInfo) {
|
|||||||
$rating = str_replace("all", 0, str_replace("세 이상", "", trim($cells->item(2)->nodeValue)));
|
$rating = str_replace("all", 0, str_replace("세 이상", "", trim($cells->item(2)->nodeValue)));
|
||||||
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
||||||
|
usleep(1000);
|
||||||
endforeach;
|
endforeach;
|
||||||
else :
|
else :
|
||||||
if($GLOBALS['debug']) printError($ChannelName.CONTENT_ERROR);
|
if($GLOBALS['debug']) printError($ChannelName.CONTENT_ERROR);
|
||||||
@ -613,6 +615,7 @@ function GetEPGFromLG($ChannelInfo) {
|
|||||||
$rating = trim($spans->item(1)->nodeValue)=="All" ? 0 : trim($spans->item(1)->nodeValue);
|
$rating = trim($spans->item(1)->nodeValue)=="All" ? 0 : trim($spans->item(1)->nodeValue);
|
||||||
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
||||||
|
usleep(1000);
|
||||||
endforeach;
|
endforeach;
|
||||||
else :
|
else :
|
||||||
if($GLOBALS['debug']) printError($ChannelName.CONTENT_ERROR);
|
if($GLOBALS['debug']) printError($ChannelName.CONTENT_ERROR);
|
||||||
@ -691,6 +694,7 @@ function GetEPGFromSK($ChannelInfo) {
|
|||||||
'rating' => $rating
|
'rating' => $rating
|
||||||
);
|
);
|
||||||
writeProgram($programdata);
|
writeProgram($programdata);
|
||||||
|
usleep(1000);
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
@ -758,6 +762,7 @@ function GetEPGFromSKB($ChannelInfo) {
|
|||||||
if($cells->length > 3) $rating = str_replace('세', '', $cells->item(3)->nodeValue) ?: 0;
|
if($cells->length > 3) $rating = str_replace('세', '', $cells->item(3)->nodeValue) ?: 0;
|
||||||
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
||||||
|
usleep(1000);
|
||||||
endforeach;
|
endforeach;
|
||||||
else :
|
else :
|
||||||
if($GLOBALS['debug']) printError($ChannelName.CONTENT_ERROR);
|
if($GLOBALS['debug']) printError($ChannelName.CONTENT_ERROR);
|
||||||
@ -839,6 +844,7 @@ function GetEPGFromSKY($ChannelInfo) {
|
|||||||
'rating' => $rating
|
'rating' => $rating
|
||||||
);
|
);
|
||||||
writeProgram($programdata);
|
writeProgram($programdata);
|
||||||
|
usleep(1000);
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
@ -908,6 +914,7 @@ function GetEPGFromNaver($ChannelInfo) {
|
|||||||
$rating = $program['grade'];
|
$rating = $program['grade'];
|
||||||
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
||||||
|
usleep(1000);
|
||||||
endforeach;
|
endforeach;
|
||||||
endfor;
|
endfor;
|
||||||
endfor;
|
endfor;
|
||||||
@ -929,11 +936,12 @@ function GetEPGFromIscs($ChannelInfo) {
|
|||||||
$ServiceId = $ChannelInfo[3];
|
$ServiceId = $ChannelInfo[3];
|
||||||
$epginfo = array();
|
$epginfo = array();
|
||||||
foreach(range(1, $GLOBALS['period']) as $k) :
|
foreach(range(1, $GLOBALS['period']) as $k) :
|
||||||
$url = "https://www.iscs.co.kr/service/sub/ajax_channel_view.asp";
|
$url = "http://m.iscs.co.kr/sub/02/data.asp";
|
||||||
$day = date("Y-m-d", strtotime("+".($k - 1)." days"));
|
$day = date("Y-m-d", strtotime("+".($k - 1)." days"));
|
||||||
$params = array(
|
$params = array(
|
||||||
's_idx' => $ServiceId,
|
'Exec_Mode' => 'view',
|
||||||
'C_date' => $day
|
'Source_Id' => $ServiceId,
|
||||||
|
'Ch_Day' => $day
|
||||||
);
|
);
|
||||||
$params = http_build_query($params);
|
$params = http_build_query($params);
|
||||||
$method = "POST";
|
$method = "POST";
|
||||||
@ -945,43 +953,33 @@ function GetEPGFromIscs($ChannelInfo) {
|
|||||||
try {
|
try {
|
||||||
$data = json_decode($response, TRUE);
|
$data = json_decode($response, TRUE);
|
||||||
if(json_last_error() != JSON_ERROR_NONE) throw new Exception(JSON_SYNTAX_ERROR);
|
if(json_last_error() != JSON_ERROR_NONE) throw new Exception(JSON_SYNTAX_ERROR);
|
||||||
if(count($data['html']) == 0) :
|
if(count($data['total']) == 0) :
|
||||||
if($GLOBALS['debug']) :
|
if($GLOBALS['debug']) :
|
||||||
printError($ChannelName.CHANNEL_ERROR);
|
printError($ChannelName.CHANNEL_ERROR);
|
||||||
endif;
|
endif;
|
||||||
else :
|
else :
|
||||||
$response = $data['html'];
|
$programs = $data['list'];
|
||||||
$pattern = '/<td class="name">(.*)<\/td>/';
|
foreach($programs as $program) :
|
||||||
$response = preg_replace_callback($pattern, function($matches) { return '<td class="name">'.htmlspecialchars($matches[1]).'</td>';}, $response);
|
|
||||||
$response = mb_convert_encoding($response, "HTML-ENTITIES", "UTF-8");
|
|
||||||
$dom = new DomDocument;
|
|
||||||
libxml_use_internal_errors(True);
|
|
||||||
if($dom->loadHTML($response)):
|
|
||||||
$xpath = new DomXPath($dom);
|
|
||||||
$query = "//div[@class='pp_tbl']/table/tbody/tr";
|
|
||||||
$rows = $xpath->query($query);
|
|
||||||
foreach($rows as $row) :
|
|
||||||
$startTime = $endTime = $programName = $subprogramName = $desc = $actors = $producers = $category = $episode = "";
|
$startTime = $endTime = $programName = $subprogramName = $desc = $actors = $producers = $category = $episode = "";
|
||||||
$rebroadcast = False;
|
$rebroadcast = False;
|
||||||
$rating = 0;
|
$rating = 0;
|
||||||
$cells = $row->getElementsByTagName('td');
|
$startTime = date("YmdHis", strtotime($day." ".$program['Time']));
|
||||||
$startTime = $cells->item(0)->nodeValue ?: "";
|
|
||||||
$startTime = date("YmdHis", strtotime($day." ".$startTime));
|
|
||||||
$programName = trim($cells->item(1)->nodeValue) ?: "";
|
|
||||||
$pattern = '/^(.*?)(?:\(([\d,]+)회\))?(?:\((재)\))?$/';
|
$pattern = '/^(.*?)(?:\(([\d,]+)회\))?(?:\((재)\))?$/';
|
||||||
preg_match($pattern, $programName, $matches);
|
preg_match($pattern, trim($program['Pg_Name']), $matches);
|
||||||
if ($matches != NULL) :
|
if ($matches != NULL) :
|
||||||
if(isset($matches[1])) $programName = trim($matches[1]) ?: "";
|
if(isset($matches[1])) $programName = trim($matches[1]) ?: "";
|
||||||
if(isset($matches[2])) $episode = $matches[2] ?: "";
|
if(isset($matches[2])) $episode = $matches[2] ?: "";
|
||||||
if(isset($matches[3])) $rebroadcast = $matches[3] ? True : False;
|
if(isset($matches[3])) $rebroadcast = $matches[3] ? True : False;
|
||||||
endif;
|
endif;
|
||||||
$rating = $cells->item(2)->nodeValue=='전체관람' ? 0 : str_replace('세이상', '', $cells->item(2)->nodeValue);
|
if($program['Rating'] == '모든연령'):
|
||||||
|
$rating = 0;
|
||||||
|
else:
|
||||||
|
$rating = str_replace("세이상","", $program['Rating']);
|
||||||
|
endif;
|
||||||
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
||||||
|
usleep(1000);
|
||||||
endforeach;
|
endforeach;
|
||||||
else :
|
|
||||||
if($GLOBALS['debug']) printError($ChannelName.CONTENT_ERROR);
|
|
||||||
endif;
|
|
||||||
endif;
|
endif;
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
if($GLOBALS['debug']) printError($e->getMessage());
|
if($GLOBALS['debug']) printError($e->getMessage());
|
||||||
@ -1001,38 +999,36 @@ function GetEPGFromHcn($ChannelInfo) {
|
|||||||
$ServiceId = $ChannelInfo[3];
|
$ServiceId = $ChannelInfo[3];
|
||||||
$epginfo = array();
|
$epginfo = array();
|
||||||
foreach(range(1, $GLOBALS['period']) as $k) :
|
foreach(range(1, $GLOBALS['period']) as $k) :
|
||||||
$url = "https://www.hcn.co.kr/ur/bs/ch/channelInfo.hcn";
|
$url = "http://m.hcn.co.kr/sch_ScheduleList.action";
|
||||||
$day = date("Y-m-d", strtotime("+".($k - 1)." days"));
|
$day = date("Y-m-d", strtotime("+".($k - 1)." days"));
|
||||||
$params = array(
|
$params = array(
|
||||||
'method' => 'ajax_00',
|
|
||||||
'pageType' => 'sheetList',
|
|
||||||
'ch_id' => $ServiceId,
|
'ch_id' => $ServiceId,
|
||||||
'onairdate' => $day
|
'onairdate' => $day,
|
||||||
|
'_' => _microtime()
|
||||||
);
|
);
|
||||||
$params = http_build_query($params);
|
$params = http_build_query($params);
|
||||||
$method = "POST";
|
$method = "GET";
|
||||||
try {
|
try {
|
||||||
$response = getWeb($url, $params, $method);
|
$response = getWeb($url, $params, $method);
|
||||||
if ($response === False && $GLOBALS['debug']) :
|
if ($response === False && $GLOBALS['debug']) :
|
||||||
printError($ChannelName.HTTP_ERROR);
|
printError($ChannelName.HTTP_ERROR);
|
||||||
else :
|
else :
|
||||||
$response = mb_convert_encoding($response, "HTML-ENTITIES", "EUC-KR");
|
$response = mb_convert_encoding($response, "HTML-ENTITIES", "UTF-8");
|
||||||
$dom = new DomDocument;
|
$dom = new DomDocument;
|
||||||
libxml_use_internal_errors(True);
|
libxml_use_internal_errors(True);
|
||||||
if($dom->loadHTML($response)):
|
if($dom->loadHTML($response)):
|
||||||
$xpath = new DomXPath($dom);
|
$xpath = new DomXPath($dom);
|
||||||
$query = "//tr[@class='']";
|
$query = "//li";
|
||||||
$rows = $xpath->query($query);
|
$rows = $xpath->query($query);
|
||||||
foreach($rows as $row) :
|
foreach($rows as $row) :
|
||||||
$startTime = $endTime = $programName = $subprogramName = $desc = $actors = $producers = $category = $episode = "";
|
$startTime = $endTime = $programName = $subprogramName = $desc = $actors = $producers = $category = $episode = "";
|
||||||
$rebroadcast = False;
|
$rebroadcast = False;
|
||||||
$rating = 0;
|
$rating = 0;
|
||||||
$cells = $row->getElementsByTagName('td');
|
$startTime = trim($xpath->query("span[@class='progTime']", $row)->item(0)->nodeValue) ?: "";
|
||||||
$startTime = $cells->item(0)->nodeValue ?: "";
|
|
||||||
$startTime = date("YmdHis", strtotime($day." ".$startTime));
|
$startTime = date("YmdHis", strtotime($day." ".$startTime));
|
||||||
$programName = trim($cells->item(1)->nodeValue) ?: "";
|
$programName = trim($xpath->query("span[@class='progTitle']", $row)->item(0)->nodeValue) ?: "";
|
||||||
$category = trim($cells->item(2)->nodeValue) ?: "";
|
//$category = trim($cells->item(2)->nodeValue) ?: "";
|
||||||
$category = preg_replace('/\(.*\)/', '', $category);
|
//$category = preg_replace('/\(.*\)/', '', $category);
|
||||||
$images = $row->getElementsByTagName('img');
|
$images = $row->getElementsByTagName('img');
|
||||||
foreach($images as $image):
|
foreach($images as $image):
|
||||||
preg_match('/re\.png/', $image->getAttribute('src'), $rebroad);
|
preg_match('/re\.png/', $image->getAttribute('src'), $rebroad);
|
||||||
@ -1042,6 +1038,7 @@ function GetEPGFromHcn($ChannelInfo) {
|
|||||||
endforeach;
|
endforeach;
|
||||||
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
||||||
|
usleep(1000);
|
||||||
endforeach;
|
endforeach;
|
||||||
else :
|
else :
|
||||||
if($GLOBALS['debug']) printError($ChannelName.CONTENT_ERROR);
|
if($GLOBALS['debug']) printError($ChannelName.CONTENT_ERROR);
|
||||||
@ -1126,6 +1123,7 @@ function GetEPGFromPooq($ChannelInfo) {
|
|||||||
'rating' => $rating
|
'rating' => $rating
|
||||||
);
|
);
|
||||||
writeProgram($programdata);
|
writeProgram($programdata);
|
||||||
|
usleep(1000);
|
||||||
endif;
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
@ -1196,6 +1194,7 @@ function GetEPGFromMbc($ChannelInfo) {
|
|||||||
'rating' => $rating
|
'rating' => $rating
|
||||||
);
|
);
|
||||||
writeProgram($programdata);
|
writeProgram($programdata);
|
||||||
|
usleep(1000);
|
||||||
endif;
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
@ -1268,6 +1267,7 @@ function GetEPGFromMil($ChannelInfo) {
|
|||||||
'rating' => $rating
|
'rating' => $rating
|
||||||
);
|
);
|
||||||
writeProgram($programdata);
|
writeProgram($programdata);
|
||||||
|
usleep(1000);
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
@ -1335,6 +1335,7 @@ function GetEPGFromIfm($ChannelInfo) {
|
|||||||
'rating' => $rating
|
'rating' => $rating
|
||||||
);
|
);
|
||||||
writeProgram($programdata);
|
writeProgram($programdata);
|
||||||
|
usleep(1000);
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
@ -1391,6 +1392,7 @@ function GetEPGFromKbs($ChannelInfo) {
|
|||||||
$programName = str_replace(array("[","]", " Broadcast"), array("", "", ""), $programName);
|
$programName = str_replace(array("[","]", " Broadcast"), array("", "", ""), $programName);
|
||||||
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
||||||
|
usleep(1000);
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
@ -1466,6 +1468,7 @@ function GetEPGFromArirang($ChannelInfo) {
|
|||||||
'rating' => $rating
|
'rating' => $rating
|
||||||
);
|
);
|
||||||
writeProgram($programdata);
|
writeProgram($programdata);
|
||||||
|
usleep(1000);
|
||||||
endforeach;
|
endforeach;
|
||||||
else :
|
else :
|
||||||
if($GLOBALS['debug']) printError($ChannelName.CONTENT_ERROR);
|
if($GLOBALS['debug']) printError($ChannelName.CONTENT_ERROR);
|
||||||
@ -1640,4 +1643,10 @@ function printLog($string) {
|
|||||||
function printError($string) {
|
function printError($string) {
|
||||||
fwrite(STDERR, "Error : ".$string."\n");
|
fwrite(STDERR, "Error : ".$string."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _microtime()
|
||||||
|
{
|
||||||
|
list($usec, $sec) = explode(" ", microtime());
|
||||||
|
return ($sec.(int)($usec*1000));
|
||||||
|
}
|
||||||
?>
|
?>
|
127
epg2xml.py
127
epg2xml.py
@ -204,13 +204,12 @@ def GetEPGFromEPG(ChannelInfo):
|
|||||||
episode = matches.group(7) if matches.group(7) else ''
|
episode = matches.group(7) if matches.group(7) else ''
|
||||||
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
else:
|
else:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
except (requests.exceptions.RequestException) as e:
|
except (requests.exceptions.RequestException) as e:
|
||||||
if(debug): printError(ChannelName + str(e))
|
if(debug): printError(ChannelName + str(e))
|
||||||
time.sleep(0.01)
|
|
||||||
epgzip(epginfo)
|
epgzip(epginfo)
|
||||||
|
|
||||||
# Get EPG data from KT
|
# Get EPG data from KT
|
||||||
@ -250,14 +249,13 @@ def GetEPGFromKT(ChannelInfo):
|
|||||||
if not(matches is None): rating = int(matches.group())
|
if not(matches is None): rating = int(matches.group())
|
||||||
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
else:
|
else:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
except (requests.exceptions.RequestException) as e:
|
except (requests.exceptions.RequestException) as e:
|
||||||
if(debug): printError(ChannelName + str(e))
|
if(debug): printError(ChannelName + str(e))
|
||||||
else: pass
|
else: pass
|
||||||
time.sleep(0.01)
|
|
||||||
epgzip(epginfo)
|
epgzip(epginfo)
|
||||||
|
|
||||||
# Get EPG data from LG
|
# Get EPG data from LG
|
||||||
@ -300,14 +298,13 @@ def GetEPGFromLG(ChannelInfo):
|
|||||||
category = cell[2].text.strip()
|
category = cell[2].text.strip()
|
||||||
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
else:
|
else:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
except (requests.exceptions.RequestException) as e:
|
except (requests.exceptions.RequestException) as e:
|
||||||
if(debug): printError(ChannelName + str(e))
|
if(debug): printError(ChannelName + str(e))
|
||||||
else: pass
|
else: pass
|
||||||
time.sleep(0.01)
|
|
||||||
epgzip(epginfo)
|
epgzip(epginfo)
|
||||||
|
|
||||||
# Get EPG data from SK
|
# Get EPG data from SK
|
||||||
@ -333,8 +330,9 @@ def GetEPGFromSK(ChannelInfo):
|
|||||||
startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
|
startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
|
||||||
rebroadcast = False
|
rebroadcast = False
|
||||||
rating = 0
|
rating = 0
|
||||||
|
programName = program['programName'].replace('...', '>').encode('utf-8')
|
||||||
pattern = '^(.*?)(?:\s*[\(<]([\d,회]+)[\)>])?(?:\s*<([^<]*?)>)?(\((재)\))?$'
|
pattern = '^(.*?)(?:\s*[\(<]([\d,회]+)[\)>])?(?:\s*<([^<]*?)>)?(\((재)\))?$'
|
||||||
matches = re.match(pattern, program['programName'].replace('...', '>').encode('utf-8'))
|
matches = re.match(pattern, programName)
|
||||||
if not (matches is None):
|
if not (matches is None):
|
||||||
programName = matches.group(1).strip() if matches.group(1) else ''
|
programName = matches.group(1).strip() if matches.group(1) else ''
|
||||||
subprogramName = matches.group(3).strip() if matches.group(3) else ''
|
subprogramName = matches.group(3).strip() if matches.group(3) else ''
|
||||||
@ -353,7 +351,7 @@ def GetEPGFromSK(ChannelInfo):
|
|||||||
rating = int(program['ratingCd']) if program['programName'] else 0
|
rating = int(program['ratingCd']) if program['programName'] else 0
|
||||||
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
||||||
writeProgram(programdata)
|
writeProgram(programdata)
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
@ -411,14 +409,13 @@ def GetEPGFromSKB(ChannelInfo):
|
|||||||
rating = int(rating.text.decode('string_escape').replace('세','').strip())
|
rating = int(rating.text.decode('string_escape').replace('세','').strip())
|
||||||
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
else:
|
else:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
except (requests.exceptions.RequestException) as e:
|
except (requests.exceptions.RequestException) as e:
|
||||||
if(debug): printError(ChannelName + str(e))
|
if(debug): printError(ChannelName + str(e))
|
||||||
else: pass
|
else: pass
|
||||||
time.sleep(0.01)
|
|
||||||
epgzip(epginfo)
|
epgzip(epginfo)
|
||||||
|
|
||||||
# Get EPG data from SKY
|
# Get EPG data from SKY
|
||||||
@ -465,7 +462,7 @@ def GetEPGFromSKY(ChannelInfo):
|
|||||||
rating = int(program['grade']) if program['grade'] else 0
|
rating = int(program['grade']) if program['grade'] else 0
|
||||||
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
||||||
writeProgram(programdata)
|
writeProgram(programdata)
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
@ -506,7 +503,7 @@ def GetEPGFromNaver(ChannelInfo):
|
|||||||
rating = program['grade']
|
rating = program['grade']
|
||||||
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
@ -521,48 +518,43 @@ def GetEPGFromIscs(ChannelInfo):
|
|||||||
ChannelName = ChannelInfo[1]
|
ChannelName = ChannelInfo[1]
|
||||||
ServiceId = ChannelInfo[3]
|
ServiceId = ChannelInfo[3]
|
||||||
epginfo = []
|
epginfo = []
|
||||||
url='http://www.iscs.co.kr/service/sub/ajax_channel_view.asp'
|
url='http://m.iscs.co.kr/sub/02/data.asp'
|
||||||
for k in range(period):
|
for k in range(period):
|
||||||
day = today + datetime.timedelta(days=k)
|
day = today + datetime.timedelta(days=k)
|
||||||
params = {'s_idx': ServiceId, 'C_date': day}
|
params = {'Exec_Mode': 'view', 'Source_Id': ServiceId, 'Ch_Day': day}
|
||||||
response = requests.post(url, data=params, headers=ua, timeout=timeout)
|
response = requests.post(url, data=params, headers=ua, timeout=timeout)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
json_data = response.text
|
json_data = response.text
|
||||||
try:
|
try:
|
||||||
data = json.loads(json_data, encoding='utf-8')
|
data = json.loads(json_data, encoding='utf-8')
|
||||||
pattern = '<td class="name">(.*)<\/td>'
|
if(data['total'] > 0 ):
|
||||||
data['html'] = re.sub(pattern, partial(replacement, tag='td'), data['html'])
|
programs = data['list']
|
||||||
strainer = SoupStrainer('tbody')
|
for program in programs:
|
||||||
soup = BeautifulSoup(data['html'], 'lxml', parse_only=strainer)
|
|
||||||
html = soup.find_all('tr') if soup.find_all('tr') else ''
|
|
||||||
if(html) :
|
|
||||||
for row in html:
|
|
||||||
startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
|
startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
|
||||||
rebroadcast = False
|
rebroadcast = False
|
||||||
rating = 0
|
rating = 0
|
||||||
startTime = str(day) + ' ' + row.find('td', {'class':'time'}).text.strip()
|
startTime = str(day) + ' ' + program['Time']
|
||||||
startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
|
startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
|
||||||
startTime = startTime.strftime('%Y%m%d%H%M%S')
|
startTime = startTime.strftime('%Y%m%d%H%M%S')
|
||||||
programName = row.find('td', {'class':'title'}).text.decode('string_escape').strip()
|
pattern = '^(.*?)(?:\(([\d,]+)회\))?(?:\((재)\))?$';
|
||||||
rating = row.find('span', {'class':'year'}).text.decode('string_escape').strip()
|
matches = re.match(pattern, program['Pg_Name'].decode('string_escape').strip())
|
||||||
if rating == '전체관람' : rating = 0
|
|
||||||
else : rating = rating.replace('세이상', ' ')
|
|
||||||
pattern = '^(.*?)(?:\(([\d,]+)회\))?(?:\((재)\))?$'
|
|
||||||
matches = re.match(pattern, programName)
|
|
||||||
if not(matches is None) :
|
if not(matches is None) :
|
||||||
programName = matches.group(1) if matches.group(1) else ''
|
programName = matches.group(1) if matches.group(1) else ''
|
||||||
episode = matches.group(2) if matches.group(2) else ''
|
episode = matches.group(2) if matches.group(2) else ''
|
||||||
rebroadcast = True if matches.group(3) else False
|
rebroadcast = True if matches.group(3) else False
|
||||||
|
if program['Rating'].decode('string_escape').strip() == '모든연령':
|
||||||
|
rating = 0
|
||||||
|
else:
|
||||||
|
rating = program['Rating'].replace('세이상','')
|
||||||
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
except (requests.RequestException) as e:
|
except (requests.RequestException) as e:
|
||||||
if(debug): printError(ChannelName + str(e))
|
if(debug): printError(ChannelName + str(e))
|
||||||
else: pass
|
else: pass
|
||||||
time.sleep(0.01)
|
|
||||||
epgzip(epginfo)
|
epgzip(epginfo)
|
||||||
|
|
||||||
# Get EPG data from HCN
|
# Get EPG data from HCN
|
||||||
@ -571,48 +563,43 @@ def GetEPGFromHcn(ChannelInfo):
|
|||||||
ChannelName = ChannelInfo[1]
|
ChannelName = ChannelInfo[1]
|
||||||
ServiceId = ChannelInfo[3]
|
ServiceId = ChannelInfo[3]
|
||||||
epginfo = []
|
epginfo = []
|
||||||
html = []
|
url = 'http://m.hcn.co.kr/sch_ScheduleList.action'
|
||||||
url = 'http://www.hcn.co.kr/ur/bs/ch/channelInfo.hcn'
|
|
||||||
for k in range(period):
|
for k in range(period):
|
||||||
day = today + datetime.timedelta(days=k)
|
day = today + datetime.timedelta(days=k)
|
||||||
params = {'method': 'ajax_00', 'pageType': 'sheetList', 'ch_id': ServiceId, 'onairdate': day}
|
params = {'method': 'ajax_00', 'pageType': 'sheetList', 'ch_id': ServiceId, 'onairdate': day}
|
||||||
|
params = {'ch_id': ServiceId, 'onairdate': day, '_': int(time.time()*1000)}
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, params=params, headers=ua, timeout=timeout)
|
response = requests.get(url, params=params, headers=ua, timeout=timeout)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
html_data = response.content
|
html_data = response.content
|
||||||
data = unicode(html_data, 'euc-kr', 'ignore').encode('utf-8', 'ignore')
|
data = html_data
|
||||||
strainer = SoupStrainer('tr', {'class':''})
|
strainer = SoupStrainer('li')
|
||||||
soup = BeautifulSoup(data, 'lxml', parse_only=strainer, from_encoding='utf-8')
|
soup = BeautifulSoup(data, 'lxml', parse_only=strainer, from_encoding='utf-8')
|
||||||
for td in soup.findAll('td', {'class': 'f'}):
|
html = soup.find_all('li') if soup.find_all('li') else ''
|
||||||
td.insert(0, str(day) + ' ')
|
|
||||||
html = html + soup.find_all('tr') if soup.find_all('tr') else ''
|
|
||||||
except (requests.exceptions.RequestException) as e:
|
|
||||||
if(debug): printError(ChannelName + str(e))
|
|
||||||
else: pass
|
|
||||||
if(html) :
|
if(html) :
|
||||||
for cur, next in pairs(html):
|
for row in html:
|
||||||
startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
|
startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
|
||||||
rebroadcast = False
|
rebroadcast = False
|
||||||
rating = 0
|
rating = 0
|
||||||
startTime = cur.find('td', {'class':'f'}).text.strip()
|
startTime = str(day) + ' ' + row.find('span', {'class':'progTime'}).text.strip()
|
||||||
startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
|
startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
|
||||||
startTime = startTime.strftime('%Y%m%d%H%M%S')
|
startTime = startTime.strftime('%Y%m%d%H%M%S')
|
||||||
endTime = next.find('td', {'class':'f'}).text.strip()
|
programName = row.find('span', {'class':'progTitle'}).text.decode('string_escape').strip()
|
||||||
endTime = datetime.datetime.strptime(endTime, '%Y-%m-%d %H:%M')
|
for image in row.find_all('img', {'class':'vM'}, alt=True):
|
||||||
endTime = endTime.strftime('%Y%m%d%H%M%S')
|
|
||||||
programName = cur.find('td', {'class':'left'}).text.decode('string_escape').strip()
|
|
||||||
category = cur.find('td', {'class':'l'}).text.decode('string_escape').strip()
|
|
||||||
category = re.sub('\(.*\)', '', category)
|
|
||||||
for image in cur.find_all('img', {'class':'vM'}, alt=True):
|
|
||||||
rebroad = re.match('(재방송)',image['alt'].decode('string_escape').strip())
|
rebroad = re.match('(재방송)',image['alt'].decode('string_escape').strip())
|
||||||
if not (rebroad is None): rebroadcast = True
|
if not (rebroad is None): rebroadcast = True
|
||||||
grade = re.match('([\d,]+)',image['alt'])
|
grade = re.match('([\d,]+)',image['alt'])
|
||||||
if not (grade is None): rating = int(grade.group(1))
|
if not (grade is None): rating = int(grade.group(1))
|
||||||
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
writeProgram(programdata)
|
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
||||||
else:
|
time.sleep(0.001)
|
||||||
|
except ValueError:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
|
except (requests.exceptions.RequestException) as e:
|
||||||
|
if(debug): printError(ChannelName + str(e))
|
||||||
|
else: pass
|
||||||
|
epgzip(epginfo)
|
||||||
|
|
||||||
# Get EPG data from POOQ
|
# Get EPG data from POOQ
|
||||||
def GetEPGFromPooq(ChannelInfo):
|
def GetEPGFromPooq(ChannelInfo):
|
||||||
@ -657,7 +644,7 @@ def GetEPGFromPooq(ChannelInfo):
|
|||||||
rating = int(program['age'])
|
rating = int(program['age'])
|
||||||
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
||||||
writeProgram(programdata)
|
writeProgram(programdata)
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
@ -699,14 +686,13 @@ def GetEPGFromMbc(ChannelInfo):
|
|||||||
category = '음악'
|
category = '음악'
|
||||||
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
||||||
writeProgram(programdata)
|
writeProgram(programdata)
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
except (requests.exceptions.RequestException) as e:
|
except (requests.exceptions.RequestException) as e:
|
||||||
if(debug): printError(ChannelName + str(e))
|
if(debug): printError(ChannelName + str(e))
|
||||||
else: pass
|
else: pass
|
||||||
time.sleep(0.01)
|
|
||||||
|
|
||||||
# Get EPG data from MIL
|
# Get EPG data from MIL
|
||||||
def GetEPGFromMil(ChannelInfo):
|
def GetEPGFromMil(ChannelInfo):
|
||||||
@ -749,14 +735,13 @@ def GetEPGFromMil(ChannelInfo):
|
|||||||
producers = unescape(program['movie_director'])
|
producers = unescape(program['movie_director'])
|
||||||
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
||||||
writeProgram(programdata)
|
writeProgram(programdata)
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
except (requests.exceptions.RequestException) as e:
|
except (requests.exceptions.RequestException) as e:
|
||||||
if(debug): printError(ChannelName + str(e))
|
if(debug): printError(ChannelName + str(e))
|
||||||
else: pass
|
else: pass
|
||||||
time.sleep(0.01)
|
|
||||||
|
|
||||||
# Get EPG data from IFM
|
# Get EPG data from IFM
|
||||||
def GetEPGFromIfm(ChannelInfo):
|
def GetEPGFromIfm(ChannelInfo):
|
||||||
@ -795,14 +780,13 @@ def GetEPGFromIfm(ChannelInfo):
|
|||||||
producers = program['pgmPd']
|
producers = program['pgmPd']
|
||||||
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
||||||
writeProgram(programdata)
|
writeProgram(programdata)
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
except (requests.exceptions.RequestException) as e:
|
except (requests.exceptions.RequestException) as e:
|
||||||
if(debug): printError(ChannelName + str(e))
|
if(debug): printError(ChannelName + str(e))
|
||||||
else: pass
|
else: pass
|
||||||
time.sleep(0.01)
|
|
||||||
|
|
||||||
# Get EPG data from KBS
|
# Get EPG data from KBS
|
||||||
def GetEPGFromKbs(ChannelInfo):
|
def GetEPGFromKbs(ChannelInfo):
|
||||||
@ -834,14 +818,13 @@ def GetEPGFromKbs(ChannelInfo):
|
|||||||
startTime = startTime.strftime('%Y%m%d%H%M%S')
|
startTime = startTime.strftime('%Y%m%d%H%M%S')
|
||||||
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||||
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
except (requests.exceptions.RequestException) as e:
|
except (requests.exceptions.RequestException) as e:
|
||||||
if(debug): printError(ChannelName + str(e))
|
if(debug): printError(ChannelName + str(e))
|
||||||
else: pass
|
else: pass
|
||||||
time.sleep(0.01)
|
|
||||||
epgzip(epginfo)
|
epgzip(epginfo)
|
||||||
|
|
||||||
# Get EPG data from ARIRANG
|
# Get EPG data from ARIRANG
|
||||||
@ -893,14 +876,13 @@ def GetEPGFromArirang(ChannelInfo):
|
|||||||
rebroadcast = True if matches.group(2) else False
|
rebroadcast = True if matches.group(2) else False
|
||||||
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
programdata = {'channelId':ChannelId, 'startTime':startTime, 'endTime':endTime, 'programName':programName, 'subprogramName':subprogramName, 'desc':desc, 'actors':actors, 'producers':producers, 'category':category, 'episode':episode, 'rebroadcast':rebroadcast, 'rating':rating}
|
||||||
writeProgram(programdata)
|
writeProgram(programdata)
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
else:
|
else:
|
||||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||||
else: pass
|
else: pass
|
||||||
except (requests.exceptions.RequestException) as e:
|
except (requests.exceptions.RequestException) as e:
|
||||||
if(debug): printError(ChannelName + str(e))
|
if(debug): printError(ChannelName + str(e))
|
||||||
else: pass
|
else: pass
|
||||||
time.sleep(0.01)
|
|
||||||
|
|
||||||
# Zip epginfo
|
# Zip epginfo
|
||||||
def epgzip(epginfo):
|
def epgzip(epginfo):
|
||||||
@ -941,8 +923,12 @@ def writeProgram(programdata):
|
|||||||
category = escape(programdata['category'])
|
category = escape(programdata['category'])
|
||||||
episode = programdata['episode']
|
episode = programdata['episode']
|
||||||
if episode:
|
if episode:
|
||||||
|
try:
|
||||||
episode_ns = int(episode) - 1
|
episode_ns = int(episode) - 1
|
||||||
episode_ns = '0'+ '.' + str(episode_ns) + '.' + '0' + '/' + '0'
|
episode_ns = '0'+ '.' + str(episode_ns) + '.' + '0' + '/' + '0'
|
||||||
|
except ValueError as ex:
|
||||||
|
episode_ns = int(episode.split(',', 1)[0]) - 1
|
||||||
|
episode_ns = '0'+ '.' + str(episode_ns) + '.' + '0' + '/' + '0'
|
||||||
episode_on = episode
|
episode_on = episode
|
||||||
rebroadcast = programdata['rebroadcast']
|
rebroadcast = programdata['rebroadcast']
|
||||||
if episode and addepisode == 'y': programName = programName + ' ('+ str(episode) + '회)'
|
if episode and addepisode == 'y': programName = programName + ' ('+ str(episode) + '회)'
|
||||||
@ -1155,18 +1141,3 @@ elif output == "socket" :
|
|||||||
printError("epg2xml.json 파일의 default_xml_socket항목이 없습니다.");
|
printError("epg2xml.json 파일의 default_xml_socket항목이 없습니다.");
|
||||||
sys.exit()
|
sys.exit()
|
||||||
getEpg()
|
getEpg()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#a = [0, 1,2,3,4,5]
|
|
||||||
#it = iter(a)
|
|
||||||
|
|
||||||
#print(next(it))
|
|
||||||
#print(next(it))
|
|
||||||
#for i in it :
|
|
||||||
# print(i)
|
|
||||||
|
|
||||||
|
|
||||||
#import itertools as it
|
|
||||||
#for prev, cur in pairs(it.cycle([1,2,3,4])):
|
|
||||||
# print( cur , prev )
|
|
Loading…
x
Reference in New Issue
Block a user