Skip to content

Commit ac3217e

Browse files
committed
Fixed timezone
1 parent 4e4d286 commit ac3217e

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

.github/workflows/daily_epg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
python-version: '3.x'
2323

2424
- name: Install Dependencies
25-
run: pip install requests
25+
run: pip install -r requirements.txt
2626

2727
- name: Setup git config
2828
run: |

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

epg_scraper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import xml.dom.minidom
22
from datetime import datetime, timedelta
33
from xml.etree.ElementTree import Element, SubElement, tostring
4+
from zoneinfo import ZoneInfo
45

56
import requests
67

@@ -30,7 +31,7 @@ def convert_to_xmltv(epg_data, channel_name, icon_url=None, lang="de"):
3031

3132
for date, programs in epg_data.items():
3233
for program in programs:
33-
start_time = datetime.strptime(date + " " + program['ora'], "%Y-%m-%d %H:%M")
34+
start_time = datetime.strptime(date + " " + program['ora'], "%Y-%m-%d %H:%M").replace(tzinfo=ZoneInfo("Europe/Rome"))
3435
duration_minutes = int(program['durata'])
3536
stop_time = start_time + timedelta(minutes=duration_minutes)
3637

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
requests
2+
datetime
3+
tzdata

0 commit comments

Comments
 (0)