diff options
Diffstat (limited to 'module/plugins')
| -rw-r--r-- | module/plugins/Plugin.py | 3 | ||||
| -rw-r--r-- | module/plugins/PluginManager.py | 8 | ||||
| -rw-r--r-- | module/plugins/hoster/MegauploadCom.py | 21 | 
3 files changed, 28 insertions, 4 deletions
| diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index e59977451..6182b0f7f 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -127,7 +127,6 @@ class Plugin(object):      def preprocessing(self, thread):          """ handles important things to do before starting """ -        self.setup()          self.thread = thread          if self.account: @@ -135,6 +134,8 @@ class Plugin(object):          else:              self.req.clearCookies() +        self.setup() +          self.pyfile.setStatus("starting")          return self.process(self.pyfile) diff --git a/module/plugins/PluginManager.py b/module/plugins/PluginManager.py index 1e42e5a63..a911cdd1e 100644 --- a/module/plugins/PluginManager.py +++ b/module/plugins/PluginManager.py @@ -282,8 +282,12 @@ class PluginManager():              if value.has_key("class"):                  classes.append(value["class"])                  continue -             -            if not self.core.config.getPlugin(name, "load"): + +            try: +                if not self.core.config.getPlugin(name, "load"): +                    continue +            except: +                self.log.debug("Failed to load %s" % name)                  continue              try: diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index 20cff6e63..a7bc85856 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -9,6 +9,8 @@ from module.network.RequestFactory import getURL  from module.unescape import unescape +from pycurl import error +  def getInfo(urls):      url = "http://megaupload.com/mgr_linkcheck.php" @@ -98,7 +100,24 @@ class MegauploadCom(Hoster):          else:              self.download_api()              pyfile.name = self.get_file_name() -            self.download(pyfile.url) + +            try: +                self.download(pyfile.url) +            except error, e: +                if e.args and e.args[0] == 33: +                    # undirect download and resume , not a good idea +                    page = self.load(pyfile.url) +                    self.download(re.search(r'href=\"(http://[^\"]*?)\" class=\"down_ad_butt1\">', page).group(1)) +                    return  +                else: +                    raise + +            check = self.checkDownload({"dllink": re.compile(r'href=\"(http://[^\"]*?)\" class=\"down_ad_butt1\">')}) +            if check == "dllink": +                self.log.warning(_("You should enable direct Download in your Megaupload Account settings")) + +                pyfile.size = 0 +                self.download(self.lastCheck.group(1))      def download_html(self):                  for i in range(3): | 
