Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[script.timers] 4.0.2 #2686

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion script.timers/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.timers" name="Timers" version="4.0.1" provider-name="Heckie">
<addon id="script.timers" name="Timers" version="4.0.2" provider-name="Heckie">
<requires>
<import addon="xbmc.python" version="3.0.0" />
</requires>
Expand Down Expand Up @@ -66,6 +66,9 @@
<website>https://github.com/Heckie75/kodi-addon-timers</website>
<source>https://github.com/Heckie75/kodi-addon-timers</source>
<news>
v4.0.2 (2024-12-12)
* Bugfix: Fix exception when settings timer in EPG with program that runs over midnight

v4.0.1 (2024-12-08)
- Addded translations for French (provided by Skypichat-kodi and Gemini)
- Bugfix: Prevent exception when turning off timers by deselecting all days of week
Expand Down
22 changes: 15 additions & 7 deletions script.timers/resources/lib/utils/datetime_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import locale
import re
import time
from datetime import datetime, timedelta

Expand Down Expand Up @@ -160,16 +161,23 @@ def parse_time(s_time: str, i_day=0) -> timedelta:
if s_time == "":
s_time = DEFAULT_TIME

if s_time.lower().endswith(" am") or s_time.lower().endswith(" pm"):
t_time = time.strptime(s_time, "%I:%M %p")
m = re.match("^(\d{1,2}):(\d{1,2})( am)?( pm)?$", s_time.lower())
if not m:
return None

else:
t_time = time.strptime(s_time, "%H:%M")
tm_hour = int(m.groups()[0])
if m.groups()[2] and tm_hour >= 12: # am:
tm_hour -= 12
elif m.groups()[3] and tm_hour < 12: # pm
tm_hour += 12

tm_min = int(m.groups()[1])
tm_day = i_day + tm_hour // 24

return timedelta(
days=i_day,
hours=t_time.tm_hour,
minutes=t_time.tm_min)
days=tm_day,
hours=tm_hour % 24,
minutes=tm_min)


def datetime_diff(t1: datetime, t2: datetime) -> int:
Expand Down
Loading