From 56ed29b85429010f5860cd62ad1b50002b11c6b0 Mon Sep 17 00:00:00 2001
From: mkaay <mkaay@mkaay.de>
Date: Sun, 20 Jun 2010 17:17:47 +0200
Subject: fix fix fix

---
 module/DownloadThread.py                |  11 ++++++++---
 module/ThreadManager.py                 |   3 +++
 module/plugins/Hoster.py                |  32 ++++++++++++++++++++++++++++++++
 module/plugins/container/DLC_26.pyc     | Bin 7757 -> 7757 bytes
 module/plugins/hoster/ShareonlineBiz.py |   3 ++-
 5 files changed, 45 insertions(+), 4 deletions(-)

(limited to 'module')

diff --git a/module/DownloadThread.py b/module/DownloadThread.py
index 95ed88da0..2178bd21e 100644
--- a/module/DownloadThread.py
+++ b/module/DownloadThread.py
@@ -121,16 +121,21 @@ class DownloadThread(Thread):
     def handleNewInterface(self, pyfile):
         status = pyfile.status
         plugin = pyfile.plugin
-        status.type = "starting"
-        self.parent.parent.pullManager.addEvent(UpdateEvent("file", pyfile.id, "queue"))
         
         if plugin.__type__ == "container" or plugin.__type__ == "crypter":
             status.type = "decrypting"
+        else: #hoster
+            status.type = "starting"
         self.parent.parent.pullManager.addEvent(UpdateEvent("file", pyfile.id, "queue"))
         
         if plugin.__type__ == "container":
             plugin.decrypt(pyfile.url)
-        
+        else:
+            plugin.preparePlugin(self)
+            
+            plugin.prepareDownload()
+            
+            plugin.startDownload()
         status.type = "finished"
     
     def download(self, pyfile):
diff --git a/module/ThreadManager.py b/module/ThreadManager.py
index 1c5a89a5c..4e2beaf49 100644
--- a/module/ThreadManager.py
+++ b/module/ThreadManager.py
@@ -114,6 +114,8 @@ class ThreadManager(Thread):
                 else:
                     self.parent.logger.info(_("%i new packages from %s") % (len(packages), pyfile.status.filename))
                 for name, links in packages:
+                    if not name:
+                        name = pyfile.status.filename
                     pid = self.list.packager.addNewPackage(name)
                     for link in links:
                         newFile = self.list.collector.addLink(link)
@@ -124,6 +126,7 @@ class ThreadManager(Thread):
                         self.parent.logger.info(_("%i links in %s") % (len(links), name))
             else:
                 pass
+            self.list.packager.removeFileFromPackage(pyfile.id, pyfile.package.data["id"])
     
     def jobFinished(self, pyfile):
         """manage completing download"""
diff --git a/module/plugins/Hoster.py b/module/plugins/Hoster.py
index 0ed528924..75f925587 100644
--- a/module/plugins/Hoster.py
+++ b/module/plugins/Hoster.py
@@ -27,3 +27,35 @@ class Hoster(Plugin):
     __description__ = """Base hoster plugin"""
     __author_name__ = ("mkaay")
     __author_mail__ = ("mkaay@mkaay.de")
+    
+    def preparePlugin(self, thread):
+        self.thread = thread
+        self.usePremium = False
+    
+    def getFileName(self):
+        try:
+            return re.findall("([^\/=]+)", self.pyfile.url)[-1]
+        except:
+            return self.pyfile.url[:20]
+    
+    def isOnline(self):
+        return True
+    
+    def multiDownload(self):
+        return True
+    
+    def prepareDownload(self):
+        pass
+    
+    def startDownload(self):
+        self.req.download(self.pyfile.url, self.pyfile.folder)
+    
+    def verifyDownload(self):
+        return True
+    
+    def wait(self, until=None, reconnect=False):
+        self.pyfile.status.want_reconnect = reconnect
+        self.pyfile.status.waituntil = until
+        if not until:
+            self.pyfile.status.waituntil = 0
+        
diff --git a/module/plugins/container/DLC_26.pyc b/module/plugins/container/DLC_26.pyc
index 840d043a7..5c8c98088 100644
Binary files a/module/plugins/container/DLC_26.pyc and b/module/plugins/container/DLC_26.pyc differ
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index 13d240bb4..f7ef3d4f1 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -99,7 +99,8 @@ class ShareonlineBiz(Hoster):
                 sleep(3)
                 self.html[1] = self.load(url, post={"captchacode": captcha}, cookies=True)
                 if re.search(r"no slots available", self.html[1]):
-                    self.time_plus_wait = time() + 60
+                    self.time_plus_wait = time() + 120
+                    self.logger.debug("%s: no free slots, waiting 120 seconds" % (self.__name__))
                     return False
                 if re.search(r"Der Download ist Ihnen zu langsam", self.html[1]):
                     self.time_plus_wait = time() + 15
-- 
cgit v1.2.3