Skip to content

Commit

Permalink
Merge pull request #15 from vorostamas/1.0.6-fix-scheduling-bug
Browse files Browse the repository at this point in the history
1.0.6 fix scheduling bug
  • Loading branch information
vorostamas authored Jun 2, 2021
2 parents 7030c75 + 4e0de67 commit 44f6385
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion custom_components/porthutv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from custom_components.porthutv.schedules import get_schedules, get_attributes

SCAN_INTERVAL = timedelta(minutes=30)
SCAN_INTERVAL = timedelta(minutes=5)

_LOGGER = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion custom_components/porthutv/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
NAME = "PortHuTv"
DOMAIN = "porthutv"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "1.0.5"
VERSION = "1.0.6"

ISSUE_URL = "https://github.com/vorostamas/portHuTV-homeassistant/issues"

Expand Down
1 change: 1 addition & 0 deletions custom_components/porthutv/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"codeowners": [
"@vorostamas"
],
"version": "1.0.6",
"requirements": []
}
10 changes: 6 additions & 4 deletions custom_components/porthutv/schedules.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def exctract_schedule_details(channel_information):
for program in schedule:
title = program["title"]
start_time = program["start_time"]
start_datetime = program["start_datetime"]
end_time = program["end_time"]
# start_datetime = parse(program["start_datetime"])
# end_datetime = parse(program["end_datetime"])
end_datetime = program["end_datetime"]
episode_title = program["episode_title"] or ""
short_description = program["short_description"]
film_url = BASE_URL + program["film_url"] if program["film_url"] else ""
Expand All @@ -62,7 +62,9 @@ def exctract_schedule_details(channel_information):
channel_program = {}
channel_program["title"] = title
channel_program["start_time"] = start_time
channel_program["start_datetime"] = start_datetime
channel_program["end_time"] = end_time
channel_program["end_datetime"] = end_datetime
channel_program["episode_title"] = episode_title
channel_program["short_description"] = short_description
channel_program["film_url"] = film_url
Expand Down Expand Up @@ -103,8 +105,8 @@ def get_actual_show_index(schedule):
"""
now = datetime.now(pytz.timezone(CONF_TIME_ZONE))
for i in range(len(schedule)):
start = parse_time(schedule[i]["start_time"])
end = parse_time(schedule[i]["end_time"])
start = parse(schedule[i]["start_datetime"])
end = parse(schedule[i]["end_datetime"])
if in_between(now, start, end):
return i
return -1
Expand Down

0 comments on commit 44f6385

Please sign in to comment.