summaryrefslogtreecommitdiffstats
path: root/pyLoadCore.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyLoadCore.py')
-rwxr-xr-xpyLoadCore.py42
1 files changed, 25 insertions, 17 deletions
diff --git a/pyLoadCore.py b/pyLoadCore.py
index 39f440442..b78cf5b5c 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -46,14 +46,10 @@ from time import sleep
import urllib2
from imp import find_module
from re import sub
-try:
- find_module("Crypto")
-except ImportError:
- print "Install pycrypto to use pyLoad"
- exit()
from module.file_list import File_List
from module.thread_list import Thread_List
from module.network.Request import Request
+import module.remote.SecureXMLRPCServer as Server
import thread
class Core(object):
@@ -116,6 +112,7 @@ class Core(object):
translation = gettext.translation("pyLoad", "locale", languages=[self.config['general']['language']])
translation.install(unicode=True)
+ self.check_install("Crypto", "pycrypto to decode container files")
self.check_install("pycurl", "pycurl for lower memory footprint while downloading")
self.check_install("tesseract", "tesseract for captcha reading", False)
self.check_install("gocr", "gocr for captcha reading", False)
@@ -177,7 +174,6 @@ class Core(object):
try:
server_addr = (self.config['remote']['listenaddr'], int(self.config['remote']['port']))
usermap = { self.config['remote']['username']: self.config['remote']['password']}
- Server = __import__("module.remote.SecureXMLRPCServer", globals(), locals(), "SecureXMLRPCServer", -1)
if self.config['ssl']['activated']:
self.server = Server.SecureXMLRPCServer(server_addr, self.config['ssl']['cert'], self.config['ssl']['key'], usermap)
self.logger.info("Secure XMLRPC Server Started")
@@ -244,19 +240,31 @@ class Core(object):
def check_update(self):
"""checks newst version"""
- if not self.config['updates']['search_updates']:
- return False
-
- newst_version = Request().load("http://update.pyload.org/s/" + CURRENT_VERSION)
- if newst_version == "True":
- if not self.config['updates']['install_updates']:
- self.logger.info("New Version of pyLoad available")
+ if self.config['updates']['search_updates']:
+ version_check = Request().load("http://update.pyload.org/index.php?do=dev%s&download=%s" %(CURRENT_VERSION, self.config['updates']['install_updates']))
+ if version_check == "":
+ self.logger.info("No Updates for pyLoad")
+ return False
else:
- updater = __import__("pyLoadUpdater")
- updater.main()
+ if self.config['updates']['install_updates']:
+ try:
+ tmp_zip_name = __import__("tempfile").NamedTemporaryFile(suffix=".zip").name
+ tmp_zip = open(tmp_zip_name, 'w')
+ tmp_zip.write(version_check)
+ tmp_zip.close()
+ __import__("module.Unzip", globals(), locals(), "Unzip", -1).Unzip().extract(tmp_zip_name,"Test/")
+ return True
+
+ except:
+ self.logger.info("Auto install Faild")
+ return False
+
+ else:
+ self.logger.info("New pyLoad Version %s available" % version_check)
+ return True
else:
- self.logger.info("No Updates for pyLoad")
-
+ return False
+
def create_plugin_index(self):
for file_handler in glob(self.plugin_folder + sep + '*.py') + glob(self.plugin_folder + sep + 'DLC.pyc'):
plugin_pattern = ""