diff options
author | 2015-10-04 04:29:58 +0200 | |
---|---|---|
committer | 2015-10-04 04:29:58 +0200 | |
commit | 1c7d9e55ffbfc9204c9e9246d9cc64806fa38326 (patch) | |
tree | 49fff3f3b5b2c036c99c1422b9d0153a6c80f0cd /module/plugins/internal/Plugin.py | |
parent | Fix https://github.com/pyload/pyload/issues/1911#issuecomment-145026557 (diff) | |
download | pyload-1c7d9e55ffbfc9204c9e9246d9cc64806fa38326.tar.xz |
Fixpack (2)
Diffstat (limited to 'module/plugins/internal/Plugin.py')
-rw-r--r-- | module/plugins/internal/Plugin.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index cc35d919c..9d2aa8b50 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -109,10 +109,8 @@ def parse_time(string): time = seconds_to_midnight() else: - this = re.compile("this", re.I) - regex = re.compile(r'(\d+|[\w\-]+)\s*(hr|hour|min|sec|)', re.I) - - time = sum(1 if this.match(v) else str2int(v) * + 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)) @@ -228,7 +226,7 @@ def chunks(iterable, size): class Plugin(object): __name__ = "Plugin" __type__ = "plugin" - __version__ = "0.46" + __version__ = "0.47" __status__ = "testing" __pattern__ = r'^unmatchable$' |