diff options
| author | 2009-05-20 15:51:27 +0200 | |
|---|---|---|
| committer | 2009-05-20 15:51:27 +0200 | |
| commit | 0e674e35a5d565a2af07ab7f1b69ab43d364b819 (patch) | |
| tree | 56ea0dc3d4ff02c925162153508a203fa29fa4bb /module | |
| parent | normal name style (diff) | |
| download | pyload-0e674e35a5d565a2af07ab7f1b69ab43d364b819.tar.xz | |
was wir nicht brauchen auskommentiert, host überprüfung verlagert
Diffstat (limited to 'module')
| -rw-r--r-- | module/Py_Load_File.py | 23 | 
1 files changed, 16 insertions, 7 deletions
diff --git a/module/Py_Load_File.py b/module/Py_Load_File.py index 4eee82f91..96936e4af 100644 --- a/module/Py_Load_File.py +++ b/module/Py_Load_File.py @@ -1,25 +1,34 @@ +# -*- coding: cp1252 -*-  from download_thread import Status +import re  class PyLoadFile:      """ represents the url or file      """ -    def __init__(self, parent, plugin, url): +    def __init__(self, parent, url):          self.parent = parent          self.id = None -        pluginClass = getattr(plugin, plugin.__name__) -        self.plugin = pluginClass(self)          self.url = url          self.filename = "filename"          self.download_folder = "" +        self.modul = __import__(self._get_my_plugin())   +        pluginClass = getattr(self.modul, self.modul.__name__) +        self.plugin = pluginClass(self) +        self.download_folder = ""          self.status = Status(self) -    def _get_my_plugin(): -        plugins = parent.get_avail_plugins() -         +    def _get_my_plugin(self): +        """ searches the right plugin for an url +        """ +        for plugin, plugin_pattern in self.parent.plugins_avaible.items(): +            if re.match(plugin_pattern, self.url) != None: #guckt ob übergebende url auf muster des plugins passt +                return plugin +        #logger: kein plugin gefunden # was soll passieren wenn nichts gefunden wird?!? +        return None      def prepareDownload(self): -	self.status.exists = self.plugin.file_exists() +        self.status.exists = self.plugin.file_exists()  	if self.status.exists:              self.status.filename = self.plugin.get_file_name()              self.status.waituntil = self.plugin.time_plus_wait  | 
