From 6da22acfa81961473c8458de4b9a9723668be31f Mon Sep 17 00:00:00 2001
From: RaNaN <Mast3rRaNaN@hotmail.de>
Date: Fri, 3 Sep 2010 00:22:23 +0200
Subject: little fixes

---
 module/plugins/hooks/UnRar.py          |  3 ++-
 module/plugins/hoster/MegauploadCom.py | 14 +++++++-------
 module/web/ServerThread.py             |  2 +-
 pyLoadCore.py                          |  2 +-
 pyLoadGui.py                           |  2 +-
 5 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/module/plugins/hooks/UnRar.py b/module/plugins/hooks/UnRar.py
index faa06d179..9ee9b2d46 100644
--- a/module/plugins/hooks/UnRar.py
+++ b/module/plugins/hooks/UnRar.py
@@ -95,7 +95,7 @@ class UnRar(Hook):
         
         for fid, fname in files:
             pyfile = self.core.files.getFile(fid)
-            pyfile.setStatus("custom")
+            pyfile.setStatus("processing")
             def s(p):
                 pyfile.alternativePercent = p
                 
@@ -134,4 +134,5 @@ class UnRar(Hook):
             finally:
                 pyfile.alternativePercent = None
                 pyfile.setStatus("finished")
+                pyfile.release()
 
diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py
index bacc7d98f..aee6ec3b2 100644
--- a/module/plugins/hoster/MegauploadCom.py
+++ b/module/plugins/hoster/MegauploadCom.py
@@ -72,7 +72,7 @@ class MegauploadCom(Hoster):
         for i in range(5):
             self.html[0] = self.load(self.pyfile.url)
             try:
-                url_captcha_html = re.search('(http://www.{,3}\.megaupload\.com/gencap.php\?.*\.gif)', self.html[0]).group(1)
+                url_captcha_html = re.search('(http://[\w\.]*?megaupload\.com/gencap.php\?.*\.gif)', self.html[0]).group(1)
             except:
                 continue
 
@@ -80,7 +80,7 @@ class MegauploadCom(Hoster):
             captchacode = re.search('name="captchacode" value="(.*)"', self.html[0]).group(1)
             megavar = re.search('name="megavar" value="(.*)">', self.html[0]).group(1)
             self.html[1] = self.load(self.pyfile.url, post={"captcha": captcha, "captchacode": captchacode, "megavar": megavar})
-            if re.search(r"Waiting time before each download begins", self.html[1]) != None:
+            if re.search(r"Waiting time before each download begins", self.html[1]) is not None:
                 break
 
     def get_file_url(self):
@@ -94,17 +94,17 @@ class MegauploadCom(Hoster):
 
     def file_exists(self):
         self.download_html()
-        if re.search(r"Unfortunately, the link you have clicked is not available.", self.html[0]) != None or \
-            re.search(r"Download limit exceeded", self.html[0]) != None:
+        if re.search(r"Unfortunately, the link you have clicked is not available.", self.html[0]) is not None or \
+            re.search(r"Download limit exceeded", self.html[0]) is not None:
             return False
             
-        if re.search("The file you are trying to access is temporarily unavailable", self.html[0]) != None:
+        if re.search("The file you are trying to access is temporarily unavailable", self.html[0]) is not None:
             self.setWait(120)
             self.log.debug("%s: The file is temporarily not available. Waiting 2 minutes." % self.__name__)
             self.wait()
             
             self.download_html()
-            if re.search("The file you are trying to access is temporarily unavailable", self.html[0]) != None:
-                self.fail("Looks like the file is still not available. Retry downloading later, manually.")
+            if re.search("The file you are trying to access is temporarily unavailable", self.html[0]) is not None:
+                self.fail(_("Looks like the file is still not available. Retry downloading later, manually."))
             
         return True
diff --git a/module/web/ServerThread.py b/module/web/ServerThread.py
index 59f3164f7..ef70babe6 100644
--- a/module/web/ServerThread.py
+++ b/module/web/ServerThread.py
@@ -156,7 +156,7 @@ class WebServer(threading.Thread):
             ssl.engine = "enable"
             ssl.pemfile = "%s"
             ssl.ca-file = "%s"
-            """ % ("ssl.pem" , self.core.config["ssl"]["cert"]) )
+            """ % (abspath("ssl.pem") , abspath(self.core.config["ssl"]["cert"])) )
             else:
                 content = content.replace("%(ssl)", "")
             new_config = file(join("servers", "lighttpd.conf"), "wb")
diff --git a/pyLoadCore.py b/pyLoadCore.py
index aad38e11e..359064ba2 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -262,7 +262,7 @@ class Core(object):
                     f = open(link_file, "wb")
                     f.close()
                 except:
-                    pass
+                    self.log.warning(_("links.txt could not be cleared"))
 
         link_file = "links.txt"
         if exists(link_file):
diff --git a/pyLoadGui.py b/pyLoadGui.py
index 49fd6e067..3d4f59b62 100755
--- a/pyLoadGui.py
+++ b/pyLoadGui.py
@@ -72,7 +72,7 @@ class main(QObject):
             parser = XMLParser(join(self.path, "module", "config", "gui_default.xml"))
             lang = parser.xml.elementsByTagName("language").item(0).toElement().text()
 
-        translation = gettext.translation("pyLoadGui", join(pypath, "locale"), languages=[str(lang)])
+        translation = gettext.translation("pyLoadGui", join(pypath, "locale"), languages=["en", str(lang)])
         try:
             translation.install(unicode=(True if sys.stdout.encoding.lower().startswith("utf") else False))
         except:
-- 
cgit v1.2.3