diff options
Diffstat (limited to 'module/plugins/internal/Plugin.py')
-rw-r--r-- | module/plugins/internal/Plugin.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index ab5dcc447..3ad878c1b 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -136,15 +136,14 @@ def str2int(string): def parse_time(string): if re.search("da(il)?y|today", string): - time = seconds_to_midnight() + seconds = seconds_to_midnight() else: - regex = re.compile(r'(\d+| (?:this|an?) )\s*(hr|hour|min|sec|)', re.I) - time = sum((int(v) if v.strip() not in ("this", "a", "an") else 1) * - {'hr': 3600, 'hour': 3600, 'min': 60, 'sec': 1, '': 1}[u.lower()] - for v, u in regex.findall(string)) - - return time + regex = re.compile(r'(\d+| (?:this|an?) )\s*(hr|hour|min|sec|)', re.I) + seconds = sum((int(v) if v.strip() not in ("this", "a", "an") else 1) * + {'hr': 3600, 'hour': 3600, 'min': 60, 'sec': 1, '': 1}[u.lower()] + for v, u in regex.findall(string)) + return seconds #@TODO: Move to utils in 0.4.10 |