summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-16 16:26:00 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-16 16:26:00 +0200
commit19ea1c7a94d8078c89cceb60a138c41b72e0e0af (patch)
tree857ee9d17a116d03a0f34981860f7d142e68b964
parentCleanup (3) (diff)
parent[UpdateManager] Cleanup (diff)
downloadpyload-19ea1c7a94d8078c89cceb60a138c41b72e0e0af.tar.xz
Merge branch 'stable' into 0.4.10
Conflicts: pyload/plugin/addon/UpdateManager.py pyload/plugin/hoster/UploadedTo.py pyload/plugin/hoster/YadiSk.py pyload/plugin/internal/SimpleHoster.py
-rw-r--r--pyload/plugin/addon/UpdateManager.py20
-rw-r--r--pyload/plugin/hoster/HostujeNet.py46
-rw-r--r--pyload/plugin/hoster/UploadedTo.py4
-rw-r--r--pyload/plugin/hoster/YadiSk.py81
-rw-r--r--pyload/plugin/internal/SimpleHoster.py4
5 files changed, 110 insertions, 45 deletions
diff --git a/pyload/plugin/addon/UpdateManager.py b/pyload/plugin/addon/UpdateManager.py
index 60fc71d0a..57498d512 100644
--- a/pyload/plugin/addon/UpdateManager.py
+++ b/pyload/plugin/addon/UpdateManager.py
@@ -30,7 +30,7 @@ def exists(path):
class UpdateManager(Addon):
__name = "UpdateManager"
__type = "addon"
- __version = "0.50"
+ __version = "0.51"
__config = [("activated", "bool", "Activated", False),
("checkinterval", "int", "Check interval in hours", 8),
@@ -50,6 +50,8 @@ class UpdateManager(Addon):
SERVER_URL = "http://updatemanager.pyload.org" if release_status == 5 else None
MIN_CHECK_INTERVAL = 3 * 60 * 60 #: 3 hours
+ event_list = ["allDownloadsProcessed"]
+
def activate(self):
if self.checkonstart:
@@ -69,6 +71,14 @@ class UpdateManager(Addon):
else:
self.checkonstart = False
+ self.do_restart = False
+
+
+ def allDownloadsProcessed(self):
+ if self.do_restart is True:
+ self.logWarning(_("Downloads are done, restarting pyLoad to reload the updated plugins"))
+ self.core.api.restart()
+
def periodical(self):
if self.core.debug:
@@ -129,7 +139,11 @@ class UpdateManager(Addon):
self.core.api.pauseServer()
if self._update() is 2 and self.getConfig('autorestart'):
- self.core.api.restart()
+ if not self.core.api.statusDownloads():
+ self.core.api.restart()
+ else:
+ self.do_restart = True
+ self.logWarning(_("Downloads are active, will restart once the download is done"))
else:
self.core.api.unpauseServer()
@@ -259,7 +273,7 @@ class UpdateManager(Addon):
if self.core.pluginManager.reloadPlugins(updated):
exitcode = 1
else:
- self.logWarning(_("Restart pyLoad to reload the updated plugins"))
+ self.logWarning(_("pyLoad restart required to reload the updated plugins"))
self.info['plugins'] = True
exitcode = 2
diff --git a/pyload/plugin/hoster/HostujeNet.py b/pyload/plugin/hoster/HostujeNet.py
new file mode 100644
index 000000000..4dd5bb1c3
--- /dev/null
+++ b/pyload/plugin/hoster/HostujeNet.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from pyload.plugin.internal.SimpleHoster import SimpleHoster
+
+
+class HostujeNet(SimpleHoster):
+ __name__ = "HostujeNet"
+ __type__ = "hoster"
+ __version__ = "0.01"
+
+ __pattern__ = r'http://(?:www\.)?hostuje\.net/\w+'
+
+ __description__ = """Hostuje.net hoster plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("GammaC0de", None)]
+
+
+ NAME_PATTERN = r'<input type="hidden" name="name" value="(?P<N>.+?)">'
+ SIZE_PATTERN = r'<b>Rozmiar:</b> (?P<S>[\d.,]+) (?P<U>[\w^_]+)<br>'
+ OFFLINE_PATTERN = ur'Podany plik nie został odnaleziony\.\.\.'
+
+
+ def setup(self):
+ self.multiDL = True
+ self.chunkLimit = 1
+
+
+ def handleFree(self, pyfile):
+ m = re.search(r'<script src="([\w^_]+.php)"></script>', self.html)
+ if m:
+ jscript = self.load("http://hostuje.net/" + m.group(1))
+ m = re.search(r"\('(\w+\.php\?i=\w+)'\);", jscript)
+ if m:
+ self.load("http://hostuje.net/" + m.group(1))
+ else:
+ self.error(_("unexpected javascript format"))
+ else:
+ self.error(_("script not found"))
+
+ action, inputs = self.parseHtmlForm(pyfile.url.replace(".", "\.").replace( "?", "\?"))
+ if not action:
+ self.error(_("form not found"))
+
+ self.download(action, post=inputs)
diff --git a/pyload/plugin/hoster/UploadedTo.py b/pyload/plugin/hoster/UploadedTo.py
index 7031d0ab2..487c01576 100644
--- a/pyload/plugin/hoster/UploadedTo.py
+++ b/pyload/plugin/hoster/UploadedTo.py
@@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster
class UploadedTo(SimpleHoster):
__name = "UploadedTo"
__type = "hoster"
- __version = "0.85"
+ __version = "0.86"
__pattern = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)'
__config = [("use_premium", "bool", "Use premium account if available", True)]
@@ -21,6 +21,8 @@ class UploadedTo(SimpleHoster):
__authors = [("Walter Purcaro", "vuolter@gmail.com")]
+ DISPOSITION = False
+
API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL"
URL_REPLACEMENTS = [(__pattern + ".*", r'http://uploaded.net/file/\g<ID>')]
diff --git a/pyload/plugin/hoster/YadiSk.py b/pyload/plugin/hoster/YadiSk.py
index 528d6bc80..f68039e2e 100644
--- a/pyload/plugin/hoster/YadiSk.py
+++ b/pyload/plugin/hoster/YadiSk.py
@@ -10,7 +10,7 @@ from pyload.utils import json_loads
class YadiSk(SimpleHoster):
__name = "YadiSk"
__type = "hoster"
- __version = "0.03"
+ __version = "0.04"
__pattern = r'https?://yadi\.sk/d/\w+'
@@ -22,6 +22,42 @@ class YadiSk(SimpleHoster):
OFFLINE_PATTERN = r'Nothing found'
+ @classmethod
+ def getInfo(cls, url="", html=""):
+ info = super(YadiSk, cls).getInfo(url, html)
+
+ if html:
+ if 'idclient' not in info:
+ info['idclient'] = ""
+ for _i in xrange(32):
+ info ['idclient'] += random.choice('0123456abcdef')
+
+ m = re.search(r'<script id="models-client" type="application/json">(.+?)</script>', html)
+ if m:
+ api_data = json_loads(m.group(1))
+ try:
+ for sect in api_data:
+ if 'model' in sect:
+ if sect['model'] == "config":
+ info['version'] = sect['data']['version']
+ info['sk'] = sect['data']['sk']
+
+ elif sect['model'] == "resource":
+ info['id'] = sect['data']['id']
+ info['size'] = sect['data']['meta']['size']
+ info['name'] = sect['data']['name']
+
+ except Exception, e:
+ info['status'] = 8
+ info['error'] = _("Unexpected server response: %s") % e.message
+
+ else:
+ info['status'] = 8
+ info['error'] = _("could not find required json data")
+
+ return info
+
+
def setup(self):
self.resumeDownload = False
self.multiDL = False
@@ -29,51 +65,18 @@ class YadiSk(SimpleHoster):
def handleFree(self, pyfile):
- m = re.search(r'<script id="models-client" type="application/json">(.+?)</script>', self.html)
- if m is None:
- self.error(_("could not find required json data"))
-
- res = json_loads(m.group(1))
-
- yadisk_ver = None
- yadisk_sk = None
- yadisk_id = None
- yadisk_size = None
- yadisk_name = None
-
- try: #@TODO: Copy to apiInfo
- for sect in res:
- if 'model' in sect:
- if sect['model'] == "config":
- yadisk_ver = sect['data']['version']
- yadisk_sk = sect['data']['sk']
-
- elif sect['model'] == "resource":
- yadisk_id = sect['data']['id']
- yadisk_size = sect['data']['meta']['size']
- yadisk_name = sect['data']['name']
-
- except Exception, e:
- self.fail(_("Unexpected server response"), e)
-
- if None in (yadisk_id, yadisk_sk, yadisk_id, yadisk_size, yadisk_name):
+ if any(True for _k in ['id', 'sk', 'version', 'idclient'] if _k not in self.info):
self.error(_("Missing JSON data"))
- self.pyfile.size = yadisk_size
- self.pyfile.name = yadisk_name
-
- yadisk_idclient = ""
- for _i in range(32):
- yadisk_idclient += random.choice('0123456abcdef')
try:
self.html = self.load("https://yadi.sk/models/",
get={'_m': "do-get-resource-url"},
- post={'idClient': yadisk_idclient,
- 'version' : yadisk_ver,
+ post={'idClient': self.info['idclient'],
+ 'version' : self.info['version'],
'_model.0': "do-get-resource-url",
- 'sk' : yadisk_sk,
- 'id.0' : yadisk_id})
+ 'sk' : self.info['sk'],
+ 'id.0' : self.info['id']})
self.link = json_loads(self.html)['models'][0]['data']['file']
diff --git a/pyload/plugin/internal/SimpleHoster.py b/pyload/plugin/internal/SimpleHoster.py
index c0cdc05a8..a215e6886 100644
--- a/pyload/plugin/internal/SimpleHoster.py
+++ b/pyload/plugin/internal/SimpleHoster.py
@@ -244,7 +244,7 @@ def secondsToMidnight(gmt=0):
class SimpleHoster(Hoster):
__name = "SimpleHoster"
__type = "hoster"
- __version = "1.37"
+ __version = "1.38"
__pattern = r'^unmatchable$'
__config = [("use_premium", "bool", "Use premium account if available", True)]
@@ -609,7 +609,7 @@ class SimpleHoster(Hoster):
self.tempOffline()
elif status is 8:
- self.fail()
+ self.fail(self.info['error'] if 'error' in self.info else "Failed")
finally:
self.logDebug("File status: %s" % statusMap[status])