summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/RealdebridCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/RealdebridCom.py')
-rw-r--r--module/plugins/hoster/RealdebridCom.py40
1 files changed, 7 insertions, 33 deletions
diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py
index bf9fda293..4500fcefc 100644
--- a/module/plugins/hoster/RealdebridCom.py
+++ b/module/plugins/hoster/RealdebridCom.py
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-
import re
-
-from random import randrange
-from urllib import unquote
-from time import time
+import time
+import urllib
from module.common.json_layer import json_loads
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
@@ -14,25 +12,16 @@ from module.utils import parseFileSize
class RealdebridCom(MultiHoster):
__name__ = "RealdebridCom"
__type__ = "hoster"
- __version__ = "0.64"
+ __version__ = "0.67"
__pattern__ = r'https?://((?:www\.|s\d+\.)?real-debrid\.com/dl/|[\w^_]\.rdb\.so/d/)[\w^_]+'
+ __config__ = [("use_premium", "bool", "Use premium account if available", True)]
__description__ = """Real-Debrid.com multi-hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")]
- def getFilename(self, url):
- try:
- name = unquote(url.rsplit("/", 1)[1])
- except IndexError:
- name = "Unknown_Filename..."
- if not name or name.endswith(".."): #: incomplete filename, append random stuff
- name += "%s.tmp" % randrange(100, 999)
- return name
-
-
def setup(self):
self.chunkLimit = 3
@@ -42,7 +31,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)
@@ -53,30 +42,15 @@ class RealdebridCom(MultiHoster):
self.logWarning(data['message'])
self.tempOffline()
else:
- if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['file_name']:
+ if pyfile.name and pyfile.name.endswith('.tmp') and data['file_name']:
pyfile.name = data['file_name']
pyfile.size = parseFileSize(data['file_size'])
self.link = data['generated_links'][0][-1]
- if self.getConfig("ssl"):
+ if self.getConfig('ssl'):
self.link = self.link.replace("http://", "https://")
else:
self.link = self.link.replace("https://", "http://")
- if self.link != pyfile.url:
- self.logDebug("New URL: %s" % self.link)
-
- if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'):
- #only use when name wasnt already set
- pyfile.name = self.getFilename(self.link)
-
-
- def checkFile(self):
- if self.checkDownload({"error": "<title>An error occured while processing your request</title>"}):
- #usual this download can safely be retried
- self.retry(wait_time=60, reason=_("An error occured while generating link"))
-
- return super(RealdebridCom, self).checkFile()
-
getInfo = create_getInfo(RealdebridCom)