Cleaned up run.py a bit.

This commit is contained in:
Yuuki 2025-01-03 20:45:05 +09:00
parent eeeb2d7aba
commit 8bdeacb875

8
run.py
View file

@ -77,12 +77,8 @@ for x in range(0, 7):
channel = chid[0:chid.rfind('_')]
title = fix(epg_data['title'])
comment = fix(epg_data['commentary'])
start = str(epg_data['programStart'])
start = datetime(int(start[0:4]), int(start[4:6]), int(start[6:8]), int(start[8:10]), int(start[10:12]), int(start[12:14])).timestamp() - 32400
start = datetime.fromtimestamp(start).strftime('%Y%m%d%H%M%S')
end = str(epg_data['programEnd'])
end = datetime(int(end[0:4]), int(end[4:6]), int(end[6:8]), int(end[8:10]), int(end[10:12]), int(end[12:14])).timestamp() - 32400
end = datetime.fromtimestamp(end).strftime('%Y%m%d%H%M%S')
start = datetime.fromtimestamp(datetime.strptime(epg_data['programStart'], '%Y%m%d%H%M%S').timestamp() - 32400).strftime('%Y%m%d%H%M%S')
end = datetime.fromtimestamp(datetime.strptime(epg_data['programEnd'], '%Y%m%d%H%M%S').timestamp() - 32400).strftime('%Y%m%d%H%M%S')
gen = genre(epg_data['sortGenre'])
attr = epg_data['attr']
icon = 'https://tvguide.myjcom.jp{}'.format(epg_data['imgPath']) if int(epg_data['hasImage']) == 1 and epg_data['imgPath'] else None