Add files via upload

This commit is contained in:
wonipapa 2017-03-16 12:17:35 +09:00 committed by GitHub
parent 10edf54c32
commit 99a6eebe3d

View File

@ -16,7 +16,7 @@ import argparse
reload(sys) reload(sys)
sys.setdefaultencoding('utf-8') sys.setdefaultencoding('utf-8')
__version__ = '1.1.2' __version__ = '1.1.3'
# Set My Configuration # Set My Configuration
default_icon_url = '' # TV channel icon url (ex : http://www.example.com/Channels) default_icon_url = '' # TV channel icon url (ex : http://www.example.com/Channels)
@ -95,7 +95,6 @@ def getEpg():
GetEPGFromSKY(ChannelInfo) GetEPGFromSKY(ChannelInfo)
elif ChannelSource == 'NAVER': elif ChannelSource == 'NAVER':
GetEPGFromNaver(ChannelInfo) GetEPGFromNaver(ChannelInfo)
print('</tv>') print('</tv>')
# Get EPG data from epg.co.kr # Get EPG data from epg.co.kr
@ -105,7 +104,6 @@ def GetEPGFromEPG(ChannelInfo):
ServiceId = ChannelInfo[3] ServiceId = ChannelInfo[3]
epginfo = [] epginfo = []
url = 'http://www.epg.co.kr/epg-cgi/extern/cnm_guide_type_v070530.cgi' url = 'http://www.epg.co.kr/epg-cgi/extern/cnm_guide_type_v070530.cgi'
contenturl = 'http://www.epg.co.kr/epg-cgi/guide_schedule_content.cgi'
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')}
@ -116,11 +114,11 @@ def GetEPGFromEPG(ChannelInfo):
data = unicode(html_data, 'euc-kr', 'ignore').encode('utf-8', 'ignore') data = unicode(html_data, 'euc-kr', 'ignore').encode('utf-8', 'ignore')
strainer = SoupStrainer('table', {'style':'margin-bottom:30'}) strainer = SoupStrainer('table', {'style':'margin-bottom:30'})
soup = BeautifulSoup(data, 'lxml', parse_only=strainer, from_encoding='utf-8') soup = BeautifulSoup(data, 'lxml', parse_only=strainer, from_encoding='utf-8')
table = soup.find_all('table', {'style':'margin-bottom:30'}) tables = soup.find_all('table', {'style':'margin-bottom:30'})
for i in range(1,4): for i in range(1,4):
thisday = day thisday = day
row = table[i].find_all('td', {'colspan':'2'}) row = tables[i].find_all('td', {'colspan':'2'})
for j, cell in enumerate(row): for j, cell in enumerate(row):
hour = int(cell.text.strip().strip('')) hour = int(cell.text.strip().strip(''))
if(i == 1) : hour = 'AM ' + str(hour) if(i == 1) : hour = 'AM ' + str(hour)
@ -436,14 +434,14 @@ def writeProgram(programdata):
category = escape(programdata['category']) category = escape(programdata['category'])
episode = programdata['episode'] episode = programdata['episode']
rebroadcast = programdata['rebroadcast'] rebroadcast = programdata['rebroadcast']
if addepisode == 'y': programName = programName + '('+ episode + ')' if episode and addepisode == 'y': programName = programName + ' ('+ str(episode) + ')'
if rebroadcast == True and addrebroadcast == 'y' : programName = programName + ' (재)' if rebroadcast == True and addrebroadcast == 'y' : programName = programName + ' (재)'
if programdata['rating'] == 0 : if programdata['rating'] == 0 :
rating = '전체 관람가' rating = '전체 관람가'
else : else :
rating = '%s세 이상 관람가' % (programdata['rating']) rating = '%s세 이상 관람가' % (programdata['rating'])
if verbose == 'y': if verbose == 'y':
desc = programName desc = escape(programdata['programName'])
if subprogramName : desc = desc + '\n부제 : ' + subprogramName if subprogramName : desc = desc + '\n부제 : ' + subprogramName
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