summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-14 11:07:54 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-14 11:07:54 +0100
commite65d19ee3a1e435bf2896ed829e5581eeef92dd2 (patch)
treecf5bb073899205a2f00ddeca8df8b9f3944ea835 /module/plugins/internal
parent[HotFolder] Missing exception (diff)
downloadpyload-e65d19ee3a1e435bf2896ed829e5581eeef92dd2.tar.xz
Import cleanup for datetime and time modules
Diffstat (limited to 'module/plugins/internal')
-rw-r--r--module/plugins/internal/MultiHook.py5
-rw-r--r--module/plugins/internal/SimpleHoster.py12
-rw-r--r--module/plugins/internal/XFSAccount.py6
-rw-r--r--module/plugins/internal/XFSHoster.py2
4 files changed, 12 insertions, 13 deletions
diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py
index e69f56c32..d4369da9b 100644
--- a/module/plugins/internal/MultiHook.py
+++ b/module/plugins/internal/MultiHook.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from time import sleep
+import time
from module.plugins.Hook import Hook
from module.utils import decode, remove_chars
@@ -132,7 +131,7 @@ class MultiHook(Hook):
except Exception, e:
self.logDebug(e, "Waiting 1 minute and retry")
- sleep(60)
+ time.sleep(60)
else:
self.logWarning(_("Fallback to default reload interval due plugin"))
self.interval = self.MIN_RELOAD_INTERVAL
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 114128c63..5defd028d 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
+import datetime
import mimetypes
import os
import re
+import time
-from datetime import datetime, timedelta
from inspect import isclass
-from time import time
from urllib import unquote
from urlparse import urljoin, urlparse
@@ -137,7 +137,7 @@ def create_getInfo(plugin):
def timestamp():
- return int(time() * 1000)
+ return int(time.time() * 1000)
#@TODO: Move to hoster class in 0.4.10
@@ -226,18 +226,18 @@ def getFileURL(self, url, follow_location=None):
def secondsToMidnight(gmt=0):
- now = datetime.utcnow() + timedelta(hours=gmt)
+ now = datetime.datetime.utcnow() + datetime.timedelta(hours=gmt)
if now.hour is 0 and now.minute < 10:
midnight = now
else:
- midnight = now + timedelta(days=1)
+ midnight = now + datetime.timedelta(days=1)
td = midnight.replace(hour=0, minute=10, second=0, microsecond=0) - now
if hasattr(td, 'total_seconds'):
res = td.total_seconds()
- else: #: work-around for python 2.5 and 2.6 missing timedelta.total_seconds
+ else: #: work-around for python 2.5 and 2.6 missing datetime.timedelta.total_seconds
res = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
return int(res)
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py
index 9315fb68f..31d1b7e2f 100644
--- a/module/plugins/internal/XFSAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
import re
+import time
-from time import gmtime, mktime, strptime
from urlparse import urljoin
from module.plugins.Account import Account
@@ -80,7 +80,7 @@ class XFSAccount(Account):
self.logDebug("Expire date: " + expiredate)
try:
- validuntil = mktime(strptime(expiredate, "%d %B %Y"))
+ validuntil = time.mktime(time.strptime(expiredate, "%d %B %Y"))
except Exception, e:
self.logError(e)
@@ -88,7 +88,7 @@ class XFSAccount(Account):
else:
self.logDebug("Valid until: %s" % validuntil)
- if validuntil > mktime(gmtime()):
+ if validuntil > time.mktime(time.gmtime()):
premium = True
trafficleft = -1
else:
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index 6e0b5e4ab..9e60a5aa5 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
import re
+import time
from random import random
-from time import sleep
from urlparse import urljoin, urlparse
from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME