summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-07-20 18:14:08 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-07-20 18:14:08 +0200
commitabac8315248b6a72b0b4906548d9372f459cdd2e (patch)
tree794a4aa946147e23ac43fde5db1098ff3e3db84c /module
parentCleanup (diff)
downloadpyload-abac8315248b6a72b0b4906548d9372f459cdd2e.tar.xz
Code optimized
Diffstat (limited to 'module')
-rw-r--r--module/plugins/accounts/SimplydebridCOM.py18
-rw-r--r--module/plugins/hooks/SimplydebridCOM.py8
-rw-r--r--module/plugins/hoster/SimplydebridCOM.py20
3 files changed, 22 insertions, 24 deletions
diff --git a/module/plugins/accounts/SimplydebridCOM.py b/module/plugins/accounts/SimplydebridCOM.py
index 53d707877..faa6091c5 100644
--- a/module/plugins/accounts/SimplydebridCOM.py
+++ b/module/plugins/accounts/SimplydebridCOM.py
@@ -10,24 +10,24 @@ class SimplydebridCOM(Account):
__type__ = "account"
__description__ = """Simply-Debrid.com account plugin"""
__author_name__ = ("Kagenoshin")
- __author_mail__ = ("kagenoshin@gmx.ch")
+ __author_mail__ = ("kagenoshin@gmx.ch")
def loadAccountInfo(self, user, req):
- response = req.load("http://simply-debrid.com/api.php?login=2&u="+self.loginname+"&p="+self.password, decode = True, just_header = False)
+ get_data = {'login': 2, 'u': self.loginname, 'p': self.password}
+ response = req.load("http://simply-debrid.com/api.php, get=get_data, decode=True)
data = [x.strip() for x in response.split(";")]
if str(data[0]) != "1":
- account_info = {"trafficleft": 0, "validuntil": 0, "premium": False}
+ return {"premium": False}
else:
- account_info = {
+ return {
"trafficleft": -1,
- "validuntil": mktime(strptime(str(data[2]),"%d/%m/%Y")),
- "premium": True
+ "validuntil": mktime(strptime(str(data[2]),"%d/%m/%Y"))
}
- return account_info
def login(self, user, data, req):
self.loginname = user
self.password = data["password"]
- response = req.load("http://simply-debrid.com/api.php?login=1&u="+self.loginname+"&p="+self.password, decode = True, just_header = False)
+ get_data = {'login': 1, 'u': self.loginname, 'p': self.password}
+ response = req.load("http://simply-debrid.com/api.php, get=get_data, decode=True)
if response != "02: loggin success":
- self.wrongPassword() \ No newline at end of file
+ self.wrongPassword()
diff --git a/module/plugins/hooks/SimplydebridCOM.py b/module/plugins/hooks/SimplydebridCOM.py
index 79083f724..721dce6ca 100644
--- a/module/plugins/hooks/SimplydebridCOM.py
+++ b/module/plugins/hooks/SimplydebridCOM.py
@@ -7,13 +7,13 @@ class SimplydebridCOM(MultiHoster):
__name__ = "SimplydebridCOM"
__version__ = "0.01"
__type__ = "hook"
- __config__ = [("activated", "bool", "Activated", "False"),("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),("hosterList", "str", "Hoster list (comma separated)", "")]
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", "")]
__description__ = """Simply-Debrid.com hook plugin"""
__author_name__ = ("Kagenoshin")
__author_mail__ = ("kagenoshin@gmx.ch")
def getHoster(self):
page = getURL("http://simply-debrid.com/api.php?list=1")
- if(page[len(page)-1] == ";"): #remove ; if the page entry ends with ;
- page = page[0:len(page)-1]
- return [x.strip() for x in page.replace("\"","").split(";")] \ No newline at end of file
+ return [x.strip() for x in page.rstrip(';').replace("\"","").split(";")]
diff --git a/module/plugins/hoster/SimplydebridCOM.py b/module/plugins/hoster/SimplydebridCOM.py
index c4bce15b1..499c17145 100644
--- a/module/plugins/hoster/SimplydebridCOM.py
+++ b/module/plugins/hoster/SimplydebridCOM.py
@@ -24,24 +24,22 @@ class SimplydebridCOM(Hoster):
if not self.account:
self.logError(_("Please enter your simply-debrid.com account or deactivate this plugin"))
self.fail("No simply-debrid.com account provided")
-
- self.logDebug("simply-debrid.com: Old URL: %s" % pyfile.url)
-
+
+ self.logDebug("Old URL: %s" % pyfile.url)
+
#fix the links for simply-debrid.com!
new_url = pyfile.url
new_url = new_url.replace("clz.to", "cloudzer.net/file")
new_url = new_url.replace("http://share-online", "http://www.share-online")
-
- if re.match(self.__pattern__, new_url):
- new_url = new_url
- else:
- page = self.req.load('http://simply-debrid.com/api.php?dl='+new_url)#+'&u='+self.user+'&p='+self.account.getAccountData(self.user)['password'])
+
+ if not re.match(self.__pattern__, new_url):
+ page = self.load('http://simply-debrid.com/api.php', get={'dl': new_url}) #+'&u='+self.user+'&p='+self.account.getAccountData(self.user)['password'])
if('tiger Link' in page or 'Invalid Link' in page or ('API' in page and 'ERROR' in page)):
self.fail('Unable to unrestrict link')
new_url = page
-
+
self.setWait(5)
self.wait()
self.logDebug("Unrestricted URL: " + new_url)
-
- self.download(new_url, disposition=True) \ No newline at end of file
+
+ self.download(new_url, disposition=True)