update 1.2.2.p2
This commit is contained in:
parent
e0b872f7a5
commit
7624757bcc
@ -636,7 +636,9 @@ function GetEPGFromIscs($ChannelInfo) {
|
||||
$ChannelName = $ChannelInfo[1];
|
||||
$ServiceId = $ChannelInfo[3];
|
||||
$epginfo = array();
|
||||
$epginfo2 = array();
|
||||
foreach(range(1, $GLOBALS['period']) as $k) :
|
||||
$istomorrow = False;
|
||||
$url = "http://m.iscs.co.kr/sub/02/data.asp";
|
||||
$day = date("Y-m-d", strtotime("+".($k - 1)." days"));
|
||||
$params = array(
|
||||
@ -664,7 +666,13 @@ function GetEPGFromIscs($ChannelInfo) {
|
||||
$startTime = $endTime = $programName = $subprogramName = $desc = $actors = $producers = $category = $episode = "";
|
||||
$rebroadcast = False;
|
||||
$rating = 0;
|
||||
$startTime = date("YmdHis", strtotime($day." ".$program['Time']));
|
||||
if(startsWith($program['Time'], '1') || startsWith($program['Time'], '2')) $istomorrow = True;
|
||||
if(startsWith($program['Time'], '0') && $istomorrow == True) :
|
||||
// $thisday = date("Ymd", strtotime($day." +1 days"));
|
||||
$startTime = date("YmdHis", strtotime($day." +1 days"." ".$program['Time']));
|
||||
else :
|
||||
$startTime = date("YmdHis", strtotime($day." ".$program['Time']));
|
||||
endif;
|
||||
$pattern = '/^(.*?)(?:\(([\d,]+)회\))?(?:\((재)\))?$/';
|
||||
preg_match($pattern, trim($program['Pg_Name']), $matches);
|
||||
if ($matches != NULL) :
|
||||
@ -690,7 +698,9 @@ function GetEPGFromIscs($ChannelInfo) {
|
||||
if($GLOBALS['debug']) printError($e->getMessage());
|
||||
}
|
||||
endforeach;
|
||||
epgzip($epginfo);
|
||||
$epginfo2 = array_map("unserialize", array_unique(array_map("serialize", $epginfo)));
|
||||
epgzip($epginfo2);
|
||||
|
||||
}
|
||||
|
||||
// Get EPG data from Hcn
|
||||
@ -1111,8 +1121,6 @@ function GetEPGFromArirang($ChannelInfo) {
|
||||
else :
|
||||
$dom = new DomDocument;
|
||||
libxml_use_internal_errors(True);
|
||||
//echo $response;
|
||||
|
||||
$response = mb_convert_encoding($response, "HTML-ENTITIES", "EUC-KR");
|
||||
if($dom->loadHTML($response)):
|
||||
$xpath = new DomXPath($dom);
|
||||
@ -1169,6 +1177,7 @@ function GetEPGFromArirang($ChannelInfo) {
|
||||
|
||||
# Zip epginfo
|
||||
function epgzip($epginfo) {
|
||||
if($epginfo == NULL) $epginfo = array();
|
||||
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||
$zipped = array_slice(array_map(NULL, $epginfo, array_slice($epginfo,1)),0,-1);
|
||||
foreach($zipped as $epg) :
|
||||
@ -1347,4 +1356,8 @@ function _microtime() {
|
||||
list($usec, $sec) = explode(" ", microtime());
|
||||
return ($sec.(int)($usec*1000));
|
||||
}
|
||||
|
||||
function startsWith($haystack, $needle) {
|
||||
return !strncmp($haystack, $needle, strlen($needle));
|
||||
}
|
||||
?>
|
||||
|
@ -3,7 +3,7 @@ include __DIR__."/epg2xml-function.php";
|
||||
@date_default_timezone_set('Asia/Seoul');
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
@set_time_limit(0);
|
||||
define("VERSION", "1.2.2p1");
|
||||
define("VERSION", "1.2.2p2");
|
||||
|
||||
$debug = False;
|
||||
$ua = "'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36'";
|
||||
|
@ -3,7 +3,7 @@
|
||||
include __DIR__."/epg2xml-function.php";
|
||||
@date_default_timezone_set('Asia/Seoul');
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
define("VERSION", "1.2.2p1");
|
||||
define("VERSION", "1.2.2p2");
|
||||
|
||||
$debug = False;
|
||||
$ua = "'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36'";
|
||||
|
18
epg2xml.py
18
epg2xml.py
@ -38,7 +38,7 @@ except ImportError:
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf-8')
|
||||
|
||||
__version__ = '1.2.2p1'
|
||||
__version__ = '1.2.2p2'
|
||||
|
||||
if not sys.version_info[:2] == (2, 7):
|
||||
print("Error : ", "python 2.7 버전이 필요합니다.", file=sys.stderr)
|
||||
@ -173,7 +173,7 @@ def GetEPGFromEPG(ChannelInfo):
|
||||
thisday = day
|
||||
row = html[i].find_all('td', {'colspan':'2'})
|
||||
for cell in row:
|
||||
hour = int(cell.text.strip().strip('시'))
|
||||
hour = int(cell.text.strip().strip('시'))
|
||||
if(i == 1) : hour = 'AM ' + str(hour)
|
||||
elif(i == 2) : hour = 'PM ' + str(hour)
|
||||
elif(i == 3 and hour > 5 and hour < 12 ) : hour = 'PM ' + str(hour)
|
||||
@ -518,8 +518,10 @@ def GetEPGFromIscs(ChannelInfo):
|
||||
ChannelName = ChannelInfo[1]
|
||||
ServiceId = ChannelInfo[3]
|
||||
epginfo = []
|
||||
epginfo2 = []
|
||||
url='http://m.iscs.co.kr/sub/02/data.asp'
|
||||
for k in range(period):
|
||||
istomorrow = False
|
||||
day = today + datetime.timedelta(days=k)
|
||||
params = {'Exec_Mode': 'view', 'Source_Id': ServiceId, 'Ch_Day': day}
|
||||
response = requests.post(url, data=params, headers=ua, timeout=timeout)
|
||||
@ -533,7 +535,12 @@ def GetEPGFromIscs(ChannelInfo):
|
||||
startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
|
||||
rebroadcast = False
|
||||
rating = 0
|
||||
startTime = str(day) + ' ' + program['Time']
|
||||
if program['Time'].startswith('1') or program['Time'].startswith('2'):
|
||||
istomorrow = True
|
||||
if program['Time'].startswith('0') and istomorrow == True:
|
||||
startTime = str(day + datetime.timedelta(days=1)) + ' ' + program['Time']
|
||||
else:
|
||||
startTime = str(day) + ' ' + program['Time']
|
||||
startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
|
||||
startTime = startTime.strftime('%Y%m%d%H%M%S')
|
||||
pattern = '^(.*?)(?:\(([\d,]+)회\))?(?:\((재)\))?$';
|
||||
@ -555,7 +562,10 @@ def GetEPGFromIscs(ChannelInfo):
|
||||
except (requests.RequestException) as e:
|
||||
if(debug): printError(ChannelName + str(e))
|
||||
else: pass
|
||||
epgzip(epginfo)
|
||||
for i in epginfo:
|
||||
if not i in epginfo2:
|
||||
epginfo2.append(i)
|
||||
epgzip(epginfo2)
|
||||
|
||||
# Get EPG data from HCN
|
||||
def GetEPGFromHcn(ChannelInfo):
|
||||
|
Loading…
x
Reference in New Issue
Block a user