Пример #1
0
    def two(self, **kwargs):
        """ Accept server and show internal web server page """
        # Save server details
        if kwargs:
            kwargs['enable'] = 1
            sabnzbd.interface.handle_server(kwargs)

        # Create web server page
        info = self.info.copy()
        info['num'] = '» %s' % T('Step Two')
        info['number'] = 2
        info['T'] = Ttemplate

        host = cfg.cherryhost()
        info['host'] = host
        # Allow special operation if host is not one of the defaults
        if host not in ('localhost','0.0.0.0'):
            info['custom_host'] = True
        else:
            info['custom_host'] = False

        info['have_ssl'] = bool(sabnzbd.newswrapper.HAVE_SSL)
        info['enable_https'] = cfg.enable_https()
        info['autobrowser'] = cfg.autobrowser()
        info['web_user'] = cfg.username()
        info['web_pass'] = cfg.password()

        template = Template(file=os.path.join(self.__web_dir, 'two.html'),
                            searchList=[info], compilerSettings=sabnzbd.interface.DIRECTIVES)
        return template.respond()
Пример #2
0
    def three(self, **kwargs):
        """ Accept webserver parms and show Indexers page """
        if kwargs:
            if 'access' in kwargs:
                cfg.cherryhost.set(kwargs['access'])
            cfg.enable_https.set(kwargs.get('enable_https',0))
            cfg.autobrowser.set(kwargs.get('autobrowser',0))
            cfg.username.set(kwargs.get('web_user', ''))
            cfg.password.set(kwargs.get('web_pass', ''))
            if not cfg.username() or not cfg.password():
                sabnzbd.interface.set_auth(cherrypy.config)

        # Create Indexers page
        info = self.info.copy()
        info['num'] = '» %s' % T('Step Three')
        info['number'] = 3
        info['newzbin_user'] = cfg.newzbin_username()
        info['newzbin_pass'] = cfg.newzbin_password.get_stars()
        info['newzbin_bookmarks'] = cfg.newzbin_bookmarks()
        info['newzbin_url'] = cfg.newzbin_url()
        info['matrix_user'] = cfg.matrix_username()
        info['matrix_apikey'] = cfg.matrix_apikey()
        info['T'] = Ttemplate
        template = Template(file=os.path.join(self.__web_dir, 'three.html'),
                            searchList=[info], compilerSettings=sabnzbd.interface.DIRECTIVES)
        return template.respond()
Пример #3
0
    def two(self, **kwargs):
        """ Accept server and show internal web server page """
        # Save server details
        if kwargs:
            kwargs['enable'] = 1
            sabnzbd.interface.handle_server(kwargs)

        # Create web server page
        info = self.info.copy()
        info['num'] = '» %s' % T('Step Two')
        info['number'] = 2
        info['T'] = Ttemplate

        host = cfg.cherryhost()
        info['host'] = host
        # Allow special operation if host is not one of the defaults
        if host not in ('localhost', '0.0.0.0'):
            info['custom_host'] = True
        else:
            info['custom_host'] = False

        info['have_ssl'] = bool(sabnzbd.newswrapper.HAVE_SSL)
        info['enable_https'] = cfg.enable_https()
        info['autobrowser'] = cfg.autobrowser()
        info['web_user'] = cfg.username()
        info['web_pass'] = cfg.password()

        template = Template(file=os.path.join(self.__web_dir, 'two.html'),
                            searchList=[info],
                            compilerSettings=sabnzbd.interface.DIRECTIVES)
        return template.respond()
Пример #4
0
    def three(self, **kwargs):
        """ Accept webserver parms and show Indexers page """
        if kwargs:
            if 'access' in kwargs:
                cfg.cherryhost.set(kwargs['access'])
            cfg.enable_https.set(kwargs.get('enable_https', 0))
            cfg.autobrowser.set(kwargs.get('autobrowser', 0))
            cfg.username.set(kwargs.get('web_user', ''))
            cfg.password.set(kwargs.get('web_pass', ''))
            if not cfg.username() or not cfg.password():
                sabnzbd.interface.set_auth(cherrypy.config)

        config.save_config()

        # Show Restart screen
        info = self.info.copy()
        info['num'] = '» %s' % T('Step Three')
        info['number'] = 3
        info['helpuri'] = 'http://wiki.sabnzbd.org/'
        info['session'] = cfg.api_key()

        info['access_url'], info['urls'] = self.get_access_info()
        info['T'] = Ttemplate

        template = Template(file=os.path.join(self.__web_dir, 'three.html'),
                            searchList=[info],
                            compilerSettings=sabnzbd.interface.DIRECTIVES)
        return template.respond()
Пример #5
0
    def three(self, **kwargs):
        """ Accept webserver parms and show Indexers page """
        if kwargs:
            if 'access' in kwargs:
                cfg.cherryhost.set(kwargs['access'])
            cfg.enable_https.set(kwargs.get('enable_https', 0))
            cfg.autobrowser.set(kwargs.get('autobrowser', 0))
            cfg.username.set(kwargs.get('web_user', ''))
            cfg.password.set(kwargs.get('web_pass', ''))
            if not cfg.username() or not cfg.password():
                sabnzbd.interface.set_auth(cherrypy.config)

        # Create Indexers page
        info = self.info.copy()
        info['num'] = '» %s' % T('Step Three')
        info['number'] = 3
        info['newzbin_user'] = cfg.newzbin_username()
        info['newzbin_pass'] = cfg.newzbin_password.get_stars()
        info['newzbin_bookmarks'] = cfg.newzbin_bookmarks()
        info['newzbin_url'] = cfg.newzbin_url()
        info['matrix_user'] = cfg.matrix_username()
        info['matrix_apikey'] = cfg.matrix_apikey()
        info['T'] = Ttemplate
        template = Template(file=os.path.join(self.__web_dir, 'three.html'),
                            searchList=[info],
                            compilerSettings=sabnzbd.interface.DIRECTIVES)
        return template.respond()
Пример #6
0
    def three(self, **kwargs):
        """ Accept webserver parms and show Indexers page """
        if kwargs:
            if 'access' in kwargs:
                cfg.cherryhost.set(kwargs['access'])
            cfg.enable_https.set(kwargs.get('enable_https',0))
            cfg.autobrowser.set(kwargs.get('autobrowser',0))
            cfg.username.set(kwargs.get('web_user', ''))
            cfg.password.set(kwargs.get('web_pass', ''))
            if not cfg.username() or not cfg.password():
                sabnzbd.interface.set_auth(cherrypy.config)

        config.save_config()

        # Show Restart screen
        info = self.info.copy()
        info['num'] = '» %s' % T('Step Three')
        info['number'] = 3
        info['helpuri'] = 'http://wiki.sabnzbd.org/'
        info['session'] = cfg.api_key()

        info['access_url'], info['urls'] = self.get_access_info()
        info['T'] = Ttemplate

        template = Template(file=os.path.join(self.__web_dir, 'three.html'),
                            searchList=[info], compilerSettings=sabnzbd.interface.DIRECTIVES)
        return template.respond()
Пример #7
0
def upload_file_to_sabnzbd(url, fp):
    """ Function for uploading nzbs to a running SABnzbd instance """
    try:
        fp = urllib.parse.quote_plus(fp)
        url = "%s&mode=addlocalfile&name=%s" % (url, fp)
        # Add local API-key if it wasn't already in the registered URL
        apikey = cfg.api_key()
        if apikey and "apikey" not in url:
            url = "%s&apikey=%s" % (url, apikey)
        if "apikey" not in url:
            # Use alternative login method
            username = cfg.username()
            password = cfg.password()
            if username and password:
                url = "%s&ma_username=%s&ma_password=%s" % (url, username, password)
        get_from_url(url)
    except:
        logging.error(T("Failed to upload file: %s"), fp)
        logging.info("Traceback: ", exc_info=True)
Пример #8
0
def upload_file(url, fp):
    """ Function for uploading nzbs to a running sabnzbd instance """
    try:
        fp = urllib.quote_plus(fp)
        url = '%s&mode=addlocalfile&name=%s' % (url, fp)
        # Add local apikey if it wasn't already in the registered URL
        apikey = cfg.api_key()
        if apikey and 'apikey' not in url:
            url = '%s&apikey=%s' % (url, apikey)
        if 'apikey' not in url:
            # Use alternative login method
            username = cfg.username()
            password = cfg.password()
            if username and password:
                url = '%s&ma_username=%s&ma_password=%s' % (url, username, password)
        sabnzbd.newsunpack.get_from_url(url)
    except:
        logging.error("Failed to upload file: %s", fp)
        logging.info("Traceback: ", exc_info = True)
Пример #9
0
def upload_file(url, fp):
    """ Function for uploading nzbs to a running sabnzbd instance """
    try:
        fp = urllib.quote_plus(fp)
        url = '%s&mode=addlocalfile&name=%s' % (url, fp)
        # Add local apikey if it wasn't already in the registered URL
        apikey = cfg.api_key()
        if apikey and 'apikey' not in url:
            url = '%s&apikey=%s' % (url, apikey)
        if 'apikey' not in url:
            # Use alternative login method
            username = cfg.username()
            password = cfg.password()
            if username and password:
                url = '%s&ma_username=%s&ma_password=%s' % (url, username, password)
        sabnzbd.newsunpack.get_from_url(url)
    except:
        logging.error("Failed to upload file: %s", fp)
        logging.info("Traceback: ", exc_info = True)