From d56dcab5d48c8c4ec05f200f92bd35a1f977cd4f Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 6 Jan 2010 17:38:53 +0100 Subject: cli fix, webinterface db check --- module/web/ServerThread.py | 11 +++++++++++ module/web/manage.py | 0 module/web/pyload_default.db | Bin 44032 -> 0 bytes pyLoadCli.py | 18 +++++++++++++----- pyLoadCore.py | 24 +++++++++++++----------- 5 files changed, 37 insertions(+), 16 deletions(-) mode change 100644 => 100755 module/web/manage.py delete mode 100644 module/web/pyload_default.db diff --git a/module/web/ServerThread.py b/module/web/ServerThread.py index 069cabafe..8be3892b5 100644 --- a/module/web/ServerThread.py +++ b/module/web/ServerThread.py @@ -2,6 +2,7 @@ from __future__ import with_statement import threading from os.path import join +from os.path import exists from subprocess import Popen, PIPE, STDOUT from time import sleep from signal import SIGINT @@ -18,6 +19,16 @@ class WebServer(threading.Thread): host = self.pycore.config['webinterface']['host'] port = self.pycore.config['webinterface']['port'] command = ['python',join(self.pycore.path,"module","web","manage.py"), "runserver", "%s:%s" % (host,port)] + + if not exists(join(self.pycore.path,"module","web","pyload.db")): + print "########## IMPORTANT ###########" + print "### Database for Webinterface doesnt exitst, it will not be available." + print "### Please run: python %s syncdb" % join(self.pycore.path,"module","web","manage.py") + print "### You have to add at least one User, to gain access to webinterface: python %s createsuperuser" % join(self.pycore.path,"module","web","manage.py") + print "### Dont forget to restart pyLoad if you are done." + print "################################" + raise Exception, "Database doesnt exists, please use syncdb" + self.pycore.logger.info("Starting Webserver: %s:%s" % (host,port) ) if os.name == 'posix': diff --git a/module/web/manage.py b/module/web/manage.py old mode 100644 new mode 100755 diff --git a/module/web/pyload_default.db b/module/web/pyload_default.db deleted file mode 100644 index cd39d0ca8..000000000 Binary files a/module/web/pyload_default.db and /dev/null differ diff --git a/pyLoadCli.py b/pyLoadCli.py index b97a1c7eb..18efa7272 100755 --- a/pyLoadCli.py +++ b/pyLoadCli.py @@ -455,12 +455,20 @@ if __name__ == "__main__": ) else: - username = raw_input("Username:") - address = raw_input("Adress:") - port = raw_input("Port:") - password = raw_input("Password:") + username = raw_input("Username: ") + address = raw_input("Adress: ") + port = raw_input("Port: ") + ssl = raw_input("Use SSL? (y/[n])") + if ssl == "y": + ssl = "s" + else: + ssl = "" + + from getpass import getpass + password = getpass("Password: ") - server_url = "http://%s:%s@%s:%s/" % ( + server_url = "http%s://%s:%s@%s:%s/" % ( + ssl, username, password, address, diff --git a/pyLoadCore.py b/pyLoadCore.py index a5521cd70..c43fac3c8 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -30,13 +30,14 @@ import logging import logging.handlers from os import listdir from os import makedirs -from os import sep +from os import sep from os.path import basename from os.path import abspath from os.path import dirname from os.path import exists from os.path import join -from os import execv +from os import execv +from sys import stdin from re import sub import subprocess from sys import argv @@ -66,9 +67,11 @@ class Core(object): """ pyLoad Core """ def __init__(self): if len(argv) > 1: - if argv[1] == "-v": - print "pyLoad", CURRENT_VERSION - exit() + if argv[1] == "-v" or argv[1] == "--version": + print "pyLoad", CURRENT_VERSION + else: + print "Unknown Command" + exit() def toggle_pause(self): if self.thread_list.pause: @@ -133,12 +136,11 @@ class Core(object): self.last_update_check = 0 self.update_check_interval = 1800 self.update_available = self.check_update() + self.logger.info(_("Downloadtime: %s") % self.server_methods.is_time_download()) self.init_server() self.init_webserver() - - self.logger.info(_("Downloadtime: %s") % self.server_methods.is_time_download()) linkFile = self.config['general']['link_file'] packs = self.server_methods.get_queue() @@ -191,10 +193,10 @@ class Core(object): def init_webserver(self): - pyloadDBFile = join(self.path, "module", "web", "pyload.db") - pyloadDefaultDBFile = join(self.path, "module", "web", "pyload_default.db") - if not exists(pyloadDBFile): - copyfile(pyloadDefaultDBFile, pyloadDBFile) + #pyloadDBFile = join(self.path, "module", "web", "pyload.db") + #pyloadDefaultDBFile = join(self.path, "module", "web", "pyload_default.db") + #if not exists(pyloadDBFile): + # copyfile(pyloadDefaultDBFile, pyloadDBFile) if self.config['webinterface']['activated']: self.webserver = WebServer(self) self.webserver.start() -- cgit v1.2.3