summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/Plugin.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-11 03:44:46 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-11 03:44:46 +0200
commit0624be22886c7543e95cee53a7d4b1bdc01bc3b1 (patch)
tree18cbc2af8a46f0b753a0c3b999bc297a25596e26 /module/plugins/internal/Plugin.py
parent[Plugin] Improve error tracing (diff)
downloadpyload-0624be22886c7543e95cee53a7d4b1bdc01bc3b1.tar.xz
[XFSAccount] Error handling support
Diffstat (limited to 'module/plugins/internal/Plugin.py')
-rw-r--r--module/plugins/internal/Plugin.py13
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