def set_user(self): load_translation("setup", self.config.get("general", "language")) from pyload.database import DatabaseBackend db = DatabaseBackend(None) db.setup() noaction = True try: while True: print _("Select action") print _("1 - Create/Edit user") print _("2 - List users") print _("3 - Remove user") print _("4 - Quit") action = raw_input("1/2/3/4: ") if not action in ("1", "2", "3", "4"): continue elif action == "1": print username = self.ask(_("Username"), "User") password = self.ask("", "", password=True) db.addUser(username, password) noaction = False elif action == "2": print print _("Users") print "-----" users = db.listUsers() noaction = False for user in users: print user print "-----" print elif action == "3": print username = self.ask(_("Username"), "") if username: db.removeUser(username) noaction = False elif action == "4": break finally: if not noaction: db.shutdown()
def start(self): print langs = sorted(self.config.getMetaData("general", "language")['type'].split(";")) self.lang = self.ask(u"Choose setup language", "en", langs) load_translation("setup", self.lang) # Input shorthand for yes self.yes = _("y") # Input shorthand for no self.no = _("n") # print # print _("Would you like to configure pyLoad via Webinterface?") # print _("You need a Browser and a connection to this PC for it.") # viaweb = self.ask(_("Start initial webinterface for configuration?"), "y", bool=True) # ... print print print _("## Welcome to the pyLoad Configuration Assistant ##") print print _("It will check your system and make a basic setup in order to run pyLoad.") print print _("The value in brackets [] always is the default value,") print _("in case you don't want to change it or you are unsure what to choose, just hit enter.") print _( "Don't forget: You can always rerun this assistant with --setup or -s parameter, when you start pyload.py .") print _("If you have any problems with this assistant hit STRG-C,") print _("to abort and don't let him start with pyload.py automatically anymore.") print print raw_input(_("When you are ready for system check, hit enter.")) print print basic, ssl, captcha, web, js = self.system_check() print print if not basic: print _("You need pycurl, sqlite and python 2.5, 2.6 or 2.7 to run pyLoad.") print _("Please correct this and re-run pyLoad.") print print _("Setup will now close.") print print raw_input(_("Press Enter to exit.")) return False raw_input(_("System check finished, hit enter to see your status report.")) print print print _("## Status ##") print avail = [] if self.check_module("Crypto"): avail.append(_("- container decrypting")) if ssl: avail.append(_("- ssl connection")) if captcha: avail.append(_("- automatic captcha decryption")) if web: avail.append(_("- webinterface")) if js: avail.append(_("- extended Click'N'Load")) if avail: print _("AVAILABLE FEATURES:") for feature in avail: print feature print if len(avail) < 5: print _("MISSING FEATURES:") if not self.check_module("Crypto"): print _("- no py-crypto available") print _("You need this if you want to decrypt container files.") print if not ssl: print _("- no SSL available") print _("This is needed if you want to establish a secure connection to core or webinterface.") print _("If you only want to access locally to pyLoad ssl is not usefull.") print if not captcha: print _("- no Captcha Recognition available") print _("Only needed for some hosters and as freeuser.") print if not js: print _("- no JavaScript engine found") print _("You will need this for some Click'N'Load links. Install Spidermonkey, ossp-js, pyv8 or rhino") print print print _("You can abort the setup now and fix some dependicies if you want.") else: print _("NO MISSING FEATURES!") print print con = self.ask(_("Continue with setup?"), self.yes, bool=True) if not con: return False print print print _("CURRENT CONFIG PATH: %s") % configdir print print _("NOTE: If you use pyLoad on a server or the home partition lives on an iternal flash it may be a good idea to change it.") confpath = self.ask(_("Do you want to change the config path?"), self.no, bool=True) if confpath: print self.conf_path() print print print _("Do you want to configure login data and basic settings?") print _("This is recommend for first run.") con = self.ask(_("Make basic setup?"), self.yes, bool=True) if con: print print self.conf_basic() if ssl: print print _("Do you want to configure ssl?") ssl = self.ask(_("Configure ssl?"), self.no, bool=True) if ssl: print print self.conf_ssl() if web: print print _("Do you want to configure webinterface?") web = self.ask(_("Configure webinterface?"), self.yes, bool=True) if web: print print self.conf_web() print print print _("Setup finished successfully!") print print raw_input(_("Hit enter to exit and restart pyLoad.")) return True
def start(self): print langs = sorted( self.config.getMetaData("general", "language")['type'].split(";")) self.lang = self.ask(u"Choose setup language", "en", langs) load_translation("setup", self.lang) # Input shorthand for yes self.yes = _("y") # Input shorthand for no self.no = _("n") # print # print _("Would you like to configure pyLoad via Webinterface?") # print _("You need a Browser and a connection to this PC for it.") # viaweb = self.ask(_("Start initial webinterface for configuration?"), "y", bool=True) # ... print print print _("## Welcome to the pyLoad Configuration Assistant ##") print print _( "It will check your system and make a basic setup in order to run pyLoad." ) print print _("The value in brackets [] always is the default value,") print _( "in case you don't want to change it or you are unsure what to choose, just hit enter." ) print _( "Don't forget: You can always rerun this assistant with --setup or -s parameter, when you start pyload.py ." ) print _("If you have any problems with this assistant hit STRG-C,") print _( "to abort and don't let him start with pyload.py automatically anymore." ) print print raw_input(_("When you are ready for system check, hit enter.")) print print basic, ssl, captcha, web, js = self.system_check() print print if not basic: print _( "You need pycurl, sqlite and python 2.5, 2.6 or 2.7 to run pyLoad." ) print _("Please correct this and re-run pyLoad.") print print _("Setup will now close.") print print raw_input(_("Press Enter to exit.")) return False raw_input( _("System check finished, hit enter to see your status report.")) print print print _("## Status ##") print avail = [] if self.check_module("Crypto"): avail.append(_("- container decrypting")) if ssl: avail.append(_("- ssl connection")) if captcha: avail.append(_("- automatic captcha decryption")) if web: avail.append(_("- webinterface")) if js: avail.append(_("- extended Click'N'Load")) if avail: print _("AVAILABLE FEATURES:") for feature in avail: print feature print if len(avail) < 5: print _("MISSING FEATURES:") if not self.check_module("Crypto"): print _("- no py-crypto available") print _( "You need this if you want to decrypt container files.") print if not ssl: print _("- no SSL available") print _( "This is needed if you want to establish a secure connection to core or webinterface." ) print _( "If you only want to access locally to pyLoad ssl is not usefull." ) print if not captcha: print _("- no Captcha Recognition available") print _("Only needed for some hosters and as freeuser.") print if not js: print _("- no JavaScript engine found") print _( "You will need this for some Click'N'Load links. Install Spidermonkey, ossp-js, pyv8 or rhino" ) print print print _( "You can abort the setup now and fix some dependicies if you want." ) else: print _("NO MISSING FEATURES!") print print con = self.ask(_("Continue with setup?"), self.yes, bool=True) if not con: return False print print print _("CURRENT CONFIG PATH: %s") % configdir print print _( "NOTE: If you use pyLoad on a server or the home partition lives on an iternal flash it may be a good idea to change it." ) confpath = self.ask(_("Do you want to change the config path?"), self.no, bool=True) if confpath: print self.conf_path() print print print _("Do you want to configure login data and basic settings?") print _("This is recommend for first run.") con = self.ask(_("Make basic setup?"), self.yes, bool=True) if con: print print self.conf_basic() if ssl: print print _("Do you want to configure ssl?") ssl = self.ask(_("Configure ssl?"), self.no, bool=True) if ssl: print print self.conf_ssl() if web: print print _("Do you want to configure webinterface?") web = self.ask(_("Configure webinterface?"), self.yes, bool=True) if web: print print self.conf_web() print print print _("Setup finished successfully!") print print raw_input(_("Hit enter to exit and restart pyLoad.")) return True