diff options
author | spoob <spoob@gmx.de> | 2009-12-19 20:50:26 +0100 |
---|---|---|
committer | spoob <spoob@gmx.de> | 2009-12-19 20:50:26 +0100 |
commit | ed14601a9a83439ce096441ad7ca7a8c4d9b13f8 (patch) | |
tree | 64090e0abe9f736900d9ea33e1df48398a0d3cf7 /module/Plugin.py | |
parent | webinterface - activ Downloads List - Code completed (diff) | |
download | pyload-ed14601a9a83439ce096441ad7ca7a8c4d9b13f8.tar.xz |
Fixed file_exists function for local files
Diffstat (limited to 'module/Plugin.py')
-rw-r--r-- | module/Plugin.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/module/Plugin.py b/module/Plugin.py index 14a480e3b..8e5bbcfe8 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -20,6 +20,8 @@ import ConfigParser import logging import re +from os.path import exists + from module.network.Request import Request @@ -54,7 +56,7 @@ class Plugin(): pyfile.status.exists = self.file_exists() if not pyfile.status.exists: - raise Exception, "The file was not found on the server." + raise Exception, "File not found" return False pyfile.status.filename = self.get_file_name() @@ -75,12 +77,15 @@ class Plugin(): def download_html(self): """ gets the url from self.parent.url saves html in self.html and parses """ - html = "" - self.html = html + self.html = "" def file_exists(self): """ returns True or False """ + if re.search(r"(?!http://).*\.(dlc|ccf|rsdf|txt)", self.parent.url): + return exists(self.parent.url) + elif re.search(r"Not Found", self.parent.url): + return False return True def get_file_url(self): @@ -92,7 +97,7 @@ class Plugin(): try: return re.findall("([^\/=]+)", self.parent.url)[-1] except: - return "no_name" + return self.parent.url[:20] def wait_until(self): if self.html != None: |