diff options
Diffstat (limited to 'pyLoadCore.py')
-rwxr-xr-x | pyLoadCore.py | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/pyLoadCore.py b/pyLoadCore.py index 56f32c9c5..97c9ec64b 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -43,14 +43,13 @@ from module import InitHomeDir from module.plugins.AccountManager import AccountManager from module.CaptchaManager import CaptchaManager from module.ConfigParser import ConfigParser -from module.HookManager import HookManager from module.plugins.PluginManager import PluginManager from module.PullEvents import PullManager from module.network.RequestFactory import RequestFactory -from module.ThreadManager import ThreadManager from module.web.ServerThread import WebServer from module.Scheduler import Scheduler from module.common.JsEngine import JsEngine +from module import remote from module.remote.RemoteManager import RemoteManager from module.database import DatabaseBackend, FileHandler @@ -77,20 +76,24 @@ class Core(object): self.startedInGui = False self.running = False self.daemon = False + self.remote = True self.arg_links = [] self.pidfile = "pyload.pid" self.deleteLinks = False # will delete links on startup if len(argv) > 1: try: - options, args = getopt(argv[1:], 'vchdusq', - ["version", "clear", "clean", "help", "debug", "user", "setup", "configdir=", "changedir", "daemon", - "quit", "status"]) + options, args = getopt(argv[1:], 'vchdusqp:', + ["version", "clear", "clean", "help", "debug", "user", + "setup", "configdir=", "changedir", "daemon", + "quit", "status", "no-remote","pidfile="]) for option, argument in options: if option in ("-v", "--version"): print "pyLoad", CURRENT_VERSION exit() + elif option in ("-p", "--pidfile"): + self.pidfile = argument elif option == "--daemon": self.daemon = True elif option in ("-c", "--clear"): @@ -134,6 +137,8 @@ class Core(object): elif option == "--clean": self.cleanTree() exit() + elif option == "--no-remote": + self.remote = False except GetoptError: print 'Unknown Argument(s) "%s"' % " ".join(argv[1:]) @@ -157,8 +162,10 @@ class Core(object): print " -d, --debug", " " * 12, "Enable debug mode" print " -s, --setup", " " * 12, "Run Setup Assistent" print " --configdir=<dir>", " " * 6, "Run with <dir> as config directory" + print " -p, --pidfile=<file>", " " * 3, "Set pidfile to <file>" print " --changedir", " " * 12, "Change config dir permanently" print " --daemon", " " * 15, "Daemonmize after start" + print " --no-remote", " " * 12, "Disable remote access (saves RAM)" print " --status", " " * 15, "Display pid if running or False" print " --clean", " " * 16, "Remove .pyc/.pyo files" print " -q, --quit", " " * 13, "Quit running pyLoad instance" @@ -286,6 +293,7 @@ class Core(object): translation.install(True) self.debug = self.doDebug or self.config['general']['debug_mode'] + self.remote &= self.config['remote']['activated'] pid = self.isAlreadyRunning() if pid: @@ -333,6 +341,9 @@ class Core(object): #@TODO refractor + remote.activated = self.remote + self.log.debug("Remote activated: %s" % self.remote) + self.check_install("Crypto", _("pycrypto to decode container files")) #img = self.check_install("Image", _("Python Image Libary (PIL) for captcha reading")) #self.check_install("pycurl", _("pycurl to download any files"), True, True) @@ -362,9 +373,15 @@ class Core(object): self.lastClientConnected = 0 - from module.Api import Api + # later imported because they would trigger api import, and remote value not set correctly + from module.HookManager import HookManager + from module.ThreadManager import ThreadManager + from module import Api + + if Api.activated != self.remote: + self.log.warning("Import error: API remote status not correct.") - self.api = Api(self) + self.api = Api.Api(self) self.scheduler = Scheduler(self) @@ -387,8 +404,6 @@ class Core(object): if web: self.init_webserver() - #linkFile = self.config['general']['link_file'] - spaceLeft = freeSpace(self.config["general"]["download_folder"]) self.log.info(_("Free space: %s") % formatSize(spaceLeft)) |