Skip to content

Commit

Permalink
[script.timers] 4.0.2 (#2686)
Browse files Browse the repository at this point in the history
  • Loading branch information
Heckie75 authored Dec 12, 2024
1 parent 1f1edb9 commit a0427eb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
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

0 comments on commit a0427eb

Please sign in to comment.