Exemplo n.º 1
0
        def save(self, skipshow, skipmovie):
            # Set skip variables
            autosubliminal.SKIPSHOW = config.string_to_dict(skipshow)
            autosubliminal.SKIPMOVIE = config.string_to_dict(skipmovie)

            # Now save to the configfile and restart if needed
            return Config.save_and_restart_if_needed(self.tmpl_file)
Exemplo n.º 2
0
        def save(self, skipshow, skipmovie):
            # Set skip variables
            autosubliminal.SKIPSHOW = config.string_to_dict(skipshow)
            autosubliminal.SKIPMOVIE = config.string_to_dict(skipmovie)

            # Now save to the configfile and restart if needed
            return Config.save_and_restart_if_needed(self.tmpl_file)
Exemplo n.º 3
0
        def save(self, usershownamemapping, usermovienamemapping):
            # Set usernamemapping variables
            autosubliminal.USERSHOWNAMEMAPPING = config.string_to_dict(usershownamemapping)
            autosubliminal.USERMOVIENAMEMAPPING = config.string_to_dict(usermovienamemapping)

            # Now save to the configfile and restart if needed
            return Config.save_and_restart_if_needed(self.tmpl_file)
Exemplo n.º 4
0
        def save(self, usershownamemapping, usermovienamemapping):
            # Set usernamemapping variables
            autosubliminal.USERSHOWNAMEMAPPING = config.string_to_dict(
                usershownamemapping)
            autosubliminal.USERMOVIENAMEMAPPING = config.string_to_dict(
                usermovienamemapping)

            # Now save to the configfile and restart if needed
            return Config.save_and_restart_if_needed(self.tmpl_file)
Exemplo n.º 5
0
    def save_config(self, subeng, checksub, scandisk, skiphiddendirs, subnl, postprocesscmd, path, logfile, videopaths,
                    launchbrowser, fallbacktoeng, downloadeng, username, password, webroot, skipshow, lognum,
                    loglevelconsole, logsize, loglevel, loghttpaccess, logreversed, webserverip, webserverport, usernamemapping,
                    notifymail, notifygrowl, notifynma, notifytwitter, mailsrv, mailfromaddr, mailtoaddr, mailusername,
                    mailpassword, mailsubject, mailencryption, mailauth, growlhost, growlport, growlpass, nmaapi,
                    twitterkey, twittersecret, notifyen, notifynl,
                    notifyprowl, prowlapi, prowlpriority, notifypushalot, pushalotapi,
                    mmsdefault=None, mmsquality=None, mmscodec=None, mmsreleasegroup=None,
                    subliminalproviders=None):
        # Set all internal variables
        autosubliminal.PATH = path
        autosubliminal.VIDEOPATHS = videopaths.split('\r\n')
        autosubliminal.LOGFILE = logfile
        autosubliminal.LOGHTTPACCESS = loghttpaccess
        autosubliminal.LOGREVERSED = logreversed
        autosubliminal.FALLBACKTOENG = fallbacktoeng
        autosubliminal.DOWNLOADENG = downloadeng
        autosubliminal.SUBENG = subeng
        autosubliminal.SUBNL = subnl
        autosubliminal.NOTIFYEN = notifyen
        autosubliminal.NOTIFYNL = notifynl
        autosubliminal.POSTPROCESSCMD = postprocesscmd
        autosubliminal.LAUNCHBROWSER = launchbrowser
        autosubliminal.SKIPHIDDENDIRS = skiphiddendirs

        # Set match options and minmatchscore
        autosubliminal.MATCHQUALITY = False
        autosubliminal.MATCHCODEC = False
        autosubliminal.MATCHRELEASEGROUP = False
        autosubliminal.MINMATCHSCORE = 0
        # If not checked, the value will be default None, if checked, it will contain a value
        if mmsdefault:
            # mmsdefault is the minimal default score (which cannot be edited, so no flag is needed)
            autosubliminal.MINMATCHSCORE += autosubliminal.MINMATCHSCOREDEFAULT
        if mmsquality:
            autosubliminal.MINMATCHSCORE += 2
            autosubliminal.MATCHQUALITY = True
        if mmscodec:
            autosubliminal.MINMATCHSCORE += 2
            autosubliminal.MATCHCODEC = True
        if mmsreleasegroup:
            autosubliminal.MINMATCHSCORE += 6
            autosubliminal.MATCHRELEASEGROUP = True

        # Subliminal providers(convert list to comma separated string if multiple are selected)
        if subliminalproviders and not isinstance(subliminalproviders, basestring):
            autosubliminal.SUBLIMINALPROVIDERS = ','.join([str(provider) for provider in subliminalproviders])
        else:
            # Just one selected or None (in this case, None will be saved and no providers will be used)
            autosubliminal.SUBLIMINALPROVIDERS = subliminalproviders

        autosubliminal.SCHEDULERSCANDISK = int(scandisk)
        autosubliminal.SCHEDULERCHECKSUB = int(checksub)
        autosubliminal.LOGLEVEL = int(loglevel)
        autosubliminal.LOGNUM = int(lognum)
        autosubliminal.LOGSIZE = int(logsize)
        autosubliminal.LOGLEVELCONSOLE = int(loglevelconsole)
        autosubliminal.WEBSERVERIP = webserverip
        autosubliminal.WEBSERVERPORT = int(webserverport)
        autosubliminal.USERNAME = username
        autosubliminal.PASSWORD = password
        autosubliminal.WEBROOT = webroot
        autosubliminal.SKIPSHOW = config.string_to_dict(skipshow)
        autosubliminal.USERNAMEMAPPING = config.string_to_dict(usernamemapping)

        # Set all internal notify variables
        autosubliminal.NOTIFYMAIL = notifymail
        autosubliminal.MAILSRV = mailsrv
        autosubliminal.MAILFROMADDR = mailfromaddr
        autosubliminal.MAILTOADDR = mailtoaddr
        autosubliminal.MAILUSERNAME = mailusername
        autosubliminal.MAILPASSWORD = mailpassword
        autosubliminal.MAILSUBJECT = mailsubject
        autosubliminal.MAILENCRYPTION = mailencryption
        autosubliminal.MAILAUTH = mailauth
        autosubliminal.NOTIFYGROWL = notifygrowl
        autosubliminal.GROWLHOST = growlhost
        autosubliminal.GROWLPORT = growlport
        autosubliminal.GROWLPASS = growlpass
        autosubliminal.NOTIFYNMA = notifynma
        autosubliminal.NMAAPI = nmaapi
        autosubliminal.NOTIFYTWITTER = notifytwitter
        autosubliminal.TWITTERKEY = twitterkey
        autosubliminal.TWITTERSECRET = twittersecret
        autosubliminal.NOTIFYPROWL = notifyprowl
        autosubliminal.PROWLAPI = prowlapi
        autosubliminal.PROWLPRIORITY = int(prowlpriority)
        autosubliminal.NOTIFYPUSHALOT = notifypushalot
        autosubliminal.PUSHALOTAPI = pushalotapi

        # Now save to the configfile
        restart = config.write_config()

        # Check if restart is needed
        if restart:
            # Restart the runner in the background
            threading.Thread(target=autosubliminal.runner.restart).start()
            tmpl = PageTemplate(file="interface/templates/restart.tmpl")
        else:
            # For some reason the needs to be read again, otherwise all pages get an error
            config.read_config(autosubliminal.CONFIGFILE)
            tmpl = PageTemplate(file="interface/templates/message.tmpl")
            tmpl.message = "Config saved.<br><a href='" + autosubliminal.WEBROOT + "'>Return</a>"

        return str(tmpl)