summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/accounts/CzshareCom.py25
-rw-r--r--module/plugins/hooks/ExtractArchive.py29
-rw-r--r--module/plugins/hoster/LinksnappyCom.py25
-rw-r--r--module/plugins/hoster/ZippyshareCom.py17
-rw-r--r--module/plugins/internal/UnRar.py11
5 files changed, 57 insertions, 50 deletions
diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py
index f84bc67f3..202a88e25 100644
--- a/module/plugins/accounts/CzshareCom.py
+++ b/module/plugins/accounts/CzshareCom.py
@@ -9,7 +9,7 @@ from module.plugins.Account import Account
class CzshareCom(Account):
__name__ = "CzshareCom"
__type__ = "account"
- __version__ = "0.16"
+ __version__ = "0.18"
__description__ = """Czshare.com account plugin, now Sdilej.cz"""
__license__ = "GPLv3"
@@ -21,15 +21,26 @@ class CzshareCom(Account):
def loadAccountInfo(self, user, req):
+ premium = False
+ validuntil = None
+ trafficleft = None
+
html = req.load("http://sdilej.cz/prehled_kreditu/")
- m = re.search(self.CREDIT_LEFT_PATTERN, html)
- if m is None:
- return {"validuntil": 0, "trafficleft": 0}
- else:
- trafficleft = self.parseTraffic(m.group(1).replace(' ', '').replace(',', '.')) + m.group(2)]
+ try:
+ m = re.search(self.CREDIT_LEFT_PATTERN, html)
+ trafficleft = self.parseTraffic(m.group(1).replace(' ', '').replace(',', '.')) + m.group(2)
validuntil = mktime(strptime(m.group(3), '%d.%m.%y %H:%M'))
- return {"validuntil": validuntil, "trafficleft": trafficleft}
+
+ except Exception, e:
+ self.logError(e)
+
+ else:
+ premium = True
+
+ return {'premium' : premium,
+ 'validuntil' : validuntil,
+ 'trafficleft': trafficleft}
def login(self, user, data, req):
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 47325608d..88036da39 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -63,7 +63,10 @@ class ArchiveQueue(object):
def get(self):
- return self.plugin.getStorage("ExtractArchive:%s" % self.storage, "").decode('base64').split()
+ try:
+ return [int(pid) for pid in self.plugin.getStorage("ExtractArchive:%s" % self.storage, "").decode('base64').split()]
+ except Exception:
+ return []
def set(self, value):
@@ -74,10 +77,6 @@ class ArchiveQueue(object):
return self.plugin.setStorage("ExtractArchive:%s" % self.storage, item.encode('base64')[:-1])
- def clean(self):
- return self.set([])
-
-
def delete(self):
return self.plugin.delStorage("ExtractArchive:%s" % self.storage)
@@ -96,6 +95,8 @@ class ArchiveQueue(object):
queue.remove(item)
except ValueError:
pass
+ if queue == []:
+ return self.delete()
return self.set(queue)
@@ -103,7 +104,7 @@ class ArchiveQueue(object):
class ExtractArchive(Hook):
__name__ = "ExtractArchive"
__type__ = "hook"
- __version__ = "1.24"
+ __version__ = "1.26"
__config__ = [("activated" , "bool" , "Activated" , True ),
("fullpath" , "bool" , "Extract with full paths" , True ),
@@ -140,7 +141,7 @@ class ExtractArchive(Hook):
self.queue = ArchiveQueue(self, "Queue")
self.failed = ArchiveQueue(self, "Failed")
- self.interval = 300
+ self.interval = 60
self.extracting = False
self.extractors = []
self.passwords = []
@@ -276,16 +277,16 @@ class ExtractArchive(Hook):
for fname, fid in targets:
name = os.path.basename(fname)
- if not os.path.exists(fname):
- self.logDebug(name, "File not found")
- continue
-
pname = replace_patterns(fname, self.NAME_REPLACEMENTS)
if pname not in processed:
processed.append(pname) #: prevent extracting same file twice
else:
self.logDebug(name, "Skipped")
continue
+
+ if not os.path.exists(fname):
+ self.logDebug(name, "File not found")
+ continue
self.logInfo(name, _("Extract to: %s") % out)
try:
@@ -312,7 +313,7 @@ class ExtractArchive(Hook):
self.setPermissions(new_files)
for filename in new_files:
- file = fs_encode(filename)
+ file = fs_encode(save_join(os.path.dirname(archive.filename), filename))
if not os.path.exists(file):
self.logDebug("New file %s does not exists" % filename)
continue
@@ -390,7 +391,7 @@ class ExtractArchive(Hook):
if not encrypted or not self.getConfig("usepasswordfile"):
archive.extract(password)
else:
- for pw in set(self.getPasswords(False) + [password]):
+ for pw in uniqify([password] + self.getPasswords(False)):
try:
self.logDebug("Try password: %s" % pw)
@@ -465,7 +466,7 @@ class ExtractArchive(Hook):
file = fs_encode(self.getConfig("passwordfile"))
with open(file) as f:
- for pw in f.read().splitlines()[:-1]:
+ for pw in f.read().splitlines():
passwords.append(pw)
except IOError, e:
diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py
index aa3466036..5b0fab43a 100644
--- a/module/plugins/hoster/LinksnappyCom.py
+++ b/module/plugins/hoster/LinksnappyCom.py
@@ -11,46 +11,43 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class LinksnappyCom(MultiHoster):
__name__ = "LinksnappyCom"
__type__ = "hoster"
- __version__ = "0.07"
+ __version__ = "0.08"
- __pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com'
+ __pattern__ = r'https?://(?:[^/]+\.)?linksnappy\.com'
__description__ = """Linksnappy.com multi-hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("stickell", "l.stickell@yahoo.it")]
- SINGLE_CHUNK_HOSTERS = ('easybytez.com')
+ SINGLE_CHUNK_HOSTERS = ["easybytez.com"]
def handlePremium(self, pyfile):
- host = self._get_host(pyfile.url)
- json_params = json_dumps({'link': pyfile.url,
- 'type': host,
+ host = self._get_host(pyfile.url)
+ json_params = json_dumps({'link' : pyfile.url,
+ 'type' : host,
'username': self.user,
'password': self.account.getAccountData(self.user)['password']})
- r = self.load('http://gen.linksnappy.com/genAPI.php',
+
+ r = self.load("http://gen.linksnappy.com/genAPI.php",
post={'genLinks': json_params})
+
self.logDebug("JSON data: " + r)
j = json_loads(r)['links'][0]
if j['error']:
- msg = _("Error converting the link")
- self.logError(msg, j['error'])
- self.fail(msg)
+ self.error(_("Error converting the link"))
pyfile.name = j['filename']
- self.link = j['generated']
+ self.link = j['generated']
if host in self.SINGLE_CHUNK_HOSTERS:
self.chunkLimit = 1
else:
self.setup()
- if self.link != pyfile.url:
- self.logDebug("New URL: " + self.link)
-
@staticmethod
def _get_host(url):
diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
index f32c5877f..ad4b49b44 100644
--- a/module/plugins/hoster/ZippyshareCom.py
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class ZippyshareCom(SimpleHoster):
__name__ = "ZippyshareCom"
__type__ = "hoster"
- __version__ = "0.68"
+ __version__ = "0.69"
__pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)'
@@ -51,20 +51,17 @@ class ZippyshareCom(SimpleHoster):
def get_checksum(self):
try:
- m = re.search(r'\+[ ]*\((\d+)[ ]*\%[ ]*(\d+)[ ]*\+[ ]*(\d+)[ ]*\%[ ]*(\d+)\)[ ]*\+', self.html)
- if m:
- a1, a2, c1, c2 = map(int, m.groups())
- b = (a1 % a2) + (c1 % c2)
- else:
- a1, a2 = map(int, re.search(r'\(\'downloadB\'\).omg = (\d+)%(\d+)' , self.html).groups())
- c1, c2 = map(int, re.search(r'\(\'downloadB\'\).omg\) \* \((\d+)%(\d+)', self.html).groups())
- b = (a1 % a2) * (c1 % c2) + 18
+ z = re.search(r'var z = (\d+)', self.html).group(1)
+ n = (z - 3) % 2
+ b = (z - 3) % 3
+
+ checksum = n + b + z - 3
except Exception:
self.error(_("Unable to calculate checksum"))
else:
- return b
+ return checksum
getInfo = create_getInfo(ZippyshareCom)
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py
index c1cc0fa31..81cfb38a7 100644
--- a/module/plugins/internal/UnRar.py
+++ b/module/plugins/internal/UnRar.py
@@ -22,7 +22,7 @@ def renice(pid, value):
class UnRar(Extractor):
__name__ = "UnRar"
- __version__ = "1.09"
+ __version__ = "1.10"
__description__ = """Rar extractor plugin"""
__license__ = "GPLv3"
@@ -32,7 +32,8 @@ class UnRar(Extractor):
CMD = "unrar"
- EXTENSIONS = [".rar", ".zip", ".cab", ".arj", ".lzh", ".tar", ".gz", ".bz2",
+ # TODO: Find out what Filetypes Unrar supports exactly
+ EXTENSIONS = [".rar", ".cab", ".arj", ".lzh", ".tar", ".gz", ".bz2",
".ace", ".uue", ".jar", ".iso", ".7z", ".xz", ".z"]
#@NOTE: there are some more uncovered rar formats
@@ -40,7 +41,7 @@ class UnRar(Extractor):
re_rarpart2 = re.compile(r'\.r(\d+)$', re.I)
re_filefixed = re.compile(r'Building (.+)')
- re_filelist = re.compile(r'(.+)\s+(\d+)\s+(\d+)\s+|(.+)\s+(\d+)\s+\d\d-\d\d-\d\d\s+\d\d:\d\d\s+(.+)')
+ re_filelist = re.compile(r'(.+)\s+(\D+)\s+(\d+)\s+\d\d-\d\d-\d\d\s+\d\d:\d\d\s+(.+)')
re_wrongpwd = re.compile(r'password', re.I)
re_wrongcrc = re.compile(r'encrypted|damaged|CRC failed|checksum error', re.I)
@@ -166,7 +167,7 @@ class UnRar(Extractor):
try:
dir, name = os.path.split(self.filename)
- part = self.getattr(self, "re_rarpart%d" % i).search(name).group(1)
+ part = getattr(self, "re_rarpart%d" % i).search(name).group(1)
new_name = name[::-1].replace((".part%s.rar" % part)[::-1], ".part*.rar"[::-1], 1)[::-1]
file = fs_encode(os.path.join(dir, new_name))
@@ -220,7 +221,7 @@ class UnRar(Extractor):
# set a password
if "password" in kwargs and kwargs['password']:
- args.append("-p'%s'" % kwargs['password'])
+ args.append("-p%s" % kwargs['password'])
else:
args.append("-p-")