POOQ 함수 수정
This commit is contained in:
parent
11840d2603
commit
40cceb6eb0
@ -758,7 +758,7 @@ function GetEPGFromPooq($ChannelInfo) {
|
||||
$ChannelName = $ChannelInfo[1];
|
||||
$ServiceId = $ChannelInfo[3];
|
||||
$today = date("Ymd");
|
||||
$lastday = date("Ymd", strtotime("+".($GLOBALS['period'] - 1)." days"));
|
||||
$lastday = date("Ymd", strtotime("+".($GLOBALS['period'])." days"));
|
||||
$url = "https://wapie.pooq.co.kr/v1/epgs30/".$ServiceId."/";
|
||||
$params = array(
|
||||
'deviceTypeId'=> 'pc',
|
||||
@ -796,8 +796,6 @@ function GetEPGFromPooq($ChannelInfo) {
|
||||
if(in_array($program['startDate'] , $date_list)) :
|
||||
$startTime = $program['startDate']." ".$program['startTime'];
|
||||
$startTime = date("YmdHis", strtotime($startTime));
|
||||
$endTime = $program['startDate']." ".$program['endTime'];
|
||||
$endTime = date("YmdHis", strtotime($endTime));
|
||||
$pattern = '/^(.*?)(?:([\d,]+)회)?(?:\((재)\))?$/';
|
||||
$programName = str_replace("\r\n", "", $program['programTitle']);
|
||||
preg_match($pattern, $programName, $matches);
|
||||
@ -809,21 +807,8 @@ function GetEPGFromPooq($ChannelInfo) {
|
||||
if($program['programStaring']) $actors = trim($program['programStaring'], ',');
|
||||
if($program['programSummary']) $desc = trim($program['programSummary']);
|
||||
$rating = $program['age'];
|
||||
$programdata = array(
|
||||
'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);
|
||||
//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);
|
||||
endif;
|
||||
endforeach;
|
||||
@ -835,6 +820,7 @@ function GetEPGFromPooq($ChannelInfo) {
|
||||
} catch (Exception $e) {
|
||||
if($GLOBALS['debug']) printError($e->getMessage());
|
||||
}
|
||||
epgzip($epginfo);
|
||||
}
|
||||
|
||||
// Get EPG data from MBC
|
||||
|
@ -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.2");
|
||||
define("VERSION", "1.2.2p1");
|
||||
|
||||
$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.2");
|
||||
define("VERSION", "1.2.2p1");
|
||||
|
||||
$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'";
|
||||
|
13
epg2xml.py
13
epg2xml.py
@ -38,7 +38,7 @@ except ImportError:
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf-8')
|
||||
|
||||
__version__ = '1.2.2'
|
||||
__version__ = '1.2.2p1'
|
||||
|
||||
if not sys.version_info[:2] == (2, 7):
|
||||
print("Error : ", "python 2.7 버전이 필요합니다.", file=sys.stderr)
|
||||
@ -606,7 +606,8 @@ def GetEPGFromPooq(ChannelInfo):
|
||||
ChannelId = ChannelInfo[0]
|
||||
ChannelName = ChannelInfo[1]
|
||||
ServiceId = ChannelInfo[3]
|
||||
lastday = today + datetime.timedelta(days=period-1)
|
||||
epginfo = []
|
||||
lastday = today + datetime.timedelta(days=period)
|
||||
url = 'https://wapie.pooq.co.kr/v1/epgs30/' + str(ServiceId) + '/'
|
||||
params = {'deviceTypeId': 'pc', 'marketTypeId': 'generic', 'apiAccessCredential': 'EEBE901F80B3A4C4E5322D58110BE95C', 'offset': '0', 'limit': '1000', 'startTime': today.strftime('%Y/%m/%d') + ' 00:00', 'endTime': lastday.strftime('%Y/%m/%d') + ' 00:00'}
|
||||
date_list = [(today + datetime.timedelta(days=x)).strftime('%Y-%m-%d') for x in range(0, period)]
|
||||
@ -629,9 +630,6 @@ def GetEPGFromPooq(ChannelInfo):
|
||||
startTime = program['startDate'] + ' ' + program['startTime']
|
||||
startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
|
||||
startTime = startTime.strftime('%Y%m%d%H%M%S')
|
||||
endTime = program['startDate'] + ' ' + program['endTime']
|
||||
endTime = datetime.datetime.strptime(endTime, '%Y-%m-%d %H:%M')
|
||||
endTime = endTime.strftime('%Y%m%d%H%M%S')
|
||||
programName = program['programTitle'].replace("\r\n", "").encode('utf-8');
|
||||
pattern = '^(.*?)(?:([\d,]+)회)?(?:\((재)\))?$'
|
||||
matches = re.match(pattern, programName)
|
||||
@ -642,8 +640,8 @@ def GetEPGFromPooq(ChannelInfo):
|
||||
actors = program['programStaring'].strip(',').strip() if program['programStaring'] else ''
|
||||
desc = program['programSummary'].strip() if program['programSummary'] else ''
|
||||
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}
|
||||
writeProgram(programdata)
|
||||
#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.001)
|
||||
except ValueError:
|
||||
if(debug): printError(ChannelName + CONTENT_ERROR)
|
||||
@ -651,6 +649,7 @@ def GetEPGFromPooq(ChannelInfo):
|
||||
except (requests.exceptions.RequestException) as e:
|
||||
if(debug): printError(ChannelName + str(e))
|
||||
else: pass
|
||||
epgzip(epginfo)
|
||||
|
||||
# Get EPG data from MBC
|
||||
def GetEPGFromMbc(ChannelInfo):
|
||||
|
Loading…
x
Reference in New Issue
Block a user