Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Fetch a week of EPG data for IPTV Manager (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelarnauts authored Apr 24, 2021
1 parent 9d6eabc commit 37121fa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions resources/lib/modules/iptvmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from __future__ import absolute_import, division, unicode_literals

import logging
from datetime import timedelta
from datetime import timedelta, datetime

from resources.lib import kodiutils
from resources.lib.viervijfzes import CHANNELS
Expand Down Expand Up @@ -64,14 +64,18 @@ def send_epg(): # pylint: disable=no-method-argument
except ImportError: # Python 2
from urllib import quote

today = datetime.today()

results = dict()
for key, channel in CHANNELS.items():
iptv_id = channel.get('iptv_id')

if channel.get('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([
dict(
Expand Down

0 comments on commit 37121fa

Please sign in to comment.