diff options
| author | 2015-03-14 11:07:54 +0100 | |
|---|---|---|
| committer | 2015-03-14 11:07:54 +0100 | |
| commit | e65d19ee3a1e435bf2896ed829e5581eeef92dd2 (patch) | |
| tree | cf5bb073899205a2f00ddeca8df8b9f3944ea835 /module/plugins/hoster | |
| parent | [HotFolder] Missing exception (diff) | |
| download | pyload-e65d19ee3a1e435bf2896ed829e5581eeef92dd2.tar.xz | |
Import cleanup for datetime and time modules
Diffstat (limited to 'module/plugins/hoster')
| -rw-r--r-- | module/plugins/hoster/FilepostCom.py | 9 | ||||
| -rw-r--r-- | module/plugins/hoster/FshareVn.py | 6 | ||||
| -rw-r--r-- | module/plugins/hoster/MegasharesCom.py | 5 | ||||
| -rw-r--r-- | module/plugins/hoster/NetloadIn.py | 10 | ||||
| -rw-r--r-- | module/plugins/hoster/RapiduNet.py | 6 | ||||
| -rw-r--r-- | module/plugins/hoster/RealdebridCom.py | 4 | ||||
| -rw-r--r-- | module/plugins/hoster/ShareonlineBiz.py | 4 | ||||
| -rw-r--r-- | module/plugins/hoster/SimplyPremiumCom.py | 2 | ||||
| -rw-r--r-- | module/plugins/hoster/UploadableCh.py | 2 | ||||
| -rw-r--r-- | module/plugins/hoster/UploadedTo.py | 5 | ||||
| -rw-r--r-- | module/plugins/hoster/Xdcc.py | 16 | ||||
| -rw-r--r-- | module/plugins/hoster/ZippyshareCom.py | 8 | 
12 files changed, 35 insertions, 42 deletions
| diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 21ebbc55e..f8e4e0dbd 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -1,8 +1,7 @@  # -*- coding: utf-8 -*-  import re - -from time import time +import time  from module.common.json_layer import json_loads  from module.plugins.internal.CaptchaService import ReCaptcha @@ -41,7 +40,7 @@ class FilepostCom(SimpleHoster):          captcha_key = m.group(1)          # Get wait time -        get_dict = {'SID': self.req.cj.getCookie('SID'), 'JsHttpRequest': str(int(time() * 10000)) + '-xml'} +        get_dict = {'SID': self.req.cj.getCookie('SID'), 'JsHttpRequest': str(int(time.time() * 10000)) + '-xml'}          post_dict = {'action': 'set_download', 'token': flp_token, 'code': self.info['pattern']['ID']}          wait_time = int(self.getJsonResponse(get_dict, post_dict, 'wait_time')) @@ -57,7 +56,7 @@ class FilepostCom(SimpleHoster):              if password:                  self.logInfo(_("Password protected link, trying ") + file_pass) -                get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' +                get_dict['JsHttpRequest'] = str(int(time.time() * 10000)) + '-xml'                  post_dict['file_pass'] = file_pass                  self.link = self.getJsonResponse(get_dict, post_dict, 'link') @@ -72,7 +71,7 @@ class FilepostCom(SimpleHoster):              recaptcha = ReCaptcha(self)              for i in xrange(5): -                get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' +                get_dict['JsHttpRequest'] = str(int(time.time() * 10000)) + '-xml'                  if i:                      post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = recaptcha.challenge(                          captcha_key) diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 9a2b0c323..77515f191 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -1,8 +1,8 @@  # -*- coding: utf-8 -*-  import re +import time -from time import strptime, mktime, gmtime  from urlparse import urljoin  from module.network.RequestFactory import getURL @@ -99,8 +99,8 @@ class FshareVn(SimpleHoster):          m = re.search(self.WAIT_PATTERN, self.html)          if m:              self.logInfo(_("Wait until %s ICT") % m.group(1)) -            wait_until = mktime(strptime(m.group(1), "%d/%m/%Y %H:%M")) -            self.wait(wait_until - mktime(gmtime()) - 7 * 60 * 60, True) +            wait_until = time.mktime.time(time.strptime.time(m.group(1), "%d/%m/%Y %H:%M")) +            self.wait(wait_until - time.mktime.time(time.gmtime.time()) - 7 * 60 * 60, True)              self.retry()          elif '<ul class="message-error">' in self.html:              msg = "Unknown error occured or wait time not parsed" diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index bdb428143..34b75e8fd 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -1,8 +1,7 @@  # -*- coding: utf-8 -*-  import re - -from time import time +import time  from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -66,7 +65,7 @@ class MegasharesCom(SimpleHoster):                                       'rsargs[]': random_num,                                       'rsargs[]': passport_num,                                       'rsargs[]': "replace_sec_pprenewal", -                                     'rsrnd[]' : str(int(time() * 1000))}) +                                     'rsrnd[]' : str(int(time.time() * 1000))})                  if 'Thank you for reactivating your passport.' in res:                      self.correctCaptcha() diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 16728ad43..0ff3c25d3 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -1,9 +1,9 @@  # -*- coding: utf-8 -*-  import re +import time  from urlparse import urljoin -from time import time  from module.network.RequestFactory import getURL  from module.plugins.Hoster import Hoster @@ -161,7 +161,7 @@ class NetloadIn(Hoster):      def final_wait(self, page): -        wait_time = self.get_wait_time(page) +        wait_time = self.get_wait_time.time(page)          self.setWait(wait_time) @@ -175,7 +175,7 @@ class NetloadIn(Hoster):      def check_free_wait(self, page):          if ">An access request has been made from IP address <" in page:              self.wantReconnect = True -            self.setWait(self.get_wait_time(page) or 30) +            self.setWait(self.get_wait_time.time(page) or 30)              self.wait()              return True          else: @@ -207,7 +207,7 @@ class NetloadIn(Hoster):          for i in xrange(5):              if not page:                  page = self.load(self.url) -                t = time() + 30 +                t = time.time() + 30              if "/share/templates/download_hddcrash.tpl" in page:                  self.logError(_("Netload HDD Crash")) @@ -281,7 +281,7 @@ class NetloadIn(Hoster):              return None -    def get_wait_time(self, page): +    def get_wait_time.time(self, page):          return int(re.search(r"countdown\((.+),'change\(\)'\)", page).group(1)) / 100 diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py index 350572eef..b455f556f 100644 --- a/module/plugins/hoster/RapiduNet.py +++ b/module/plugins/hoster/RapiduNet.py @@ -1,9 +1,9 @@  # -*- coding: utf-8 -*-  import re +import time  from pycurl import HTTPHEADER -from time import time, altzone  from module.common.json_layer import json_loads  from module.plugins.internal.CaptchaService import ReCaptcha @@ -47,14 +47,14 @@ class RapiduNet(SimpleHoster):                                        decode=True)          if str(jsvars['timeToDownload']) is "stop": -            t = (24 * 60 * 60) - (int(time()) % (24 * 60 * 60)) + altzone +            t = (24 * 60 * 60) - (int(time.time()) % (24 * 60 * 60)) + time.altzone              self.logInfo("You've reach your daily download transfer")              self.retry(10, 10 if t < 1 else None, _("Try tomorrow again"))  #@NOTE: check t in case of not synchronised clock          else: -            self.wait(int(jsvars['timeToDownload']) - int(time())) +            self.wait(int(jsvars['timeToDownload']) - int(time.time()))          recaptcha = ReCaptcha(self) diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index ba76cfe9d..888f74cb7 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -1,10 +1,10 @@  # -*- coding: utf-8 -*-  import re +import time  from random import randrange  from urllib import unquote -from time import time  from module.common.json_layer import json_loads  from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo @@ -42,7 +42,7 @@ class RealdebridCom(MultiHoster):                                      get={'lang'    : "en",                                           'link'    : pyfile.url,                                           'password': self.getPassword(), -                                         'time'    : int(time() * 1000)})) +                                         'time'    : int(time.time() * 1000)}))          self.logDebug("Returned Data: %s" % data) diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 546cd2f42..5ed8ca793 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -1,8 +1,8 @@  # -*- coding: utf-8 -*-  import re +import time -from time import time  from urllib import unquote  from urlparse import urlparse @@ -74,7 +74,7 @@ class ShareonlineBiz(SimpleHoster):              m = re.search(r'var wait=(\d+);', self.html)              self.setWait(int(m.group(1)) if m else 30) -            res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), +            res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time.time() * 1000)),                              post={'dl_free'                  : "1",                                    'recaptcha_challenge_field': challenge,                                    'recaptcha_response_field' : response}) diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index a87e7533f..978aba11a 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -2,8 +2,6 @@  import re -from datetime import datetime, timedelta -  from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo  from module.plugins.internal.SimpleHoster import secondsToMidnight diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index 46b68c5fc..cd13a1468 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -2,8 +2,6 @@  import re -from time import sleep -  from module.plugins.internal.CaptchaService import ReCaptcha  from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 6161863b2..5c6160c8d 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -1,8 +1,7 @@  # -*- coding: utf-8 -*-  import re - -from time import sleep +import time  from module.network.RequestFactory import getURL  from module.plugins.internal.CaptchaService import ReCaptcha @@ -48,7 +47,7 @@ class UploadedTo(SimpleHoster):                      info['status'] = 1                  break              else: -                sleep(3) +                time.sleep(3)          return info diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index bfa62b8db..b77e7c1da 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -4,11 +4,11 @@ import re  import socket  import struct  import sys +import time  from os import makedirs  from os.path import exists, join  from select import select -from time import time  from module.plugins.Hoster import Hoster  from module.utils import save_join @@ -84,12 +84,12 @@ class Xdcc(Hoster):          #######################          # CONNECT TO IRC AND IDLE FOR REAL LINK -        dl_time = time() +        dl_time = time.time()          sock = socket.socket()          sock.connect((host, int(port)))          if nick == "pyload": -            nick = "pyload-%d" % (time() % 1000)  # last 3 digits +            nick = "pyload-%d" % (time.time() % 1000)  # last 3 digits          sock.send("NICK %s\r\n" % nick)          sock.send("USER %s %s bla :%s\r\n" % (ident, host, real)) @@ -111,13 +111,13 @@ class Xdcc(Hoster):                  break              if retry: -                if time() > retry: +                if time.time() > retry:                      retry = None -                    dl_time = time() +                    dl_time = time.time()                      sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack))              else: -                if (dl_time + self.timeout) < time():  # todo: add in config +                if (dl_time + self.timeout) < time.time():  # todo: add in config                      sock.send("QUIT :byebye\r\n")                      sock.close()                      self.fail(_("XDCC Bot did not answer")) @@ -159,7 +159,7 @@ class Xdcc(Hoster):                          sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface"))                      elif msg['text'] == "\x01TIME\x01":                          self.logDebug("Sending CTCP TIME") -                        sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time())) +                        sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time()))                      elif msg['text'] == "\x01LAG\x01":                          pass  # don't know how to answer @@ -172,7 +172,7 @@ class Xdcc(Hoster):                      print "%s: %s" % (msg['origin'], msg['text'])                  if "You already requested that pack" in msg['text']: -                    retry = time() + 300 +                    retry = time.time() + 300                  if "you must be on a known channel to request a pack" in msg['text']:                      self.fail(_("Wrong channel")) diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index d9d1db1be..f9e112aed 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -63,15 +63,15 @@ class ZippyshareCom(SimpleHoster):          def replElementById(element):              id   = element.group(1) # id might be either 'x' (a real id) or x (a variable)              attr = element.group(4)  # attr might be None -             +              varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr)) -             +              realid = id.strip('"\'') -            if id != realid: #id is not a variable, so look for realid.attr in the html  +            if id != realid: #id is not a variable, so look for realid.attr in the html                  initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=realid)])                  initValue  = '"%s"' % initValues[-1] if initValues else 'null'                  initScripts.add('%s = %s;' % (varName, initValue)) -                 +              return varName          # handle all getElementById | 
