diff options
author | Stefano <l.stickell@yahoo.it> | 2013-05-11 20:27:24 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-05-11 20:27:24 +0200 |
commit | 8a23a8055ff6415238422db1c1f032fa9717999f (patch) | |
tree | 0de49ee5221520c9f83bd763ff990e574a27a5a2 | |
parent | EgoFilesCom: fixed #109 (diff) | |
parent | Version 0.2: fixes (diff) | |
download | pyload-8a23a8055ff6415238422db1c1f032fa9717999f.tar.xz |
Merge pull request #112 from Vuolter/plugin/DeleteFinished
New plugin: DeleteFinished
-rw-r--r-- | module/plugins/hooks/DeleteFinished.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py new file mode 100644 index 000000000..be83d6ced --- /dev/null +++ b/module/plugins/hooks/DeleteFinished.py @@ -0,0 +1,47 @@ + # -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + @author: Walter Purcaro +""" + +from module.plugins.Hook import Hook +from time import time + + +class DeleteFinished(Hook): + __name__ = "DeleteFinished" + __version__ = "0.2" + __description__ = "Automatically delete finished packages from queue" + __config__ = [ + ("activated", "bool", "Activated", "False"), + ("interval", "int", "Delete every (hours)", "72") + ] + __author_name__ = ("Walter Purcaro") + __author_mail__ = ("vuolter@gmail.com") + + #: event_map don't load periodical anyway + def periodical(self): + now = time() + deletetime = self.getConfig("interval") * 3600 + self.info["lastdelete"] + if now >= deletetime: + self.core.api.deleteFinished() + self.logDebug("called self.core.api.deleteFinished()") + self.info["lastdelete"] = now + + def setup(self): + now = time() + self.info = {"lastdelete": now} + self.interval = 3600 |