iscs, hcn, pooq 함수 추가
함수 최적화
This commit is contained in:
		
							parent
							
								
									94cc149103
								
							
						
					
					
						commit
						11b0bea1d9
					
				
							
								
								
									
										406
									
								
								epg2xml.py
									
									
									
									
									
								
							
							
						
						
									
										406
									
								
								epg2xml.py
									
									
									
									
									
								
							@ -113,32 +113,30 @@ def getEpg():
 | 
				
			|||||||
        if(debug) : printLog(ChannelName + ' 채널 EPG 데이터를 가져오고 있습니다')
 | 
					        if(debug) : printLog(ChannelName + ' 채널 EPG 데이터를 가져오고 있습니다')
 | 
				
			||||||
        if ChannelSource == 'EPG':
 | 
					        if ChannelSource == 'EPG':
 | 
				
			||||||
            GetEPGFromEPG(ChannelInfo)
 | 
					            GetEPGFromEPG(ChannelInfo)
 | 
				
			||||||
        #elif ChannelSource == 'KT':
 | 
					        elif ChannelSource == 'KT':
 | 
				
			||||||
        #    GetEPGFromKT(ChannelInfo)
 | 
					            GetEPGFromKT(ChannelInfo)
 | 
				
			||||||
        #elif ChannelSource == 'LG':
 | 
					        elif ChannelSource == 'LG':
 | 
				
			||||||
        #    GetEPGFromLG(ChannelInfo)
 | 
					            GetEPGFromLG(ChannelInfo)
 | 
				
			||||||
        #elif ChannelSource == 'SK':
 | 
					        elif ChannelSource == 'SK':
 | 
				
			||||||
        #    GetEPGFromSK(ChannelInfo)
 | 
					            GetEPGFromSK(ChannelInfo)
 | 
				
			||||||
        #elif ChannelSource == 'SKB':
 | 
					        elif ChannelSource == 'SKB':
 | 
				
			||||||
        #    GetEPGFromSKB(ChannelInfo)
 | 
					            GetEPGFromSKB(ChannelInfo)
 | 
				
			||||||
        #elif ChannelSource == 'SKY':
 | 
					        elif ChannelSource == 'SKY':
 | 
				
			||||||
        #    GetEPGFromSKY(ChannelInfo)
 | 
					            GetEPGFromSKY(ChannelInfo)
 | 
				
			||||||
        #elif ChannelSource == 'NAVER':
 | 
					        elif ChannelSource == 'NAVER':
 | 
				
			||||||
        #    GetEPGFromNaver(ChannelInfo)
 | 
					            GetEPGFromNaver(ChannelInfo)
 | 
				
			||||||
        #elif ChannelSource == 'TBROAD':
 | 
					        elif ChannelSource == 'ISCS':
 | 
				
			||||||
        #    GetEPGFromTbroad(ChannelInfo)
 | 
					            GetEPGFromIscs(ChannelInfo)
 | 
				
			||||||
        #elif ChannelSource == 'ISCS':
 | 
					        elif ChannelSource == 'HCN':
 | 
				
			||||||
        #    GetEPGFromIscs(ChannelInfo)
 | 
					            GetEPGFromHcn(ChannelInfo)
 | 
				
			||||||
        #elif ChannelSource == 'HCN':
 | 
					 | 
				
			||||||
        #    GetEPGFromHcn(ChannelInfo)
 | 
					 | 
				
			||||||
        elif ChannelSource == 'POOQ':
 | 
					        elif ChannelSource == 'POOQ':
 | 
				
			||||||
            GetEPGFromPooq(ChannelInfo)
 | 
					            GetEPGFromPooq(ChannelInfo)
 | 
				
			||||||
        #elif ChannelSource == 'MBC':
 | 
					        elif ChannelSource == 'MBC':
 | 
				
			||||||
        #    GetEPGFromMbc(ChannelInfo)
 | 
					            GetEPGFromMbc(ChannelInfo)
 | 
				
			||||||
        #elif ChannelSource == 'MIL':
 | 
					        elif ChannelSource == 'MIL':
 | 
				
			||||||
        #    GetEPGFromMil(ChannelInfo)
 | 
					            GetEPGFromMil(ChannelInfo)
 | 
				
			||||||
        #elif ChannelSource == 'IFM':
 | 
					        elif ChannelSource == 'IFM':
 | 
				
			||||||
        #    GetEPGFromIfm(ChannelInfo)
 | 
					            GetEPGFromIfm(ChannelInfo)
 | 
				
			||||||
        elif ChannelSource == 'KBS':
 | 
					        elif ChannelSource == 'KBS':
 | 
				
			||||||
            GetEPGFromKbs(ChannelInfo)
 | 
					            GetEPGFromKbs(ChannelInfo)
 | 
				
			||||||
    print('</tv>')
 | 
					    print('</tv>')
 | 
				
			||||||
@ -150,6 +148,9 @@ def GetEPGFromEPG(ChannelInfo):
 | 
				
			|||||||
    ServiceId =  ChannelInfo[3]
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
    url = 'http://211.43.210.10:88/epg-cgi/extern/cnm_guide_type_v070530.php'
 | 
					    url = 'http://211.43.210.10:88/epg-cgi/extern/cnm_guide_type_v070530.php'
 | 
				
			||||||
    epginfo = []
 | 
					    epginfo = []
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
    for k in range(period):
 | 
					    for k in range(period):
 | 
				
			||||||
        day = today + datetime.timedelta(days=k)
 | 
					        day = today + datetime.timedelta(days=k)
 | 
				
			||||||
        params = {'beforegroup':'100', 'checkchannel[]':ServiceId, 'select_group':'100', 'start_date':day.strftime('%Y%m%d')}
 | 
					        params = {'beforegroup':'100', 'checkchannel[]':ServiceId, 'select_group':'100', 'start_date':day.strftime('%Y%m%d')}
 | 
				
			||||||
@ -173,38 +174,26 @@ def GetEPGFromEPG(ChannelInfo):
 | 
				
			|||||||
                        hour = 'AM ' + str(hour)
 | 
					                        hour = 'AM ' + str(hour)
 | 
				
			||||||
                        thisday = day + datetime.timedelta(days=1)
 | 
					                        thisday = day + datetime.timedelta(days=1)
 | 
				
			||||||
                    for celldata in cell.parent.find_all('tr'):
 | 
					                    for celldata in cell.parent.find_all('tr'):
 | 
				
			||||||
                        pattern = "<tr>.*\[(.*)\]<\/td>\s.*\">(.*?)\s*(<(.*)>)?\s*(\(재\))?\s*(\(([\d,]+)회\))?(<img.*?)?(<\/a>)?\s*<\/td><\/tr>"
 | 
					                        pattern = "<tr>.*\[(.*)\]<\/td>\s.*\">(.*?)\s*(<(.*)>)?\s*(\(재\))?\s*(\(([\d,]+)회\)?)?(<img.*?)?(<\/a>)?\s*<\/td><\/tr>"
 | 
				
			||||||
                        matches = re.match(pattern, str(celldata))
 | 
					                        matches = re.match(pattern, str(celldata))
 | 
				
			||||||
                        if not (matches is None):
 | 
					                        if not (matches is None):
 | 
				
			||||||
                            minute = matches.group(1) if matches.group(1) else ''
 | 
					                            minute = matches.group(1) if matches.group(1) else ''
 | 
				
			||||||
                            startTime = str(thisday) + ' ' + hour + ':' + minute
 | 
					                            startTime = str(thisday) + ' ' + hour + ':' + minute[-2:]
 | 
				
			||||||
                            startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %p %I:%M')
 | 
					                            startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %p %I:%M')
 | 
				
			||||||
                            startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
					                            startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
				
			||||||
                            image = matches.group(8) if matches.group(8) else ''
 | 
					                            image = matches.group(8) if matches.group(8) else ''
 | 
				
			||||||
                            grade = re.match('.*schedule_([\d,]+)?.*',image)
 | 
					                            grade = re.match('.*schedule_([\d,]+)?.*',image)
 | 
				
			||||||
                            if not (grade is None): rating = int(grade.group(1))
 | 
					                            if not (grade is None): rating = int(grade.group(1))
 | 
				
			||||||
                            else : rating = 0
 | 
					 | 
				
			||||||
                            programName = matches.group(2).strip() if matches.group(2) else ''
 | 
					                            programName = matches.group(2).strip() if matches.group(2) else ''
 | 
				
			||||||
                            subprogramName = matches.group(4).strip() if matches.group(4) else ''
 | 
					                            subprogramName = matches.group(4).strip() if matches.group(4) else ''
 | 
				
			||||||
                            #programName, startTime, rating, subprogramName, rebroadcast, episode
 | 
					                            rebroadcast = True if matches.group(5) else False;
 | 
				
			||||||
                            epginfo.append([programName, startTime, rating, subprogramName, matches.group(5), matches.group(7)])
 | 
					                            episode = matches.group(7) if matches.group(7) else ''
 | 
				
			||||||
 | 
					                        #ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
 | 
				
			||||||
 | 
					                        epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
 | 
				
			||||||
        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
 | 
				
			||||||
    for epg1, epg2 in zip(epginfo, epginfo[1:]):
 | 
					    epgzip(epginfo)
 | 
				
			||||||
        programName = epg1[0] if epg1[0] else ''
 | 
					 | 
				
			||||||
        subprogramName = epg1[3] if epg1[3] else ''
 | 
					 | 
				
			||||||
        startTime = epg1[1] if epg1[1] else ''
 | 
					 | 
				
			||||||
        endTime = epg2[1] if epg2[1] else ''
 | 
					 | 
				
			||||||
        desc = ''
 | 
					 | 
				
			||||||
        actors = ''
 | 
					 | 
				
			||||||
        producers = ''
 | 
					 | 
				
			||||||
        category = ''
 | 
					 | 
				
			||||||
        rebroadcast = True if epg1[4] else False
 | 
					 | 
				
			||||||
        episode = epg1[5] if epg1[5] else ''
 | 
					 | 
				
			||||||
        rating = int(epg1[2]) if epg1[2] 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}
 | 
					 | 
				
			||||||
        writeProgram(programdata)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get EPG data from KT
 | 
					# Get EPG data from KT
 | 
				
			||||||
def GetEPGFromKT(ChannelInfo):
 | 
					def GetEPGFromKT(ChannelInfo):
 | 
				
			||||||
@ -213,6 +202,9 @@ def GetEPGFromKT(ChannelInfo):
 | 
				
			|||||||
    ServiceId =  ChannelInfo[3]
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
    url = 'http://tv.olleh.com/renewal_sub/liveTv/pop_schedule_week.asp'
 | 
					    url = 'http://tv.olleh.com/renewal_sub/liveTv/pop_schedule_week.asp'
 | 
				
			||||||
    epginfo = []
 | 
					    epginfo = []
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
    for k in range(period):
 | 
					    for k in range(period):
 | 
				
			||||||
        day = today + datetime.timedelta(days=k)
 | 
					        day = today + datetime.timedelta(days=k)
 | 
				
			||||||
        params = {'ch_name':'', 'ch_no':ServiceId, 'nowdate':day.strftime('%Y%m%d'), 'seldatie':day.strftime('%Y%m%d'), 'tab_no':'1'}
 | 
					        params = {'ch_name':'', 'ch_no':ServiceId, 'nowdate':day.strftime('%Y%m%d'), 'seldatie':day.strftime('%Y%m%d'), 'tab_no':'1'}
 | 
				
			||||||
@ -227,36 +219,26 @@ def GetEPGFromKT(ChannelInfo):
 | 
				
			|||||||
            if(html):
 | 
					            if(html):
 | 
				
			||||||
                for row in html:
 | 
					                for row in html:
 | 
				
			||||||
                    for cell in [row.find_all('td')]:
 | 
					                    for cell in [row.find_all('td')]:
 | 
				
			||||||
                        epginfo.append([cell[1].text, str(day) + ' ' + cell[0].text, cell[4].text, cell[2].text])
 | 
					                        startTime = str(day) + ' ' + cell[0].text
 | 
				
			||||||
 | 
					                        startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
 | 
				
			||||||
 | 
					                        startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
				
			||||||
 | 
					                        pattern = '^(.*?)( <(.*)>)?$'
 | 
				
			||||||
 | 
					                        matches = re.match(pattern, cell[1].text.decode('string_escape'))
 | 
				
			||||||
 | 
					                        if not (matches is None):
 | 
				
			||||||
 | 
					                            programName = matches.group(1) if matches.group(1) else ''
 | 
				
			||||||
 | 
					                            subprogramName = matches.group(3) if matches.group(3) else ''
 | 
				
			||||||
 | 
					                        category = cell[4].text
 | 
				
			||||||
 | 
					                        matches = re.match('(\d+)', cell[2].text)
 | 
				
			||||||
 | 
					                        if not(matches is None): rating = int(matches.group())
 | 
				
			||||||
 | 
					                        #ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
 | 
				
			||||||
 | 
					                        epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
 | 
				
			||||||
 | 
					                epgzip(epginfo)
 | 
				
			||||||
            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
 | 
				
			||||||
    for epg1, epg2 in zip(epginfo, epginfo[1:]):
 | 
					 | 
				
			||||||
        programName = ''
 | 
					 | 
				
			||||||
        subprogrmaName = ''
 | 
					 | 
				
			||||||
        pattern = '^(.*?)( <(.*)>)?$'
 | 
					 | 
				
			||||||
        matches = re.match(pattern, epg1[0].decode('string_escape'))
 | 
					 | 
				
			||||||
        if not (matches is None):
 | 
					 | 
				
			||||||
            programName = matches.group(1) if matches.group(1) else ''
 | 
					 | 
				
			||||||
            subprogramName = matches.group(3) if matches.group(3) else ''
 | 
					 | 
				
			||||||
        startTime = datetime.datetime.strptime(epg1[1], '%Y-%m-%d %H:%M')
 | 
					 | 
				
			||||||
        startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
					 | 
				
			||||||
        endTime = datetime.datetime.strptime(epg2[1], '%Y-%m-%d %H:%M')
 | 
					 | 
				
			||||||
        endTime = endTime.strftime('%Y%m%d%H%M%S')
 | 
					 | 
				
			||||||
        category = epg1[2]
 | 
					 | 
				
			||||||
        desc = ''
 | 
					 | 
				
			||||||
        actors = ''
 | 
					 | 
				
			||||||
        producers = ''
 | 
					 | 
				
			||||||
        episode = ''
 | 
					 | 
				
			||||||
        rebroadcast = False
 | 
					 | 
				
			||||||
        rating = 0
 | 
					 | 
				
			||||||
        matches = re.match('(\d+)', epg1[3])
 | 
					 | 
				
			||||||
        if not(matches is None): rating = int(matches.group())
 | 
					 | 
				
			||||||
        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)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get EPG data from LG
 | 
					# Get EPG data from LG
 | 
				
			||||||
def GetEPGFromLG(ChannelInfo):
 | 
					def GetEPGFromLG(ChannelInfo):
 | 
				
			||||||
@ -265,6 +247,9 @@ def GetEPGFromLG(ChannelInfo):
 | 
				
			|||||||
    ServiceId =  ChannelInfo[3]
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
    url = 'http://www.uplus.co.kr/css/chgi/chgi/RetrieveTvSchedule.hpi'
 | 
					    url = 'http://www.uplus.co.kr/css/chgi/chgi/RetrieveTvSchedule.hpi'
 | 
				
			||||||
    epginfo = []
 | 
					    epginfo = []
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
    for k in range(period):
 | 
					    for k in range(period):
 | 
				
			||||||
        day = today + datetime.timedelta(days=k)
 | 
					        day = today + datetime.timedelta(days=k)
 | 
				
			||||||
        params = {'chnlCd': ServiceId, 'evntCmpYmd': day.strftime('%Y%m%d')}
 | 
					        params = {'chnlCd': ServiceId, 'evntCmpYmd': day.strftime('%Y%m%d')}
 | 
				
			||||||
@ -280,44 +265,37 @@ def GetEPGFromLG(ChannelInfo):
 | 
				
			|||||||
            if(html):
 | 
					            if(html):
 | 
				
			||||||
                for row in html:
 | 
					                for row in html:
 | 
				
			||||||
                    for cell in [row.find_all('td')]:
 | 
					                    for cell in [row.find_all('td')]:
 | 
				
			||||||
 | 
					                        startTime = str(day) + ' ' + cell[0].text
 | 
				
			||||||
 | 
					                        startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
 | 
				
			||||||
 | 
					                        startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
				
			||||||
                        rating = 0 if cell[1].find('span', {'class': 'tag cte_all'}).text.strip()=="All" else int(cell[1].find('span', {'class': 'tag cte_all'}).text.strip())
 | 
					                        rating = 0 if cell[1].find('span', {'class': 'tag cte_all'}).text.strip()=="All" else int(cell[1].find('span', {'class': 'tag cte_all'}).text.strip())
 | 
				
			||||||
                        cell[1].find('span', {'class': 'tagGroup'}).decompose()
 | 
					                        cell[1].find('span', {'class': 'tagGroup'}).decompose()
 | 
				
			||||||
                        epginfo.append([cell[1].text.strip(), str(day) + ' ' + cell[0].text, cell[2].text.strip(), rating])
 | 
					                        pattern = '(<재>?)?(.*?)(\[(.*)\])?\s?(\(([\d,]+)회\))?$'
 | 
				
			||||||
 | 
					                        matches = re.match(pattern, cell[1].text.strip().decode('string_escape'))
 | 
				
			||||||
 | 
					                        if not (matches is None):
 | 
				
			||||||
 | 
					                            programName = matches.group(2).strip() if matches.group(2) else ''
 | 
				
			||||||
 | 
					                            subprogramName = matches.group(4).strip() if matches.group(4) else ''
 | 
				
			||||||
 | 
					                            episode = matches.group(6) if matches.group(6) else ''
 | 
				
			||||||
 | 
					                            rebroadcast = True if matches.group(1) else False
 | 
				
			||||||
 | 
					                        category =  cell[2].text.strip()
 | 
				
			||||||
 | 
					                        #ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
 | 
				
			||||||
 | 
					                        epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
 | 
				
			||||||
 | 
					                epgzip(epginfo)
 | 
				
			||||||
            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
 | 
				
			||||||
    for epg1, epg2 in zip(epginfo, epginfo[1:]):
 | 
					 | 
				
			||||||
        programName = ''
 | 
					 | 
				
			||||||
        subprogramName = ''
 | 
					 | 
				
			||||||
        episode = ''
 | 
					 | 
				
			||||||
        pattern = '(<재>?)?(.*?)(\[(.*)\])?\s?(\(([\d,]+)회\))?$'
 | 
					 | 
				
			||||||
        matches = re.match(pattern,  epg1[0].decode('string_escape'))
 | 
					 | 
				
			||||||
        rebroadcast = False
 | 
					 | 
				
			||||||
        if not (matches is None):
 | 
					 | 
				
			||||||
            programName = matches.group(2) if matches.group(2) else ''
 | 
					 | 
				
			||||||
            subprogramName = matches.group(4) if matches.group(4) else ''
 | 
					 | 
				
			||||||
            rebroadcast = True if matches.group(1) else False
 | 
					 | 
				
			||||||
            episode = matches.group(6) if matches.group(6) else ''
 | 
					 | 
				
			||||||
        startTime = datetime.datetime.strptime(epg1[1], '%Y-%m-%d %H:%M')
 | 
					 | 
				
			||||||
        startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
					 | 
				
			||||||
        endTime = datetime.datetime.strptime(epg2[1], '%Y-%m-%d %H:%M')
 | 
					 | 
				
			||||||
        endTime = endTime.strftime('%Y%m%d%H%M%S')
 | 
					 | 
				
			||||||
        category = epg1[2]
 | 
					 | 
				
			||||||
        desc = ''
 | 
					 | 
				
			||||||
        actors = ''
 | 
					 | 
				
			||||||
        producers = ''
 | 
					 | 
				
			||||||
        rating = epg1[3]
 | 
					 | 
				
			||||||
        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)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get EPG data from SK
 | 
					# Get EPG data from SK
 | 
				
			||||||
def GetEPGFromSK(ChannelInfo):
 | 
					def GetEPGFromSK(ChannelInfo):
 | 
				
			||||||
    ChannelId = ChannelInfo[0]
 | 
					    ChannelId = ChannelInfo[0]
 | 
				
			||||||
    ChannelName = ChannelInfo[1]
 | 
					    ChannelName = ChannelInfo[1]
 | 
				
			||||||
    ServiceId =  ChannelInfo[3]
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
    lastday = today + datetime.timedelta(days=period-1)
 | 
					    lastday = today + datetime.timedelta(days=period-1)
 | 
				
			||||||
    url = 'http://m.btvplus.co.kr/Common/Inc/IFGetData.asp'
 | 
					    url = 'http://m.btvplus.co.kr/Common/Inc/IFGetData.asp'
 | 
				
			||||||
    params = {'variable': 'IF_LIVECHART_DETAIL', 'pcode':'|^|start_time=' + today.strftime('%Y%m%d') + '00|^|end_time='+ lastday.strftime('%Y%m%d') + '24|^|svc_id=' + str(ServiceId)}
 | 
					    params = {'variable': 'IF_LIVECHART_DETAIL', 'pcode':'|^|start_time=' + today.strftime('%Y%m%d') + '00|^|end_time='+ lastday.strftime('%Y%m%d') + '24|^|svc_id=' + str(ServiceId)}
 | 
				
			||||||
@ -333,10 +311,6 @@ def GetEPGFromSK(ChannelInfo):
 | 
				
			|||||||
            else :
 | 
					            else :
 | 
				
			||||||
                programs = data['channel']['programs']
 | 
					                programs = data['channel']['programs']
 | 
				
			||||||
                for program in programs:
 | 
					                for program in programs:
 | 
				
			||||||
                    programName = ''
 | 
					 | 
				
			||||||
                    subprogramName = ''
 | 
					 | 
				
			||||||
                    episode = ''
 | 
					 | 
				
			||||||
                    rebroadcast = False
 | 
					 | 
				
			||||||
                    pattern = '^(.*?)(?:\s*[\(<]([\d,회]+)[\)>])?(?:\s*<([^<]*?)>)?(\((재)\))?$'
 | 
					                    pattern = '^(.*?)(?:\s*[\(<]([\d,회]+)[\)>])?(?:\s*<([^<]*?)>)?(\((재)\))?$'
 | 
				
			||||||
                    matches = re.match(pattern, program['programName'].replace('...', '>').encode('utf-8'))
 | 
					                    matches = re.match(pattern, program['programName'].replace('...', '>').encode('utf-8'))
 | 
				
			||||||
                    if not (matches is None):
 | 
					                    if not (matches is None):
 | 
				
			||||||
@ -354,8 +328,6 @@ def GetEPGFromSK(ChannelInfo):
 | 
				
			|||||||
                    producers = program['directorName'].replace('...','').strip(', ')  if program['directorName'] else ''
 | 
					                    producers = program['directorName'].replace('...','').strip(', ')  if program['directorName'] else ''
 | 
				
			||||||
                    if not (program['mainGenreName'] is None) :
 | 
					                    if not (program['mainGenreName'] is None) :
 | 
				
			||||||
                        category = program['mainGenreName']
 | 
					                        category = program['mainGenreName']
 | 
				
			||||||
                    else:
 | 
					 | 
				
			||||||
                        category = ''
 | 
					 | 
				
			||||||
                    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)
 | 
				
			||||||
@ -371,6 +343,9 @@ def GetEPGFromSKB(ChannelInfo):
 | 
				
			|||||||
    ChannelId = ChannelInfo[0]
 | 
					    ChannelId = ChannelInfo[0]
 | 
				
			||||||
    ChannelName = ChannelInfo[1]
 | 
					    ChannelName = ChannelInfo[1]
 | 
				
			||||||
    ServiceId =  ChannelInfo[3]
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
    url = 'http://m.skbroadband.com/content/realtime/Channel_List.do'
 | 
					    url = 'http://m.skbroadband.com/content/realtime/Channel_List.do'
 | 
				
			||||||
    epginfo = []
 | 
					    epginfo = []
 | 
				
			||||||
    for k in range(period):
 | 
					    for k in range(period):
 | 
				
			||||||
@ -398,38 +373,24 @@ def GetEPGFromSKB(ChannelInfo):
 | 
				
			|||||||
                    rating = row.find('span', {'class':re.compile('^watch.*$')})
 | 
					                    rating = row.find('span', {'class':re.compile('^watch.*$')})
 | 
				
			||||||
                    if not(rating is None) :
 | 
					                    if not(rating is None) :
 | 
				
			||||||
                        rating = int(rating.text.decode('string_escape').replace('세','').strip())
 | 
					                        rating = int(rating.text.decode('string_escape').replace('세','').strip())
 | 
				
			||||||
                    else :
 | 
					                    #ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
 | 
				
			||||||
                        rating = 0
 | 
					                    epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
 | 
				
			||||||
                        #programName, startTime, rating, subprogramName, rebroadcast, episode
 | 
					                epgzip(epginfo)
 | 
				
			||||||
                    epginfo.append([programName, startTime, rating, subprogramName, rebroadcast, episode])
 | 
					 | 
				
			||||||
            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        
 | 
				
			||||||
    for epg1, epg2 in zip(epginfo, epginfo[1:]):
 | 
					 | 
				
			||||||
        programName = epg1[0] if epg1[0] else ''
 | 
					 | 
				
			||||||
        subprogramName = epg1[3] if epg1[3] else ''
 | 
					 | 
				
			||||||
        episode = epg1[5] if epg1[5] else ''
 | 
					 | 
				
			||||||
        rebroadcast = epg1[4] if epg1[4] else False
 | 
					 | 
				
			||||||
        startTime = datetime.datetime.strptime(epg1[1], '%Y-%m-%d %H:%M')
 | 
					 | 
				
			||||||
        startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
					 | 
				
			||||||
        endTime = datetime.datetime.strptime(epg2[1], '%Y-%m-%d %H:%M')
 | 
					 | 
				
			||||||
        endTime = endTime.strftime('%Y%m%d%H%M%S')
 | 
					 | 
				
			||||||
        category = ''
 | 
					 | 
				
			||||||
        desc = ''
 | 
					 | 
				
			||||||
        actors = ''
 | 
					 | 
				
			||||||
        producers = ''
 | 
					 | 
				
			||||||
        rating = epg1[2] if epg1[2] 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}
 | 
					 | 
				
			||||||
        writeProgram(programdata)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get EPG data from SKY
 | 
					# Get EPG data from SKY
 | 
				
			||||||
def GetEPGFromSKY(ChannelInfo):
 | 
					def GetEPGFromSKY(ChannelInfo):
 | 
				
			||||||
    ChannelId = ChannelInfo[0]
 | 
					    ChannelId = ChannelInfo[0]
 | 
				
			||||||
    ChannelName = ChannelInfo[1]
 | 
					    ChannelName = ChannelInfo[1]
 | 
				
			||||||
    ServiceId =  ChannelInfo[3]
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
    url = 'http://www.skylife.co.kr/channel/epg/channelScheduleListJson.do'
 | 
					    url = 'http://www.skylife.co.kr/channel/epg/channelScheduleListJson.do'
 | 
				
			||||||
    for k in range(period):
 | 
					    for k in range(period):
 | 
				
			||||||
        day = today + datetime.timedelta(days=k)
 | 
					        day = today + datetime.timedelta(days=k)
 | 
				
			||||||
@ -476,6 +437,9 @@ def GetEPGFromNaver(ChannelInfo):
 | 
				
			|||||||
    ChannelName = ChannelInfo[1]
 | 
					    ChannelName = ChannelInfo[1]
 | 
				
			||||||
    ServiceId =  ChannelInfo[3]
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
    epginfo = []
 | 
					    epginfo = []
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
    totaldate = []
 | 
					    totaldate = []
 | 
				
			||||||
    url = 'https://search.naver.com/p/csearch/content/batchrender_ssl.nhn'
 | 
					    url = 'https://search.naver.com/p/csearch/content/batchrender_ssl.nhn'
 | 
				
			||||||
    for k in range(period):
 | 
					    for k in range(period):
 | 
				
			||||||
@ -491,25 +455,16 @@ def GetEPGFromNaver(ChannelInfo):
 | 
				
			|||||||
            for i, date in enumerate(data['displayDates']):
 | 
					            for i, date in enumerate(data['displayDates']):
 | 
				
			||||||
                for j in range(0,24):
 | 
					                for j in range(0,24):
 | 
				
			||||||
                    for program in data['schedules'][j][i]:
 | 
					                    for program in data['schedules'][j][i]:
 | 
				
			||||||
                        #programName, startTime, episode, rebroadcast, rating
 | 
					                        programName = unescape(program['title'])
 | 
				
			||||||
                        epginfo.append([program['title'], date['date'] + ' ' + program['startTime'], program['episode'].replace('회',''), program['isRerun'], program['grade']])
 | 
					                        startTime = date['date'] + ' ' + program['startTime']
 | 
				
			||||||
            for epg1, epg2 in zip(epginfo, epginfo[1:]):
 | 
					                        startTime = datetime.datetime.strptime(startTime, '%Y%m%d %H:%M')
 | 
				
			||||||
                programName = unescape(epg1[0]) if epg1[0] else ''
 | 
					                        startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
				
			||||||
                subprogramName = ''
 | 
					                        episode = program['episode'].replace('회','')
 | 
				
			||||||
                startTime = datetime.datetime.strptime(epg1[1], '%Y%m%d %H:%M')
 | 
					                        rebroadcast = program['isRerun']
 | 
				
			||||||
                startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
					                        rating = program['grade']
 | 
				
			||||||
                endTime = datetime.datetime.strptime(epg2[1], '%Y%m%d %H:%M')
 | 
					                         #ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
 | 
				
			||||||
                endTime = endTime.strftime('%Y%m%d%H%M%S')
 | 
					                        epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
 | 
				
			||||||
                desc = ''
 | 
					            epgzip(epginfo)
 | 
				
			||||||
                actors = ''
 | 
					 | 
				
			||||||
                producers = ''
 | 
					 | 
				
			||||||
                category = ''
 | 
					 | 
				
			||||||
                episode = epg1[2] if epg1[2] else ''
 | 
					 | 
				
			||||||
                if episode : episode = int(episode)
 | 
					 | 
				
			||||||
                rebroadcast = epg1[3]
 | 
					 | 
				
			||||||
                rating = epg1[4]
 | 
					 | 
				
			||||||
                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)
 | 
					 | 
				
			||||||
        except ValueError:
 | 
					        except ValueError:
 | 
				
			||||||
             if(debug): printError(ChannelName + CONTENT_ERROR)
 | 
					             if(debug): printError(ChannelName + CONTENT_ERROR)
 | 
				
			||||||
             else: pass
 | 
					             else: pass
 | 
				
			||||||
@ -523,6 +478,9 @@ def GetEPGFromIscs(ChannelInfo):
 | 
				
			|||||||
    ChannelName = ChannelInfo[1]
 | 
					    ChannelName = ChannelInfo[1]
 | 
				
			||||||
    ServiceId =  ChannelInfo[3]
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
    epginfo = []
 | 
					    epginfo = []
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
    url='https://www.iscs.co.kr/service/sub/ajax_channel_view.asp'
 | 
					    url='https://www.iscs.co.kr/service/sub/ajax_channel_view.asp'
 | 
				
			||||||
    for k in range(period):
 | 
					    for k in range(period):
 | 
				
			||||||
        day = today + datetime.timedelta(days=k)
 | 
					        day = today + datetime.timedelta(days=k)
 | 
				
			||||||
@ -546,26 +504,12 @@ def GetEPGFromIscs(ChannelInfo):
 | 
				
			|||||||
                    matches = re.match(pattern, programName)
 | 
					                    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 ''
 | 
				
			||||||
                        rebroadcast = True if matches.group(3) else False
 | 
					 | 
				
			||||||
                        episode = matches.group(2) if matches.group(2) else ''
 | 
					                        episode = matches.group(2) if matches.group(2) else ''
 | 
				
			||||||
                    #programName, startTime, rating, rebroadcast, episode
 | 
					                        rebroadcast = True if matches.group(3) else False
 | 
				
			||||||
                    epginfo.append([programName, startTime, rating, rebroadcast, episode])
 | 
					
 | 
				
			||||||
            for epg1, epg2 in zip(epginfo, epginfo[1:]):
 | 
					                    #ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
 | 
				
			||||||
                programName = unescape(epg1[0]) if epg1[0] else ''
 | 
					                    epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
 | 
				
			||||||
                subprogramName = ''
 | 
					                epgzip(epginfo)
 | 
				
			||||||
                startTime = datetime.datetime.strptime(epg1[1], '%Y-%m-%d %H:%M')
 | 
					 | 
				
			||||||
                startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
					 | 
				
			||||||
                endTime = datetime.datetime.strptime(epg2[1], '%Y-%m-%d %H:%M')
 | 
					 | 
				
			||||||
                endTime = endTime.strftime('%Y%m%d%H%M%S')
 | 
					 | 
				
			||||||
                desc = ''
 | 
					 | 
				
			||||||
                actors = ''
 | 
					 | 
				
			||||||
                producers = ''
 | 
					 | 
				
			||||||
                category = ''
 | 
					 | 
				
			||||||
                episode = epg1[4]
 | 
					 | 
				
			||||||
                rebroadcast = epg1[3]
 | 
					 | 
				
			||||||
                rating = epg1[2]
 | 
					 | 
				
			||||||
                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)
 | 
					 | 
				
			||||||
        except ValueError:
 | 
					        except ValueError:
 | 
				
			||||||
            if(debug): printError(ChannelName + CONTENT_ERROR)
 | 
					            if(debug): printError(ChannelName + CONTENT_ERROR)
 | 
				
			||||||
            else: pass
 | 
					            else: pass
 | 
				
			||||||
@ -579,6 +523,9 @@ def GetEPGFromHcn(ChannelInfo):
 | 
				
			|||||||
    ChannelName = ChannelInfo[1]
 | 
					    ChannelName = ChannelInfo[1]
 | 
				
			||||||
    ServiceId =  ChannelInfo[3]
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
    epginfo = []
 | 
					    epginfo = []
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
    url = 'https://www.hcn.co.kr/ur/bs/ch/channelInfo.hcn'
 | 
					    url = 'https://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)
 | 
				
			||||||
@ -594,6 +541,8 @@ def GetEPGFromHcn(ChannelInfo):
 | 
				
			|||||||
            if(html):
 | 
					            if(html):
 | 
				
			||||||
                for row in html:
 | 
					                for row in html:
 | 
				
			||||||
                    startTime = str(day) + ' ' + row.find('td', {'class':'f'}).text
 | 
					                    startTime = str(day) + ' ' + row.find('td', {'class':'f'}).text
 | 
				
			||||||
 | 
					                    startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
 | 
				
			||||||
 | 
					                    startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
				
			||||||
                    programName = row.find('td', {'class':'left'}).text.decode('string_escape').strip()
 | 
					                    programName = row.find('td', {'class':'left'}).text.decode('string_escape').strip()
 | 
				
			||||||
                    rating = 0
 | 
					                    rating = 0
 | 
				
			||||||
                    rebroadcast = False
 | 
					                    rebroadcast = False
 | 
				
			||||||
@ -602,24 +551,9 @@ def GetEPGFromHcn(ChannelInfo):
 | 
				
			|||||||
                        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))
 | 
				
			||||||
                    #programName, startTime, rating, rebroadcast
 | 
					                    #ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
 | 
				
			||||||
                    epginfo.append([programName, startTime, rating, rebroadcast])
 | 
					                    epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
 | 
				
			||||||
            for epg1, epg2 in zip(epginfo, epginfo[1:]):
 | 
					                epgzip(epginfo)
 | 
				
			||||||
                programName = unescape(epg1[0]) if epg1[0] else ''
 | 
					 | 
				
			||||||
                subprogramName = ''
 | 
					 | 
				
			||||||
                startTime = datetime.datetime.strptime(epg1[1], '%Y-%m-%d %H:%M')
 | 
					 | 
				
			||||||
                startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
					 | 
				
			||||||
                endTime = datetime.datetime.strptime(epg2[1], '%Y-%m-%d %H:%M')
 | 
					 | 
				
			||||||
                endTime = endTime.strftime('%Y%m%d%H%M%S')
 | 
					 | 
				
			||||||
                desc = ''
 | 
					 | 
				
			||||||
                actors = ''
 | 
					 | 
				
			||||||
                producers = ''
 | 
					 | 
				
			||||||
                category = ''
 | 
					 | 
				
			||||||
                episode = ''
 | 
					 | 
				
			||||||
                rebroadcast = epg1[3]
 | 
					 | 
				
			||||||
                rating = epg1[2]
 | 
					 | 
				
			||||||
                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)
 | 
					 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                if(debug): printError(ChannelName + CONTENT_ERROR)
 | 
					                if(debug): printError(ChannelName + CONTENT_ERROR)
 | 
				
			||||||
                else: pass
 | 
					                else: pass
 | 
				
			||||||
@ -629,15 +563,61 @@ def GetEPGFromHcn(ChannelInfo):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Get EPG data from POOQ
 | 
					# Get EPG data from POOQ
 | 
				
			||||||
def GetEPGFromPooq(ChannelInfo):
 | 
					def GetEPGFromPooq(ChannelInfo):
 | 
				
			||||||
#pooq
 | 
					    ChannelId = ChannelInfo[0]
 | 
				
			||||||
#https://wapie.pooq.co.kr/v1/epgs30/C2301/?deviceTypeId=pc&marketTypeId=generic&apiAccessCredential=EEBE901F80B3A4C4E5322D58110BE95C&drm=WC&country=KOR&offset=0&limit=1000&startTime=2017%2F07%2F18+11%3A49&credential=none&endTime=2017%2F07%2F18+23%3A59
 | 
					    ChannelName = ChannelInfo[1]
 | 
				
			||||||
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
 | 
					    url = 'https://wapie.pooq.co.kr/v1/epgs30/C' + str(ServiceId) + '/'
 | 
				
			||||||
 | 
					    lastday = today + datetime.timedelta(days=period-1)
 | 
				
			||||||
 | 
					    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)]
 | 
				
			||||||
 | 
					    try:
 | 
				
			||||||
 | 
					        response = requests.get(url, params=params, headers=ua, timeout=timeout)
 | 
				
			||||||
 | 
					        response.raise_for_status()
 | 
				
			||||||
 | 
					        json_data = response.text
 | 
				
			||||||
 | 
					        try:
 | 
				
			||||||
 | 
					            data = json.loads(json_data, encoding='utf-8')
 | 
				
			||||||
 | 
					            if (data['result']['count'] == 0) :
 | 
				
			||||||
 | 
					                 if(debug): printError(ChannelName + CONTENT_ERROR)
 | 
				
			||||||
 | 
					                 else: pass
 | 
				
			||||||
 | 
					            else :
 | 
				
			||||||
 | 
					                programs = data['result']['list']
 | 
				
			||||||
 | 
					                for program in programs:
 | 
				
			||||||
 | 
					                    if program['startDate'] in date_list :
 | 
				
			||||||
 | 
					                        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')
 | 
				
			||||||
 | 
					                        pattern = '^(.*?)(?:([\d,]+)회)?(?:\((재)\))?$'
 | 
				
			||||||
 | 
					                        matches = re.match(pattern, program['programTitle'].encode('utf-8'))
 | 
				
			||||||
 | 
					                        if not(matches is None) :
 | 
				
			||||||
 | 
					                            programName = matches.group(1) if matches.group(1) else ''
 | 
				
			||||||
 | 
					                            episode = matches.group(2) if matches.group(2) else ''
 | 
				
			||||||
 | 
					                            rebroadcast = True if matches.group(3) else False
 | 
				
			||||||
 | 
					                        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)
 | 
				
			||||||
 | 
					        except ValueError:
 | 
				
			||||||
 | 
					            if(debug): printError(ChannelName + CONTENT_ERROR)
 | 
				
			||||||
 | 
					            else: pass
 | 
				
			||||||
 | 
					    except (requests.exceptions.RequestException) as e:
 | 
				
			||||||
 | 
					        if(debug): printError(ChannelName + str(e))
 | 
				
			||||||
 | 
					        else: pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pass
 | 
					 | 
				
			||||||
# Get EPG data from MBC
 | 
					# Get EPG data from MBC
 | 
				
			||||||
def GetEPGFromMbc(ChannelInfo):
 | 
					def GetEPGFromMbc(ChannelInfo):
 | 
				
			||||||
    ChannelId = ChannelInfo[0]
 | 
					    ChannelId = ChannelInfo[0]
 | 
				
			||||||
    ChannelName = ChannelInfo[1]
 | 
					    ChannelName = ChannelInfo[1]
 | 
				
			||||||
    ServiceId =  ChannelInfo[3]
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
    dayofweek = ['월', '화', '수', '목', '금', '토', '일']
 | 
					    dayofweek = ['월', '화', '수', '목', '금', '토', '일']
 | 
				
			||||||
    url = 'http://miniunit.imbc.com/Schedule'
 | 
					    url = 'http://miniunit.imbc.com/Schedule'
 | 
				
			||||||
    params = {'rtype': 'json'}
 | 
					    params = {'rtype': 'json'}
 | 
				
			||||||
@ -651,25 +631,17 @@ def GetEPGFromMbc(ChannelInfo):
 | 
				
			|||||||
                data = json.loads(json_data, encoding='utf-8')
 | 
					                data = json.loads(json_data, encoding='utf-8')
 | 
				
			||||||
                for program in data['Programs']:
 | 
					                for program in data['Programs']:
 | 
				
			||||||
                    if program['Channel'] == "CHAM" and program['LiveDays'] == dayofweek[day.weekday()]:
 | 
					                    if program['Channel'] == "CHAM" and program['LiveDays'] == dayofweek[day.weekday()]:
 | 
				
			||||||
                        programName = ''
 | 
					 | 
				
			||||||
                        rebroadcast = True
 | 
					 | 
				
			||||||
                        pattern = '^(.*?)(\(재\))?$'
 | 
					                        pattern = '^(.*?)(\(재\))?$'
 | 
				
			||||||
                        matches = re.match(pattern, unescape(program['ProgramTitle'].encode('utf-8', 'ignore')))
 | 
					                        matches = re.match(pattern, unescape(program['ProgramTitle'].encode('utf-8', 'ignore')))
 | 
				
			||||||
                        if not(matches is None):
 | 
					                        if not(matches is None):
 | 
				
			||||||
                            programName = matches.group(1)
 | 
					                            programName = matches.group(1)
 | 
				
			||||||
                            rebroadcast = True if matches.group(2) else False
 | 
					                            rebroadcast = True if matches.group(2) else False
 | 
				
			||||||
                        subprogramName = ''
 | 
					 | 
				
			||||||
                        startTime = str(day) + ' ' + program['StartTime']
 | 
					                        startTime = str(day) + ' ' + program['StartTime']
 | 
				
			||||||
                        startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H%M')
 | 
					                        startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H%M')
 | 
				
			||||||
                        endTime = startTime  + datetime.timedelta(minutes=int(program['RunningTime']))
 | 
					                        endTime = startTime  + datetime.timedelta(minutes=int(program['RunningTime']))
 | 
				
			||||||
                        startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
					                        startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
				
			||||||
                        endTime = endTime.strftime('%Y%m%d%H%M%S')
 | 
					                        endTime = endTime.strftime('%Y%m%d%H%M%S')
 | 
				
			||||||
                        desc = ''
 | 
					 | 
				
			||||||
                        actors = ''
 | 
					 | 
				
			||||||
                        producers = ''
 | 
					 | 
				
			||||||
                        category = '음악'
 | 
					                        category = '음악'
 | 
				
			||||||
                        episode = ''
 | 
					 | 
				
			||||||
                        rating = 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)
 | 
				
			||||||
            except ValueError:
 | 
					            except ValueError:
 | 
				
			||||||
@ -684,6 +656,9 @@ def GetEPGFromMil(ChannelInfo):
 | 
				
			|||||||
    ChannelId = ChannelInfo[0]
 | 
					    ChannelId = ChannelInfo[0]
 | 
				
			||||||
    ChannelName = ChannelInfo[1]
 | 
					    ChannelName = ChannelInfo[1]
 | 
				
			||||||
    ServiceId =  ChannelInfo[3]
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
    url = 'http://radio.dema.mil.kr/web/fm/quick/ajaxTimetableList.do'
 | 
					    url = 'http://radio.dema.mil.kr/web/fm/quick/ajaxTimetableList.do'
 | 
				
			||||||
    for k in range(period):
 | 
					    for k in range(period):
 | 
				
			||||||
        day = today + datetime.timedelta(days=k)
 | 
					        day = today + datetime.timedelta(days=k)
 | 
				
			||||||
@ -695,8 +670,6 @@ def GetEPGFromMil(ChannelInfo):
 | 
				
			|||||||
            try:
 | 
					            try:
 | 
				
			||||||
                data = json.loads(json_data, encoding='utf-8')
 | 
					                data = json.loads(json_data, encoding='utf-8')
 | 
				
			||||||
                for program in data['resultList']:
 | 
					                for program in data['resultList']:
 | 
				
			||||||
                    programName = ''
 | 
					 | 
				
			||||||
                    rebroadcast = False
 | 
					 | 
				
			||||||
                    pattern = '^(.*?)(\(재\))?$'
 | 
					                    pattern = '^(.*?)(\(재\))?$'
 | 
				
			||||||
                    matches = re.match(pattern, unescape(program['program_title'].encode('utf-8', 'ignore')))
 | 
					                    matches = re.match(pattern, unescape(program['program_title'].encode('utf-8', 'ignore')))
 | 
				
			||||||
                    if not(matches is None):
 | 
					                    if not(matches is None):
 | 
				
			||||||
@ -715,12 +688,8 @@ def GetEPGFromMil(ChannelInfo):
 | 
				
			|||||||
                        endTime = datetime.datetime.strptime(endTime, '%Y-%m-%d %H%M')
 | 
					                        endTime = datetime.datetime.strptime(endTime, '%Y-%m-%d %H%M')
 | 
				
			||||||
                        endTime = endTime + datetime.timedelta(hours=1)
 | 
					                        endTime = endTime + datetime.timedelta(hours=1)
 | 
				
			||||||
                        endTime = endTime.strftime('%Y%m%d%H%M%S')
 | 
					                        endTime = endTime.strftime('%Y%m%d%H%M%S')
 | 
				
			||||||
                    desc = ''
 | 
					 | 
				
			||||||
                    actors =  unescape(program['movie_actor'])
 | 
					                    actors =  unescape(program['movie_actor'])
 | 
				
			||||||
                    producers =  unescape(program['movie_director'])
 | 
					                    producers =  unescape(program['movie_director'])
 | 
				
			||||||
                    category = ''
 | 
					 | 
				
			||||||
                    episode = ''
 | 
					 | 
				
			||||||
                    rating = 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)
 | 
				
			||||||
            except ValueError:
 | 
					            except ValueError:
 | 
				
			||||||
@ -735,6 +704,9 @@ def GetEPGFromIfm(ChannelInfo):
 | 
				
			|||||||
    ChannelId = ChannelInfo[0]
 | 
					    ChannelId = ChannelInfo[0]
 | 
				
			||||||
    ChannelName = ChannelInfo[1]
 | 
					    ChannelName = ChannelInfo[1]
 | 
				
			||||||
    ServiceId =  ChannelInfo[3]
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
    dayofweek = ['1', '2', '3', '4', '5', '6', '7']
 | 
					    dayofweek = ['1', '2', '3', '4', '5', '6', '7']
 | 
				
			||||||
    url = 'http://mapp.itvfm.co.kr/hyb/front/selectHybPgmList.do'
 | 
					    url = 'http://mapp.itvfm.co.kr/hyb/front/selectHybPgmList.do'
 | 
				
			||||||
    for k in range(period):
 | 
					    for k in range(period):
 | 
				
			||||||
@ -748,7 +720,6 @@ def GetEPGFromIfm(ChannelInfo):
 | 
				
			|||||||
                data = json.loads(json_data, encoding='utf-8')
 | 
					                data = json.loads(json_data, encoding='utf-8')
 | 
				
			||||||
                for program in data['hybMusicInfoList']:
 | 
					                for program in data['hybMusicInfoList']:
 | 
				
			||||||
                    programName = unescape(program['pgmTitle'])
 | 
					                    programName = unescape(program['pgmTitle'])
 | 
				
			||||||
                    subprogramName = ''
 | 
					 | 
				
			||||||
                    startTime = str(day) + ' ' + program['pgmStime']
 | 
					                    startTime = str(day) + ' ' + program['pgmStime']
 | 
				
			||||||
                    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')
 | 
				
			||||||
@ -761,13 +732,8 @@ def GetEPGFromIfm(ChannelInfo):
 | 
				
			|||||||
                        endTime = datetime.datetime.strptime(endTime, '%Y-%m-%d %H:%M')
 | 
					                        endTime = datetime.datetime.strptime(endTime, '%Y-%m-%d %H:%M')
 | 
				
			||||||
                        endTime = endTime + datetime.timedelta(hours=1)
 | 
					                        endTime = endTime + datetime.timedelta(hours=1)
 | 
				
			||||||
                        endTime = endTime.strftime('%Y%m%d%H%M%S')
 | 
					                        endTime = endTime.strftime('%Y%m%d%H%M%S')
 | 
				
			||||||
                    desc = ''
 | 
					 | 
				
			||||||
                    actors = program['pgmDj']
 | 
					                    actors = program['pgmDj']
 | 
				
			||||||
                    producers = program['pgmPd']
 | 
					                    producers = program['pgmPd']
 | 
				
			||||||
                    category = ''
 | 
					 | 
				
			||||||
                    episode = ''
 | 
					 | 
				
			||||||
                    rebroadcast = False
 | 
					 | 
				
			||||||
                    rating = 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)
 | 
				
			||||||
            except ValueError:
 | 
					            except ValueError:
 | 
				
			||||||
@ -782,9 +748,12 @@ def GetEPGFromKbs(ChannelInfo):
 | 
				
			|||||||
    ChannelId = ChannelInfo[0]
 | 
					    ChannelId = ChannelInfo[0]
 | 
				
			||||||
    ChannelName = ChannelInfo[1]
 | 
					    ChannelName = ChannelInfo[1]
 | 
				
			||||||
    ServiceId =  ChannelInfo[3]
 | 
					    ServiceId =  ChannelInfo[3]
 | 
				
			||||||
 | 
					    epginfo = []
 | 
				
			||||||
 | 
					    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
				
			||||||
 | 
					    rebroadcast = False
 | 
				
			||||||
 | 
					    rating = 0
 | 
				
			||||||
    url = 'http://world.kbs.co.kr/include/wink/_ajax_schedule.php'
 | 
					    url = 'http://world.kbs.co.kr/include/wink/_ajax_schedule.php'
 | 
				
			||||||
    params = {'channel':'wink_11'}
 | 
					    params = {'channel':'wink_11'}
 | 
				
			||||||
    epginfo = []
 | 
					 | 
				
			||||||
    for k in range(period):
 | 
					    for k in range(period):
 | 
				
			||||||
        day = today + datetime.timedelta(days=k)
 | 
					        day = today + datetime.timedelta(days=k)
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
@ -795,42 +764,42 @@ def GetEPGFromKbs(ChannelInfo):
 | 
				
			|||||||
                data = json.loads(json_data, encoding='utf-8')
 | 
					                data = json.loads(json_data, encoding='utf-8')
 | 
				
			||||||
                soup = BeautifulSoup(data['schedule'], 'lxml')
 | 
					                soup = BeautifulSoup(data['schedule'], 'lxml')
 | 
				
			||||||
                for row in soup.find_all('li'):
 | 
					                for row in soup.find_all('li'):
 | 
				
			||||||
                    programName = ''
 | 
					 | 
				
			||||||
                    startTime = ''
 | 
					 | 
				
			||||||
                    pattern = '([0-2][0-9]:[0-5][0-9])[0-2][0-9]:[0-5][0-9]\[(.*)\] Broadcast'
 | 
					                    pattern = '([0-2][0-9]:[0-5][0-9])[0-2][0-9]:[0-5][0-9]\[(.*)\] Broadcast'
 | 
				
			||||||
                    matches = re.match(pattern, unescape(row.text.encode('utf-8', 'ignore')))
 | 
					                    matches = re.match(pattern, unescape(row.text.encode('utf-8', 'ignore')))
 | 
				
			||||||
                    if not(matches is None):
 | 
					                    if not(matches is None):
 | 
				
			||||||
                        programName = unescape(matches.group(2))
 | 
					                        programName = unescape(matches.group(2))
 | 
				
			||||||
                        startTime = str(day) + ' ' + matches.group(1)
 | 
					                        startTime = str(day) + ' ' + matches.group(1)
 | 
				
			||||||
                    #programName, startTime
 | 
					                        startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
 | 
				
			||||||
                    epginfo.append([programName, startTime])
 | 
					                        startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
				
			||||||
 | 
					                    #ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
 | 
				
			||||||
 | 
					                    epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
 | 
				
			||||||
 | 
					                epgzip(epginfo)
 | 
				
			||||||
            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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Zip epginfo
 | 
				
			||||||
 | 
					def epgzip(epginfo):
 | 
				
			||||||
 | 
					    #ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
 | 
				
			||||||
    for epg1, epg2 in zip(epginfo, epginfo[1:]):
 | 
					    for epg1, epg2 in zip(epginfo, epginfo[1:]):
 | 
				
			||||||
        programName = epg1[0]
 | 
					        ChannelId = epg1[0]
 | 
				
			||||||
        subprogramName = ''
 | 
					        startTime = epg1[1] if epg1[1] else ''
 | 
				
			||||||
        startTime = epg1[1]
 | 
					        endTime = epg2[1] if epg2[1] else ''
 | 
				
			||||||
        startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
 | 
					        programName = epg1[2] if epg1[2] else ''
 | 
				
			||||||
        startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
					        subprogramName = epg1[3] if epg1[3] else ''
 | 
				
			||||||
        endTime = epg2[1]
 | 
					        desc = epg1[4] if epg1[4] else ''
 | 
				
			||||||
        endTime = datetime.datetime.strptime(endTime, '%Y-%m-%d %H:%M')
 | 
					        actors = epg1[5] if epg1[5] else ''
 | 
				
			||||||
        endTime = endTime.strftime('%Y%m%d%H%M%S')
 | 
					        producers = epg1[6] if epg1[6] else ''
 | 
				
			||||||
        desc = ''
 | 
					        category = epg1[7] if epg1[7] else ''
 | 
				
			||||||
        actors = ''
 | 
					        episode = epg1[8] if epg1[8] else ''
 | 
				
			||||||
        producers = ''
 | 
					        rebroadcast = True if epg1[9] else False
 | 
				
			||||||
        category = ''
 | 
					        rating = int(epg1[10]) if epg1[10] else 0
 | 
				
			||||||
        episode = ''
 | 
					 | 
				
			||||||
        rebroadcast = False
 | 
					 | 
				
			||||||
        rating = 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)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Write Program
 | 
					# Write Program
 | 
				
			||||||
def writeProgram(programdata):
 | 
					def writeProgram(programdata):
 | 
				
			||||||
    ChannelId = programdata['channelId']
 | 
					    ChannelId = programdata['channelId']
 | 
				
			||||||
@ -861,6 +830,7 @@ def writeProgram(programdata):
 | 
				
			|||||||
    if addverbose == 'y':
 | 
					    if addverbose == 'y':
 | 
				
			||||||
        desc = escape(programdata['programName'])
 | 
					        desc = escape(programdata['programName'])
 | 
				
			||||||
        if subprogramName : desc = desc + '\n부제 : ' + subprogramName
 | 
					        if subprogramName : desc = desc + '\n부제 : ' + subprogramName
 | 
				
			||||||
 | 
					        if rebroadcast  == True and addrebroadcast == 'y' : desc = desc + '\n방송 : 재방송'
 | 
				
			||||||
        if episode : desc = desc + '\n회차 : ' + str(episode) + '회'
 | 
					        if episode : desc = desc + '\n회차 : ' + str(episode) + '회'
 | 
				
			||||||
        if category : desc = desc + '\n장르 : ' + category
 | 
					        if category : desc = desc + '\n장르 : ' + category
 | 
				
			||||||
        if actors : desc = desc + '\n출연 : ' + actors
 | 
					        if actors : desc = desc + '\n출연 : ' + actors
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user