Fetch a week of EPG data for IPTV Manager (#89)

This commit is contained in:
Michaël Arnauts 2021-04-24 18:27:26 +02:00 committed by GitHub
parent 9d6eabc43e
commit 37121fa6dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@
from __future__ import absolute_import, division, unicode_literals from __future__ import absolute_import, division, unicode_literals
import logging import logging
from datetime import timedelta from datetime import timedelta, datetime
from resources.lib import kodiutils from resources.lib import kodiutils
from resources.lib.viervijfzes import CHANNELS from resources.lib.viervijfzes import CHANNELS
@ -64,14 +64,18 @@ class IPTVManager:
except ImportError: # Python 2 except ImportError: # Python 2
from urllib import quote from urllib import quote
today = datetime.today()
results = dict() results = dict()
for key, channel in CHANNELS.items(): for key, channel in CHANNELS.items():
iptv_id = channel.get('iptv_id') iptv_id = channel.get('iptv_id')
if channel.get('iptv_id'): if channel.get('iptv_id'):
results[iptv_id] = [] results[iptv_id] = []
for date in ['yesterday', 'today', 'tomorrow']:
epg = epg_api.get_epg(key, date) for i in range(-3, 7):
date = today + timedelta(days=i)
epg = epg_api.get_epg(key, date.strftime('%Y-%m-%d'))
results[iptv_id].extend([ results[iptv_id].extend([
dict( dict(