diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-08 06:32:02 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-08 06:32:02 +0200 |
commit | 570f37674434c7f3816e3949967c31407610da6c (patch) | |
tree | 2175692750df20384073da4a6b26ef013f1d843b /module/plugins/internal/Plugin.py | |
parent | New plugin: LogMarker (diff) | |
download | pyload-570f37674434c7f3816e3949967c31407610da6c.tar.xz |
Spare improvements
Diffstat (limited to 'module/plugins/internal/Plugin.py')
-rw-r--r-- | module/plugins/internal/Plugin.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index 61f219556..7bfdd588c 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -142,13 +142,19 @@ def which(program): return exe_file -def seconds_to_midnight(utc=None): +def seconds_to_nexthour(strict=False): + now = datetime.datetime.today() + nexthour = now.replace(minute=0 if strict else 1, second=0, microsecond=0) + datetime.timedelta(hours=1) + return (nexthour - now).seconds + + +def seconds_to_midnight(utc=None, strict=False): if utc is None: now = datetime.datetime.today() else: now = datetime.datetime.utcnow() + datetime.timedelta(hours=utc) - midnight = now.replace(hour=0, minute=1, second=0, microsecond=0) + datetime.timedelta(days=1) + midnight = now.replace(hour=0, minute=0 if strict else 1, second=0, microsecond=0) + datetime.timedelta(days=1) return (midnight - now).seconds @@ -226,7 +232,7 @@ def chunks(iterable, size): class Plugin(object): __name__ = "Plugin" __type__ = "plugin" - __version__ = "0.50" + __version__ = "0.51" __status__ = "testing" __pattern__ = r'^unmatchable$' |