From 89acc0ff595f73956572c8892ccb860c06fba33a Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 4 Jan 2010 20:35:26 +0100 Subject: added hook system --- module/plugins/hooks/ContainerDownload.py | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 module/plugins/hooks/ContainerDownload.py (limited to 'module/plugins/hooks/ContainerDownload.py') diff --git a/module/plugins/hooks/ContainerDownload.py b/module/plugins/hooks/ContainerDownload.py new file mode 100644 index 000000000..d031cdf69 --- /dev/null +++ b/module/plugins/hooks/ContainerDownload.py @@ -0,0 +1,42 @@ +# -*- 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 . + + @author: mkaay + @interface-version: 0.1 +""" + +from module.plugins.hooks.Hook import Hook + +from os.path import join, abspath + +class ContainerDownload(Hook): + def __init__(self, core): + Hook.__init__(self, core) + props = {} + props['name'] = "ContainerDownload" + props['version'] = "0.1" + props['description'] = """add the downloaded container to current package""" + props['author_name'] = ("mkaay") + props['author_mail'] = ("mkaay@mkaay.de") + self.props = props + + def downloadFinished(self, pyfile): + filename = pyfile.status.filename + if filename.endswith(".dlc") or filename.endswith(".ccf") or filename.endswith(".rsdf"): + self.logger.info("ContainerDownload hook: adding container file") + location = abspath(join(pyfile.folder, filename)) + newFile = self.core.file_list.collector.addLink(location) + self.core.file_list.packager.addFileToPackage(pyfile.package.data["id"], self.core.file_list.collector.popFile(newFile)) -- cgit v1.2.3 From d2aa3fceb9f896343b128d40f20a0465cf69efca Mon Sep 17 00:00:00 2001 From: mkaay Date: Wed, 6 Jan 2010 22:11:24 +0100 Subject: small fixes, new hook stuff --- module/plugins/hooks/ContainerDownload.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins/hooks/ContainerDownload.py') diff --git a/module/plugins/hooks/ContainerDownload.py b/module/plugins/hooks/ContainerDownload.py index d031cdf69..417b42ee8 100644 --- a/module/plugins/hooks/ContainerDownload.py +++ b/module/plugins/hooks/ContainerDownload.py @@ -35,6 +35,8 @@ class ContainerDownload(Hook): def downloadFinished(self, pyfile): filename = pyfile.status.filename + if not pyfile.url.startswith("http"): + return if filename.endswith(".dlc") or filename.endswith(".ccf") or filename.endswith(".rsdf"): self.logger.info("ContainerDownload hook: adding container file") location = abspath(join(pyfile.folder, filename)) -- cgit v1.2.3 From 1896a9faec5871f8051a8dfa407883cef46bb6df Mon Sep 17 00:00:00 2001 From: spoob Date: Thu, 7 Jan 2010 15:59:23 +0100 Subject: Better Rapidshare Slot Check thanks #66 --- module/plugins/hooks/ContainerDownload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/ContainerDownload.py') diff --git a/module/plugins/hooks/ContainerDownload.py b/module/plugins/hooks/ContainerDownload.py index 417b42ee8..c13a7f622 100644 --- a/module/plugins/hooks/ContainerDownload.py +++ b/module/plugins/hooks/ContainerDownload.py @@ -38,7 +38,7 @@ class ContainerDownload(Hook): if not pyfile.url.startswith("http"): return if filename.endswith(".dlc") or filename.endswith(".ccf") or filename.endswith(".rsdf"): - self.logger.info("ContainerDownload hook: adding container file") + self.logger.info("ContainerDownload: adding container file") location = abspath(join(pyfile.folder, filename)) newFile = self.core.file_list.collector.addLink(location) self.core.file_list.packager.addFileToPackage(pyfile.package.data["id"], self.core.file_list.collector.popFile(newFile)) -- cgit v1.2.3 From a1c1d16ab515373c6111724393a0b242e9bf32a4 Mon Sep 17 00:00:00 2001 From: spoob Date: Sun, 10 Jan 2010 03:22:04 +0100 Subject: dont import deactivated hooks --- module/plugins/hooks/ContainerDownload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/ContainerDownload.py') diff --git a/module/plugins/hooks/ContainerDownload.py b/module/plugins/hooks/ContainerDownload.py index c13a7f622..f520b705c 100644 --- a/module/plugins/hooks/ContainerDownload.py +++ b/module/plugins/hooks/ContainerDownload.py @@ -18,7 +18,7 @@ @interface-version: 0.1 """ -from module.plugins.hooks.Hook import Hook +from module.plugins.Hook import Hook from os.path import join, abspath -- cgit v1.2.3