def save(self, path, videopaths, defaultlanguage, defaultlanguagesuffix, additionallanguages, scandisk, checksub, checkversion, checkversionautoupdate, scanembeddedsubs, skiphiddendirs, minvideofilesize, maxdbresults): # Set general variables autosubliminal.PATH = path autosubliminal.VIDEOPATHS = videopaths.split('\r\n') autosubliminal.DEFAULTLANGUAGE = defaultlanguage autosubliminal.DEFAULTLANGUAGESUFFIX = utils.getboolean( defaultlanguagesuffix) autosubliminal.ADDITIONALLANGUAGES = additionallanguages.split(',') autosubliminal.SCANDISKINTERVAL = int(scandisk) autosubliminal.CHECKSUBINTERVAL = int(checksub) autosubliminal.CHECKVERSIONINTERVAL = int(checkversion) autosubliminal.CHECKVERSIONAUTOUPDATE = utils.getboolean( checkversionautoupdate) autosubliminal.SCANEMBEDDEDSUBS = utils.getboolean( scanembeddedsubs) autosubliminal.SKIPHIDDENDIRS = utils.getboolean(skiphiddendirs) autosubliminal.MINVIDEOFILESIZE = int(minvideofilesize) autosubliminal.MAXDBRESULTS = int(maxdbresults) # Now save to the configfile and restart if needed return Config.save_and_restart_if_needed(self.tmpl_file)
def test_getboolean(): assert getboolean('1') assert getboolean('yes') assert getboolean('true') assert getboolean('on') assert not getboolean('0') assert not getboolean('no') assert not getboolean('false') assert not getboolean('off') with pytest.raises(ValueError): getboolean('test')
def save(self, postprocess, postprocessutf8encoding, showpostprocesscmd, showpostprocesscmdargs, moviepostprocesscmd, moviepostprocesscmdargs): # Set postprocessing variables autosubliminal.POSTPROCESS = utils.getboolean(postprocess) autosubliminal.POSTPROCESSUTF8ENCODING = utils.getboolean(postprocessutf8encoding) autosubliminal.SHOWPOSTPROCESSCMD = showpostprocesscmd autosubliminal.SHOWPOSTPROCESSCMDARGS = showpostprocesscmdargs autosubliminal.MOVIEPOSTPROCESSCMD = moviepostprocesscmd autosubliminal.MOVIEPOSTPROCESSCMDARGS = moviepostprocesscmdargs # Now save to the configfile and restart if needed return Config.save_and_restart_if_needed(self.tmpl_file)
def save(self, postprocess, postprocessutf8encoding, showpostprocesscmd, showpostprocesscmdargs, moviepostprocesscmd, moviepostprocesscmdargs): # Set postprocessing variables autosubliminal.POSTPROCESS = utils.getboolean(postprocess) autosubliminal.POSTPROCESSUTF8ENCODING = utils.getboolean( postprocessutf8encoding) autosubliminal.SHOWPOSTPROCESSCMD = showpostprocesscmd autosubliminal.SHOWPOSTPROCESSCMDARGS = showpostprocesscmdargs autosubliminal.MOVIEPOSTPROCESSCMD = moviepostprocesscmd autosubliminal.MOVIEPOSTPROCESSCMDARGS = moviepostprocesscmdargs # Now save to the configfile and restart if needed return Config.save_and_restart_if_needed(self.tmpl_file)
def save(self, logfile, loglevel, lognum, logsize, loghttpaccess, logdetailedformat, logreversed, loglevelconsole): # Set logfile variables autosubliminal.LOGFILE = logfile autosubliminal.LOGLEVEL = int(loglevel) autosubliminal.LOGNUM = int(lognum) autosubliminal.LOGSIZE = int(logsize) autosubliminal.LOGHTTPACCESS = utils.getboolean(loghttpaccess) autosubliminal.LOGDETAILEDFORMAT = utils.getboolean(logdetailedformat) autosubliminal.LOGREVERSED = utils.getboolean(logreversed) autosubliminal.LOGLEVELCONSOLE = int(loglevelconsole) # Now save to the configfile and restart if needed return Config.save_and_restart_if_needed(self.tmpl_file)
def save(self, notify, notifymail, mailsrv, mailfromaddr, mailtoaddr, mailusername, mailpassword, mailsubject, mailencryption, mailauth, notifytwitter, twitterkey, twittersecret, notifypushalot, pushalotapi, notifypushover, pushoverkey, pushoverapi, pushoverdevices, notifynma, nmaapi, nmapriority, notifygrowl, growlhost, growlport, growlpass, growlpriority, notifyprowl, prowlapi, prowlpriority, notifypushbullet, pushbulletapi, notifytelegram, telegrambotapi, telegramchatid): # Set notify variables autosubliminal.NOTIFY = utils.getboolean(notify) autosubliminal.NOTIFYMAIL = utils.getboolean(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.NOTIFYTWITTER = utils.getboolean(notifytwitter) autosubliminal.TWITTERKEY = twitterkey autosubliminal.TWITTERSECRET = twittersecret autosubliminal.NOTIFYPUSHALOT = utils.getboolean(notifypushalot) autosubliminal.PUSHALOTAPI = pushalotapi autosubliminal.NOTIFYPUSHOVER = utils.getboolean(notifypushover) autosubliminal.PUSHOVERKEY = pushoverkey autosubliminal.PUSHOVERAPI = pushoverapi autosubliminal.PUSHOVERDEVICES = pushoverdevices autosubliminal.NOTIFYNMA = utils.getboolean(notifynma) autosubliminal.NMAAPI = nmaapi autosubliminal.NMAPRIORITY = nmapriority autosubliminal.NOTIFYGROWL = utils.getboolean(notifygrowl) autosubliminal.GROWLHOST = growlhost autosubliminal.GROWLPORT = int(growlport) autosubliminal.GROWLPASS = growlpass autosubliminal.GROWLPRIORITY = int(growlpriority) autosubliminal.NOTIFYPROWL = utils.getboolean(notifyprowl) autosubliminal.PROWLAPI = prowlapi autosubliminal.PROWLPRIORITY = int(prowlpriority) autosubliminal.NOTIFYPUSHBULLET = utils.getboolean( notifypushbullet) autosubliminal.PUSHBULLETAPI = pushbulletapi autosubliminal.NOTIFYTELEGRAM = utils.getboolean(notifytelegram) autosubliminal.TELEGRAMBOTAPI = telegrambotapi autosubliminal.TELEGRAMCHATID = telegramchatid # Now save to the configfile and restart if needed return Config.save_and_restart_if_needed(self.section)
def save(self, logfile, loglevel, lognum, logsize, loghttpaccess, logdetailedformat, logreversed, loglevelconsole): # Set logfile variables autosubliminal.LOGFILE = logfile autosubliminal.LOGLEVEL = int(loglevel) autosubliminal.LOGNUM = int(lognum) autosubliminal.LOGSIZE = int(logsize) autosubliminal.LOGHTTPACCESS = utils.getboolean(loghttpaccess) autosubliminal.LOGDETAILEDFORMAT = utils.getboolean( logdetailedformat) autosubliminal.LOGREVERSED = utils.getboolean(logreversed) autosubliminal.LOGLEVELCONSOLE = int(loglevelconsole) # Now save to the configfile and restart if needed return Config.save_and_restart_if_needed(self.tmpl_file)
def save(self, webserverip, webserverport, webroot, username, password, launchbrowser): # Set webserver variables autosubliminal.WEBSERVERIP = webserverip autosubliminal.WEBSERVERPORT = int(webserverport) autosubliminal.WEBROOT = webroot autosubliminal.USERNAME = username autosubliminal.PASSWORD = password autosubliminal.LAUNCHBROWSER = utils.getboolean(launchbrowser) # Now save to the configfile and restart if needed return Config.save_and_restart_if_needed(self.tmpl_file)
def save(self, path, videopaths, defaultlanguage, defaultlanguagesuffix, additionallanguages, scandisk, checksub, checkversion, checkversionautoupdate, scanembeddedsubs, skiphiddendirs, minvideofilesize, maxdbresults): # Set general variables autosubliminal.PATH = path autosubliminal.VIDEOPATHS = videopaths.split('\r\n') autosubliminal.DEFAULTLANGUAGE = defaultlanguage autosubliminal.DEFAULTLANGUAGESUFFIX = utils.getboolean(defaultlanguagesuffix) autosubliminal.ADDITIONALLANGUAGES = additionallanguages.split(',') autosubliminal.SCANDISKINTERVAL = int(scandisk) autosubliminal.CHECKSUBINTERVAL = int(checksub) autosubliminal.CHECKVERSIONINTERVAL = int(checkversion) autosubliminal.CHECKVERSIONAUTOUPDATE = utils.getboolean(checkversionautoupdate) autosubliminal.SCANEMBEDDEDSUBS = utils.getboolean(scanembeddedsubs) autosubliminal.SKIPHIDDENDIRS = utils.getboolean(skiphiddendirs) autosubliminal.MINVIDEOFILESIZE = int(minvideofilesize) autosubliminal.MAXDBRESULTS = int(maxdbresults) # Now save to the configfile and restart if needed return Config.save_and_restart_if_needed(self.tmpl_file)
def save(self, notify, notifymail, mailsrv, mailfromaddr, mailtoaddr, mailusername, mailpassword, mailsubject, mailencryption, mailauth, notifytwitter, twitterkey, twittersecret, notifypushalot, pushalotapi, notifypushover, pushoverkey, pushoverapi, pushoverdevices, notifynma, nmaapi, notifygrowl, growlhost, growlport, growlpass, notifyprowl, prowlapi, prowlpriority, notifypushbullet, pushbulletapi): # Set notify variables autosubliminal.NOTIFY = utils.getboolean(notify) autosubliminal.NOTIFYMAIL = utils.getboolean(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.NOTIFYTWITTER = utils.getboolean(notifytwitter) autosubliminal.TWITTERKEY = twitterkey autosubliminal.TWITTERSECRET = twittersecret autosubliminal.NOTIFYPUSHALOT = utils.getboolean(notifypushalot) autosubliminal.PUSHALOTAPI = pushalotapi autosubliminal.NOTIFYPUSHOVER = utils.getboolean(notifypushover) autosubliminal.PUSHOVERKEY = pushoverkey autosubliminal.PUSHOVERAPI = pushoverapi autosubliminal.PUSHOVERDEVICES = pushoverdevices autosubliminal.NOTIFYNMA = utils.getboolean(notifynma) autosubliminal.NMAAPI = nmaapi autosubliminal.NOTIFYGROWL = utils.getboolean(notifygrowl) autosubliminal.GROWLHOST = growlhost autosubliminal.GROWLPORT = growlport autosubliminal.GROWLPASS = growlpass autosubliminal.NOTIFYPROWL = utils.getboolean(notifyprowl) autosubliminal.PROWLAPI = prowlapi autosubliminal.PROWLPRIORITY = int(prowlpriority) autosubliminal.NOTIFYPUSHBULLET = utils.getboolean(notifypushbullet) autosubliminal.PUSHBULLETAPI = pushbulletapi # Now save to the configfile and restart if needed return Config.save_and_restart_if_needed(self.tmpl_file)
def save(self, includehearingimpaired, addic7edusername, addic7edpassword, opensubtitlesusername, opensubtitlespassword, showmmsdefault=None, showmmssource=None, showmmsquality=None, showmmscodec=None, showmmsreleasegroup=None, moviemmsdefault=None, moviemmssource=None, moviemmsquality=None, moviemmscodec=None, moviemmsreleasegroup=None, subliminalproviders=None): # Set subliminal variables # Match options and showminmatchscore autosubliminal.SHOWMATCHSOURCE = False autosubliminal.SHOWMATCHQUALITY = False autosubliminal.SHOWMATCHCODEC = False autosubliminal.SHOWMATCHRELEASEGROUP = False autosubliminal.SHOWMINMATCHSCORE = 0 # If not checked, the value will be default None, if checked, it will contain a value if showmmsdefault: # showmmsdefault is the minimal default score for a show (not editable, so no flag is needed) autosubliminal.SHOWMINMATCHSCORE += autosubliminal.SHOWMINMATCHSCOREDEFAULT if showmmssource: autosubliminal.SHOWMINMATCHSCORE += 6 autosubliminal.SHOWMATCHSOURCE = True if showmmsquality: autosubliminal.SHOWMINMATCHSCORE += 4 autosubliminal.SHOWMATCHQUALITY = True if showmmscodec: autosubliminal.SHOWMINMATCHSCORE += 4 autosubliminal.SHOWMATCHCODEC = True if showmmsreleasegroup: autosubliminal.SHOWMINMATCHSCORE += 11 autosubliminal.SHOWMATCHRELEASEGROUP = True # Match options and movieminmatchscore autosubliminal.MOVIEMATCHSOURCE = False autosubliminal.MOVIEMATCHQUALITY = False autosubliminal.MOVIEMATCHCODEC = False autosubliminal.MOVIEMATCHRELEASEGROUP = False autosubliminal.MOVIEMINMATCHSCORE = 0 # If not checked, the value will be default None, if checked, it will contain a value if moviemmsdefault: # moviemmsdefault is the minimal default score for a movie (not editable, so no flag is needed) autosubliminal.MOVIEMINMATCHSCORE += autosubliminal.MOVIEMINMATCHSCOREDEFAULT if moviemmssource: autosubliminal.MOVIEMINMATCHSCORE += 6 autosubliminal.MOVIEMATCHSOURCE = True if moviemmsquality: autosubliminal.MOVIEMINMATCHSCORE += 4 autosubliminal.MOVIEMATCHQUALITY = True if moviemmscodec: autosubliminal.MOVIEMINMATCHSCORE += 4 autosubliminal.MOVIEMATCHCODEC = True if moviemmsreleasegroup: autosubliminal.MOVIEMINMATCHSCORE += 11 autosubliminal.MOVIEMATCHRELEASEGROUP = 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 # Hearing impaired autosubliminal.INCLUDEHEARINGIMPAIRED = utils.getboolean( includehearingimpaired) # Addic7ed provider autosubliminal.ADDIC7EDUSERNAME = addic7edusername autosubliminal.ADDIC7EDPASSWORD = addic7edpassword # OpenSubtitles provider autosubliminal.OPENSUBTITLESUSERNAME = opensubtitlesusername autosubliminal.OPENSUBTITLESPASSWORD = opensubtitlespassword # Now save to the configfile and restart if needed return Config.save_and_restart_if_needed(self.tmpl_file)
def save(self, subtitleutf8encoding, manualrefinevideo, refinevideo, preferhearingimpaired, addic7edusername, addic7edpassword, opensubtitlesusername, opensubtitlespassword, showmmsdefault=None, showmmssource=None, showmmsquality=None, showmmscodec=None, showmmsreleasegroup=None, moviemmsdefault=None, moviemmssource=None, moviemmsquality=None, moviemmscodec=None, moviemmsreleasegroup=None, subliminalproviders=None): # Set subliminal variables # Match options and showminmatchscore autosubliminal.SHOWMATCHSOURCE = False autosubliminal.SHOWMATCHQUALITY = False autosubliminal.SHOWMATCHCODEC = False autosubliminal.SHOWMATCHRELEASEGROUP = False autosubliminal.SHOWMINMATCHSCORE = 0 # If not checked, the value will be default None, if checked, it will contain a value if showmmsdefault: # showmmsdefault is the minimal default score for a show (not editable, so no flag is needed) autosubliminal.SHOWMINMATCHSCORE += autosubliminal.SHOWMINMATCHSCOREDEFAULT if showmmssource: autosubliminal.SHOWMINMATCHSCORE += 7 autosubliminal.SHOWMATCHSOURCE = True if showmmsquality: autosubliminal.SHOWMINMATCHSCORE += 2 autosubliminal.SHOWMATCHQUALITY = True if showmmscodec: autosubliminal.SHOWMINMATCHSCORE += 2 autosubliminal.SHOWMATCHCODEC = True if showmmsreleasegroup: autosubliminal.SHOWMINMATCHSCORE += 15 autosubliminal.SHOWMATCHRELEASEGROUP = True # Match options and movieminmatchscore autosubliminal.MOVIEMATCHSOURCE = False autosubliminal.MOVIEMATCHQUALITY = False autosubliminal.MOVIEMATCHCODEC = False autosubliminal.MOVIEMATCHRELEASEGROUP = False autosubliminal.MOVIEMINMATCHSCORE = 0 # If not checked, the value will be default None, if checked, it will contain a value if moviemmsdefault: # moviemmsdefault is the minimal default score for a movie (not editable, so no flag is needed) autosubliminal.MOVIEMINMATCHSCORE += autosubliminal.MOVIEMINMATCHSCOREDEFAULT if moviemmssource: autosubliminal.MOVIEMINMATCHSCORE += 7 autosubliminal.MOVIEMATCHSOURCE = True if moviemmsquality: autosubliminal.MOVIEMINMATCHSCORE += 2 autosubliminal.MOVIEMATCHQUALITY = True if moviemmscodec: autosubliminal.MOVIEMINMATCHSCORE += 2 autosubliminal.MOVIEMATCHCODEC = True if moviemmsreleasegroup: autosubliminal.MOVIEMINMATCHSCORE += 15 autosubliminal.MOVIEMATCHRELEASEGROUP = True # Subliminal providers if isinstance(subliminalproviders, list): autosubliminal.SUBLIMINALPROVIDERS = subliminalproviders else: autosubliminal.SUBLIMINALPROVIDERS = [ subliminalproviders ] if subliminalproviders else [] # Subtitle utf8 encoding autosubliminal.SUBTITLEUTF8ENCODING = utils.getboolean( subtitleutf8encoding) # Refine video autosubliminal.MANUALREFINEVIDEO = utils.getboolean( manualrefinevideo) autosubliminal.REFINEVIDEO = utils.getboolean(refinevideo) # Hearing impaired autosubliminal.PREFERHEARINGIMPAIRED = utils.getboolean( preferhearingimpaired) # Addic7ed provider autosubliminal.ADDIC7EDUSERNAME = addic7edusername autosubliminal.ADDIC7EDPASSWORD = addic7edpassword # OpenSubtitles provider autosubliminal.OPENSUBTITLESUSERNAME = opensubtitlesusername autosubliminal.OPENSUBTITLESPASSWORD = opensubtitlespassword # Now save to the configfile and restart if needed return Config.save_and_restart_if_needed(self.section)
def save(self, includehearingimpaired, addic7edusername, addic7edpassword, opensubtitlesusername, opensubtitlespassword, showmmsdefault=None, showmmssource=None, showmmsquality=None, showmmscodec=None, showmmsreleasegroup=None, moviemmsdefault=None, moviemmssource=None, moviemmsquality=None, moviemmscodec=None, moviemmsreleasegroup=None, subliminalproviders=None): # Set subliminal variables # Match options and showminmatchscore autosubliminal.SHOWMATCHSOURCE = False autosubliminal.SHOWMATCHQUALITY = False autosubliminal.SHOWMATCHCODEC = False autosubliminal.SHOWMATCHRELEASEGROUP = False autosubliminal.SHOWMINMATCHSCORE = 0 # If not checked, the value will be default None, if checked, it will contain a value if showmmsdefault: # showmmsdefault is the minimal default score for a show (not editable, so no flag is needed) autosubliminal.SHOWMINMATCHSCORE += autosubliminal.SHOWMINMATCHSCOREDEFAULT if showmmssource: autosubliminal.SHOWMINMATCHSCORE += 6 autosubliminal.SHOWMATCHSOURCE = True if showmmsquality: autosubliminal.SHOWMINMATCHSCORE += 4 autosubliminal.SHOWMATCHQUALITY = True if showmmscodec: autosubliminal.SHOWMINMATCHSCORE += 4 autosubliminal.SHOWMATCHCODEC = True if showmmsreleasegroup: autosubliminal.SHOWMINMATCHSCORE += 11 autosubliminal.SHOWMATCHRELEASEGROUP = True # Match options and movieminmatchscore autosubliminal.MOVIEMATCHSOURCE = False autosubliminal.MOVIEMATCHQUALITY = False autosubliminal.MOVIEMATCHCODEC = False autosubliminal.MOVIEMATCHRELEASEGROUP = False autosubliminal.MOVIEMINMATCHSCORE = 0 # If not checked, the value will be default None, if checked, it will contain a value if moviemmsdefault: # moviemmsdefault is the minimal default score for a movie (not editable, so no flag is needed) autosubliminal.MOVIEMINMATCHSCORE += autosubliminal.MOVIEMINMATCHSCOREDEFAULT if moviemmssource: autosubliminal.MOVIEMINMATCHSCORE += 6 autosubliminal.MOVIEMATCHSOURCE = True if moviemmsquality: autosubliminal.MOVIEMINMATCHSCORE += 4 autosubliminal.MOVIEMATCHQUALITY = True if moviemmscodec: autosubliminal.MOVIEMINMATCHSCORE += 4 autosubliminal.MOVIEMATCHCODEC = True if moviemmsreleasegroup: autosubliminal.MOVIEMINMATCHSCORE += 11 autosubliminal.MOVIEMATCHRELEASEGROUP = 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 # Hearing impaired autosubliminal.INCLUDEHEARINGIMPAIRED = utils.getboolean(includehearingimpaired) # Addic7ed provider autosubliminal.ADDIC7EDUSERNAME = addic7edusername autosubliminal.ADDIC7EDPASSWORD = addic7edpassword # OpenSubtitles provider autosubliminal.OPENSUBTITLESUSERNAME = opensubtitlesusername autosubliminal.OPENSUBTITLESPASSWORD = opensubtitlespassword # Now save to the configfile and restart if needed return Config.save_and_restart_if_needed(self.tmpl_file)