How to use new_config method in tox

Best Python code snippet using tox_python

__init__.py

Source:__init__.py Github

copy

Full Screen

1# Author: Nic Wolfe <nic@wolfeden.ca>2# URL: http://code.google.com/p/sickbeard/3#4# This file is part of Sick Beard.5#6# Sick Beard is free software: you can redistribute it and/or modify7# it under the terms of the GNU General Public License as published by8# the Free Software Foundation, either version 3 of the License, or9# (at your option) any later version.10#11# Sick Beard is distributed in the hope that it will be useful,12# but WITHOUT ANY WARRANTY; without even the implied warranty of13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14# GNU General Public License for more details.15#16# You should have received a copy of the GNU General Public License17# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.1819from __future__ import with_statement2021import cherrypy22import webbrowser23import sqlite324import datetime25import socket26import os, sys, subprocess, re27import urllib2829from threading import Lock3031# apparently py2exe won't build these unless they're imported somewhere32from sickbeard import providers, metadata33from providers import ezrss, tvtorrents, btn, newznab, womble, thepiratebay, torrentleech, kat, publichd, iptorrents, \34 omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, nextgen, speedcd, binsearch35from sickbeard.config import CheckSection, check_setting_int, check_setting_str, ConfigMigrator363738from sickbeard import searchCurrent, searchBacklog, showUpdater, versionChecker, properFinder, autoPostProcesser, subtitles, traktWatchListChecker39from sickbeard import helpers, db, exceptions, show_queue, search_queue, scheduler40from sickbeard import logger41from sickbeard import naming4243from common import SD, SKIPPED, NAMING_REPEAT4445from sickbeard.databases import mainDB, cache_db, failed_db4647from lib.configobj import ConfigObj4849invoked_command = None5051PID = None5253CFG = None54CONFIG_FILE = None5556# This is the version of the config we EXPECT to find57CONFIG_VERSION = 55859# Default encryption version (0 for None)60ENCRYPTION_VERSION = 06162PROG_DIR = '.'63MY_FULLNAME = None64MY_NAME = None65MY_ARGS = []66SYS_ENCODING = ''67DATA_DIR = ''68CREATEPID = False69PIDFILE = ''7071DAEMON = None7273backlogSearchScheduler = None74currentSearchScheduler = None75showUpdateScheduler = None76versionCheckScheduler = None77showQueueScheduler = None78searchQueueScheduler = None79properFinderScheduler = None80autoPostProcesserScheduler = None81subtitlesFinderScheduler = None82traktWatchListCheckerSchedular = None8384showList = None85loadingShowList = None8687providerList = []88newznabProviderList = []89torrentRssProviderList = []90metadata_provider_dict = {}9192NEWEST_VERSION = None93NEWEST_VERSION_STRING = None94VERSION_NOTIFY = None9596INIT_LOCK = Lock()97__INITIALIZED__ = False98started = False99100ACTUAL_LOG_DIR = None101LOG_DIR = None102103SOCKET_TIMEOUT = None104105WEB_PORT = None106WEB_LOG = None107WEB_ROOT = None108WEB_USERNAME = None109WEB_PASSWORD = None110WEB_HOST = None111WEB_IPV6 = None112113LOCALHOST_IP = None114ANON_REDIRECT = None115116USE_API = False117API_KEY = None118119ENABLE_HTTPS = False120HTTPS_CERT = None121HTTPS_KEY = None122123LAUNCH_BROWSER = None124CACHE_DIR = None125ACTUAL_CACHE_DIR = None126ROOT_DIRS = None127UPDATE_SHOWS_ON_START = None128SORT_ARTICLE = None129130USE_LISTVIEW = None131METADATA_XBMC = None132METADATA_XBMC_12PLUS = None133METADATA_MEDIABROWSER = None134METADATA_PS3 = None135METADATA_WDTV = None136METADATA_TIVO = None137METADATA_MEDE8ER = None138139QUALITY_DEFAULT = None140STATUS_DEFAULT = None141FLATTEN_FOLDERS_DEFAULT = None142SUBTITLES_DEFAULT = None143PROVIDER_ORDER = []144145NAMING_MULTI_EP = None146NAMING_PATTERN = None147NAMING_ABD_PATTERN = None148NAMING_CUSTOM_ABD = None149NAMING_FORCE_FOLDERS = False150NAMING_STRIP_YEAR = None151152TVDB_API_KEY = '9DAF49C96CBF8DAC'153TVDB_BASE_URL = None154TVDB_API_PARMS = {}155156USE_NZBS = None157USE_TORRENTS = None158159NZB_METHOD = None160NZB_DIR = None161USENET_RETENTION = None162TORRENT_METHOD = None163TORRENT_DIR = None164DOWNLOAD_PROPERS = None165ALLOW_HIGH_PRIORITY = None166167SEARCH_FREQUENCY = None168BACKLOG_SEARCH_FREQUENCY = 21169170MIN_SEARCH_FREQUENCY = 10171172DEFAULT_SEARCH_FREQUENCY = 40173174EZRSS = False175176TVTORRENTS = False177TVTORRENTS_DIGEST = None178TVTORRENTS_HASH = None179180TORRENTLEECH = False181TORRENTLEECH_KEY = None182183BTN = False184BTN_API_KEY = None185186NEWZNAB_DATA = None187188THEPIRATEBAY = False189THEPIRATEBAY_TRUSTED = False190THEPIRATEBAY_PROXY = False191THEPIRATEBAY_PROXY_URL = None192THEPIRATEBAY_BLACKLIST = None193194TORRENTLEECH = False195TORRENTLEECH_USERNAME = None196TORRENTLEECH_PASSWORD = None197198IPTORRENTS = False199IPTORRENTS_USERNAME = None200IPTORRENTS_PASSWORD = None201IPTORRENTS_FREELEECH = False202203NEXTGEN = False204NEXTGEN_USERNAME = None205NEXTGEN_PASSWORD = None206NEXTGEN_FREELEECH = False207208KAT = None209KAT_VERIFIED = False210211PUBLICHD = None212213SCC = False 214SCC_USERNAME = None 215SCC_PASSWORD = None216217HDTORRENTS = False218HDTORRENTS_USERNAME = None219HDTORRENTS_PASSWORD = None220HDTORRENTS_UID = None221HDTORRENTS_HASH = None222223TORRENTDAY = None224TORRENTDAY_USERNAME = None225TORRENTDAY_PASSWORD = None226TORRENTDAY_UID = None227TORRENTDAY_HASH = None228TORRENTDAY_FREELEECH = None229230HDBITS = False231HDBITS_USERNAME = None232HDBITS_PASSKEY = None233234SPEEDCD = False235SPEEDCD_USERNAME = None236SPEEDCD_PASSWORD = None237SPEEDCD_FREELEECH = None238239BINSEARCH = False240BINSEARCH_MAX = None241BINSEARCH_ALT = None242243ADD_SHOWS_WO_DIR = None244CREATE_MISSING_SHOW_DIRS = None245RENAME_EPISODES = False246PROCESS_AUTOMATICALLY = False247KEEP_PROCESSED_DIR = False248PROCESS_METHOD = None249MOVE_ASSOCIATED_FILES = False250TV_DOWNLOAD_DIR = None251UNPACK = False252253NZBS = False254NZBS_UID = None255NZBS_HASH = None256257WOMBLE = False258259OMGWTFNZBS = False260OMGWTFNZBS_USERNAME = None261OMGWTFNZBS_APIKEY = None262263NEWZBIN = False264NEWZBIN_USERNAME = None265NEWZBIN_PASSWORD = None266267SAB_USERNAME = None268SAB_PASSWORD = None269SAB_APIKEY = None270SAB_CATEGORY = None271SAB_HOST = ''272273NZBGET_USERNAME = None 274NZBGET_PASSWORD = None275NZBGET_CATEGORY = None276NZBGET_HOST = None277NZBGET_USE_HTTPS = False278279TORRENT_USERNAME = None280TORRENT_PASSWORD = None281TORRENT_HOST = ''282TORRENT_PATH = ''283TORRENT_RATIO = ''284TORRENT_PAUSED = False285TORRENT_HIGH_BANDWIDTH = False286TORRENT_LABEL = ''287288USE_XBMC = False289XBMC_NOTIFY_ONSNATCH = False290XBMC_NOTIFY_ONDOWNLOAD = False291XBMC_NOTIFY_ONSUBTITLEDOWNLOAD = False292XBMC_UPDATE_LIBRARY = False293XBMC_UPDATE_FULL = False294XBMC_UPDATE_ONLYFIRST = False295XBMC_HOST = ''296XBMC_USERNAME = None297XBMC_PASSWORD = None298299USE_PLEX = False300PLEX_NOTIFY_ONSNATCH = False301PLEX_NOTIFY_ONDOWNLOAD = False302PLEX_NOTIFY_ONSUBTITLEDOWNLOAD = False303PLEX_UPDATE_LIBRARY = False304PLEX_SERVER_HOST = None305PLEX_HOST = None306PLEX_USERNAME = None307PLEX_PASSWORD = None308309USE_GROWL = False310GROWL_NOTIFY_ONSNATCH = False311GROWL_NOTIFY_ONDOWNLOAD = False312GROWL_NOTIFY_ONSUBTITLEDOWNLOAD = False313GROWL_HOST = ''314GROWL_PASSWORD = None315316USE_PROWL = False317PROWL_NOTIFY_ONSNATCH = False318PROWL_NOTIFY_ONDOWNLOAD = False319PROWL_NOTIFY_ONSUBTITLEDOWNLOAD = False320PROWL_API = None321PROWL_PRIORITY = 0322323USE_TWITTER = False324TWITTER_NOTIFY_ONSNATCH = False325TWITTER_NOTIFY_ONDOWNLOAD = False326TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD = False327TWITTER_USERNAME = None328TWITTER_PASSWORD = None329TWITTER_PREFIX = None330331USE_BOXCAR = False332BOXCAR_NOTIFY_ONSNATCH = False333BOXCAR_NOTIFY_ONDOWNLOAD = False334BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD = False335BOXCAR_USERNAME = None336BOXCAR_PASSWORD = None337BOXCAR_PREFIX = None338339USE_PUSHOVER = False340PUSHOVER_NOTIFY_ONSNATCH = False341PUSHOVER_NOTIFY_ONDOWNLOAD = False342PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD = False343PUSHOVER_USERKEY = None344345USE_LIBNOTIFY = False346LIBNOTIFY_NOTIFY_ONSNATCH = False347LIBNOTIFY_NOTIFY_ONDOWNLOAD = False348LIBNOTIFY_NOTIFY_ONSUBTITLEDOWNLOAD = False349350USE_NMJ = False351NMJ_HOST = None352NMJ_DATABASE = None353NMJ_MOUNT = None354355USE_SYNOINDEX = False356357USE_NMJv2 = False358NMJv2_HOST = None359NMJv2_DATABASE = None360NMJv2_DBLOC = None361362USE_SYNOLOGYNOTIFIER = False363SYNOLOGYNOTIFIER_NOTIFY_ONSNATCH = False364SYNOLOGYNOTIFIER_NOTIFY_ONDOWNLOAD = False365SYNOLOGYNOTIFIER_NOTIFY_ONSUBTITLEDOWNLOAD = False366367USE_TRAKT = False368TRAKT_USERNAME = None369TRAKT_PASSWORD = None370TRAKT_API = ''371TRAKT_REMOVE_WATCHLIST = False372TRAKT_USE_WATCHLIST = False373TRAKT_METHOD_ADD = 0374TRAKT_START_PAUSED = False375376USE_PYTIVO = False377PYTIVO_NOTIFY_ONSNATCH = False378PYTIVO_NOTIFY_ONDOWNLOAD = False379PYTIVO_NOTIFY_ONSUBTITLEDOWNLOAD = False380PYTIVO_UPDATE_LIBRARY = False381PYTIVO_HOST = ''382PYTIVO_SHARE_NAME = ''383PYTIVO_TIVO_NAME = ''384385USE_NMA = False386NMA_NOTIFY_ONSNATCH = False387NMA_NOTIFY_ONDOWNLOAD = False388NMA_NOTIFY_ONSUBTITLEDOWNLOAD = False389NMA_API = None390NMA_PRIORITY = 0391392USE_PUSHALOT = False393PUSHALOT_NOTIFY_ONSNATCH = False394PUSHALOT_NOTIFY_ONDOWNLOAD = False395PUSHALOT_NOTIFY_ONSUBTITLEDOWNLOAD = False396PUSHALOT_AUTHORIZATIONTOKEN = None397398USE_PUSHBULLET = False399PUSHBULLET_NOTIFY_ONSNATCH = False400PUSHBULLET_NOTIFY_ONDOWNLOAD = False401PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD = False402PUSHBULLET_API = None403PUSHBULLET_DEVICE = None404405USE_EMAIL = False406EMAIL_NOTIFY_ONSNATCH = False407EMAIL_NOTIFY_ONDOWNLOAD = False408EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD = False409EMAIL_HOST = None410EMAIL_PORT = 25411EMAIL_TLS = False412EMAIL_USER = None413EMAIL_PASSWORD = None414EMAIL_FROM = None415EMAIL_LIST = None416417GUI_NAME = None418HOME_LAYOUT = None419HISTORY_LAYOUT = None420DISPLAY_SHOW_SPECIALS = None421COMING_EPS_LAYOUT = None422COMING_EPS_DISPLAY_PAUSED = None423COMING_EPS_SORT = None424COMING_EPS_MISSED_RANGE = None425DATE_PRESET = None426TIME_PRESET = None427TIME_PRESET_W_SECONDS = None428429430USE_SUBTITLES = False431SUBTITLES_LANGUAGES = []432SUBTITLES_DIR = ''433SUBTITLES_SERVICES_LIST = []434SUBTITLES_SERVICES_ENABLED = []435SUBTITLES_HISTORY = False436SUBTITLES_FINDER_FREQUENCY = 1437438USE_FAILED_DOWNLOADS = False439DELETE_FAILED = False440441EXTRA_SCRIPTS = []442443GIT_PATH = None444445IGNORE_WORDS = "german,french,core2hd,dutch,swedish,reenc,MrLss"446447CALENDAR_PROTECTED = False448449__INITIALIZED__ = False450451def get_backlog_cycle_time():452 cycletime = SEARCH_FREQUENCY*2+7453 return max([cycletime, 720])454455def initialize(consoleLogging=True):456457 with INIT_LOCK:458459 global ACTUAL_LOG_DIR, LOG_DIR, WEB_PORT, WEB_LOG, ENCRYPTION_VERSION, WEB_ROOT, WEB_USERNAME, WEB_PASSWORD, WEB_HOST, WEB_IPV6, USE_API, API_KEY, ENABLE_HTTPS, HTTPS_CERT, HTTPS_KEY, \460 USE_NZBS, USE_TORRENTS, NZB_METHOD, NZB_DIR, DOWNLOAD_PROPERS, ALLOW_HIGH_PRIORITY, TORRENT_METHOD, \461 SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, SAB_HOST, \462 NZBGET_USERNAME, NZBGET_PASSWORD, NZBGET_CATEGORY, NZBGET_HOST, NZBGET_USE_HTTPS, currentSearchScheduler, backlogSearchScheduler, \463 TORRENT_USERNAME, TORRENT_PASSWORD, TORRENT_HOST, TORRENT_PATH, TORRENT_RATIO, TORRENT_PAUSED, TORRENT_HIGH_BANDWIDTH, TORRENT_LABEL, \464 USE_XBMC, XBMC_NOTIFY_ONSNATCH, XBMC_NOTIFY_ONDOWNLOAD, XBMC_NOTIFY_ONSUBTITLEDOWNLOAD, XBMC_UPDATE_FULL, XBMC_UPDATE_ONLYFIRST, \465 XBMC_UPDATE_LIBRARY, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, \466 USE_TRAKT, TRAKT_USERNAME, TRAKT_PASSWORD, TRAKT_API, TRAKT_REMOVE_WATCHLIST, TRAKT_USE_WATCHLIST, TRAKT_METHOD_ADD, TRAKT_START_PAUSED, traktWatchListCheckerSchedular, \467 USE_PLEX, PLEX_NOTIFY_ONSNATCH, PLEX_NOTIFY_ONDOWNLOAD, PLEX_NOTIFY_ONSUBTITLEDOWNLOAD, PLEX_UPDATE_LIBRARY, \468 PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, \469 showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, UPDATE_SHOWS_ON_START, SORT_ARTICLE, showList, loadingShowList, \470 NEWZNAB_DATA, NZBS, NZBS_UID, NZBS_HASH, EZRSS, TVTORRENTS, TVTORRENTS_DIGEST, TVTORRENTS_HASH, TVTORRENTS_OPTIONS, BTN, BTN_API_KEY, BTN_OPTIONS, \471 THEPIRATEBAY, THEPIRATEBAY_TRUSTED, THEPIRATEBAY_PROXY, THEPIRATEBAY_PROXY_URL, THEPIRATEBAY_BLACKLIST, THEPIRATEBAY_OPTIONS, TORRENTLEECH, TORRENTLEECH_USERNAME, TORRENTLEECH_PASSWORD, TORRENTLEECH_OPTIONS, \472 IPTORRENTS, IPTORRENTS_USERNAME, IPTORRENTS_PASSWORD, IPTORRENTS_FREELEECH, IPTORRENTS_OPTIONS, KAT, KAT_VERIFIED, KAT_OPTIONS, PUBLICHD, PUBLICHD_OPTIONS, SCC, SCC_USERNAME, SCC_PASSWORD, SCC_OPTIONS, HDTORRENTS, HDTORRENTS_USERNAME, HDTORRENTS_PASSWORD, HDTORRENTS_UID, HDTORRENTS_HASH, HDTORRENTS_OPTIONS, TORRENTDAY, TORRENTDAY_USERNAME, TORRENTDAY_PASSWORD, TORRENTDAY_UID, TORRENTDAY_HASH, TORRENTDAY_FREELEECH, TORRENTDAY_OPTIONS, \473 HDBITS, HDBITS_USERNAME, HDBITS_PASSKEY, HDBITS_OPTIONS, TORRENT_DIR, USENET_RETENTION, SOCKET_TIMEOUT, SEARCH_FREQUENCY, DEFAULT_SEARCH_FREQUENCY, BACKLOG_SEARCH_FREQUENCY, \474 NEXTGEN, NEXTGEN_USERNAME, NEXTGEN_PASSWORD, NEXTGEN_FREELEECH, NEXTGEN_OPTIONS, SPEEDCD, SPEEDCD_USERNAME, SPEEDCD_PASSWORD, SPEEDCD_FREELEECH, BINSEARCH, BINSEARCH_MAX, BINSEARCH_ALT, \475 QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, \476 GROWL_NOTIFY_ONSNATCH, GROWL_NOTIFY_ONDOWNLOAD, GROWL_NOTIFY_ONSUBTITLEDOWNLOAD, TWITTER_NOTIFY_ONSNATCH, TWITTER_NOTIFY_ONDOWNLOAD, TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD, \477 USE_GROWL, GROWL_HOST, GROWL_PASSWORD, USE_PROWL, PROWL_NOTIFY_ONSNATCH, PROWL_NOTIFY_ONDOWNLOAD, PROWL_NOTIFY_ONSUBTITLEDOWNLOAD, PROWL_API, PROWL_PRIORITY, PROG_DIR, \478 USE_PYTIVO, PYTIVO_NOTIFY_ONSNATCH, PYTIVO_NOTIFY_ONDOWNLOAD, PYTIVO_NOTIFY_ONSUBTITLEDOWNLOAD, PYTIVO_UPDATE_LIBRARY, PYTIVO_HOST, PYTIVO_SHARE_NAME, PYTIVO_TIVO_NAME, \479 USE_NMA, NMA_NOTIFY_ONSNATCH, NMA_NOTIFY_ONDOWNLOAD, NMA_NOTIFY_ONSUBTITLEDOWNLOAD, NMA_API, NMA_PRIORITY, \480 USE_PUSHALOT, PUSHALOT_NOTIFY_ONSNATCH, PUSHALOT_NOTIFY_ONDOWNLOAD, PUSHALOT_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHALOT_AUTHORIZATIONTOKEN, \481 USE_PUSHBULLET, PUSHBULLET_NOTIFY_ONSNATCH, PUSHBULLET_NOTIFY_ONDOWNLOAD, PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHBULLET_API, PUSHBULLET_DEVICE, \482 versionCheckScheduler, VERSION_NOTIFY, PROCESS_AUTOMATICALLY, UNPACK, \483 KEEP_PROCESSED_DIR, PROCESS_METHOD, TV_DOWNLOAD_DIR, TVDB_BASE_URL, MIN_SEARCH_FREQUENCY, \484 showQueueScheduler, searchQueueScheduler, ROOT_DIRS, CACHE_DIR, ACTUAL_CACHE_DIR, TVDB_API_PARMS, \485 NAMING_PATTERN, NAMING_MULTI_EP, NAMING_FORCE_FOLDERS, NAMING_ABD_PATTERN, NAMING_CUSTOM_ABD, NAMING_STRIP_YEAR, \486 RENAME_EPISODES, properFinderScheduler, PROVIDER_ORDER, autoPostProcesserScheduler, \487 WOMBLE, OMGWTFNZBS, OMGWTFNZBS_USERNAME, OMGWTFNZBS_APIKEY, providerList, newznabProviderList, torrentRssProviderList,\488 EXTRA_SCRIPTS, USE_TWITTER, TWITTER_USERNAME, TWITTER_PASSWORD, TWITTER_PREFIX, \489 USE_BOXCAR, BOXCAR_USERNAME, BOXCAR_PASSWORD, BOXCAR_NOTIFY_ONDOWNLOAD, BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD, BOXCAR_NOTIFY_ONSNATCH, \490 USE_PUSHOVER, PUSHOVER_USERKEY, PUSHOVER_NOTIFY_ONDOWNLOAD, PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHOVER_NOTIFY_ONSNATCH, \491 USE_LIBNOTIFY, LIBNOTIFY_NOTIFY_ONSNATCH, LIBNOTIFY_NOTIFY_ONDOWNLOAD, LIBNOTIFY_NOTIFY_ONSUBTITLEDOWNLOAD, USE_NMJ, NMJ_HOST, NMJ_DATABASE, NMJ_MOUNT, USE_NMJv2, NMJv2_HOST, NMJv2_DATABASE, NMJv2_DBLOC, USE_SYNOINDEX, \492 USE_SYNOLOGYNOTIFIER, SYNOLOGYNOTIFIER_NOTIFY_ONSNATCH, SYNOLOGYNOTIFIER_NOTIFY_ONDOWNLOAD, SYNOLOGYNOTIFIER_NOTIFY_ONSUBTITLEDOWNLOAD, \493 USE_EMAIL, EMAIL_HOST, EMAIL_PORT, EMAIL_TLS, EMAIL_USER, EMAIL_PASSWORD, EMAIL_FROM, EMAIL_NOTIFY_ONSNATCH, EMAIL_NOTIFY_ONDOWNLOAD, EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD, EMAIL_LIST, \494 USE_LISTVIEW, METADATA_XBMC, METADATA_XBMC_12PLUS, METADATA_MEDIABROWSER, METADATA_PS3, metadata_provider_dict, \495 NEWZBIN, NEWZBIN_USERNAME, NEWZBIN_PASSWORD, GIT_PATH, MOVE_ASSOCIATED_FILES, \496 GUI_NAME, HOME_LAYOUT, HISTORY_LAYOUT, DISPLAY_SHOW_SPECIALS, COMING_EPS_LAYOUT, COMING_EPS_SORT, COMING_EPS_DISPLAY_PAUSED, COMING_EPS_MISSED_RANGE, DATE_PRESET, TIME_PRESET, TIME_PRESET_W_SECONDS, \497 METADATA_WDTV, METADATA_TIVO, METADATA_MEDE8ER, IGNORE_WORDS, CALENDAR_PROTECTED, CREATE_MISSING_SHOW_DIRS, \498 ADD_SHOWS_WO_DIR, USE_SUBTITLES, SUBTITLES_LANGUAGES, SUBTITLES_DIR, SUBTITLES_SERVICES_LIST, SUBTITLES_SERVICES_ENABLED, SUBTITLES_HISTORY, SUBTITLES_FINDER_FREQUENCY, subtitlesFinderScheduler, \499 USE_FAILED_DOWNLOADS, DELETE_FAILED, ANON_REDIRECT, LOCALHOST_IP500501 if __INITIALIZED__:502 return False503504 CheckSection(CFG, 'General')505 CheckSection(CFG, 'Blackhole')506 CheckSection(CFG, 'Newzbin')507 CheckSection(CFG, 'SABnzbd')508 CheckSection(CFG, 'NZBget')509 CheckSection(CFG, 'XBMC')510 CheckSection(CFG, 'PLEX')511 CheckSection(CFG, 'Growl')512 CheckSection(CFG, 'Prowl')513 CheckSection(CFG, 'Twitter')514 CheckSection(CFG, 'NMJ')515 CheckSection(CFG, 'NMJv2')516 CheckSection(CFG, 'Synology')517 CheckSection(CFG, 'SynologyNotifier')518 CheckSection(CFG, 'pyTivo')519 CheckSection(CFG, 'NMA')520 CheckSection(CFG, 'Pushalot')521 CheckSection(CFG, 'Pushbullet')522 CheckSection(CFG, 'Subtitles')523524 ACTUAL_LOG_DIR = check_setting_str(CFG, 'General', 'log_dir', 'Logs')525 # put the log dir inside the data dir, unless an absolute path526 LOG_DIR = os.path.normpath(os.path.join(DATA_DIR, ACTUAL_LOG_DIR))527 528 if not helpers.makeDir(LOG_DIR):529 logger.log(u"!!! No log folder, logging to screen only!", logger.ERROR)530 531 SOCKET_TIMEOUT = check_setting_int(CFG, 'General', 'socket_timeout', 30)532 socket.setdefaulttimeout(SOCKET_TIMEOUT)533 534 try:535 WEB_PORT = check_setting_int(CFG, 'General', 'web_port', 8081)536 except:537 WEB_PORT = 8081538539 if WEB_PORT < 21 or WEB_PORT > 65535:540 WEB_PORT = 8081541542 WEB_HOST = check_setting_str(CFG, 'General', 'web_host', '0.0.0.0')543 WEB_IPV6 = bool(check_setting_int(CFG, 'General', 'web_ipv6', 0))544 WEB_ROOT = check_setting_str(CFG, 'General', 'web_root', '').rstrip("/")545 WEB_LOG = bool(check_setting_int(CFG, 'General', 'web_log', 0))546 ENCRYPTION_VERSION = check_setting_int(CFG, 'General', 'encryption_version', 0)547 WEB_USERNAME = check_setting_str(CFG, 'General', 'web_username', '')548 WEB_PASSWORD = check_setting_str(CFG, 'General', 'web_password', '')549 LAUNCH_BROWSER = bool(check_setting_int(CFG, 'General', 'launch_browser', 1))550 551 552 LOCALHOST_IP = check_setting_str(CFG, 'General', 'localhost_ip', '')553 ANON_REDIRECT = check_setting_str(CFG, 'General', 'anon_redirect', 'http://dereferer.org/?')554 # attempt to help prevent users from breaking links by using a bad url 555 if not ANON_REDIRECT.endswith('?'):556 ANON_REDIRECT = ''557 558559 UPDATE_SHOWS_ON_START = bool(check_setting_int(CFG, 'General', 'update_shows_on_start', 0))560 SORT_ARTICLE = bool(check_setting_int(CFG, 'General', 'sort_article', 0))561562 USE_API = bool(check_setting_int(CFG, 'General', 'use_api', 0))563 API_KEY = check_setting_str(CFG, 'General', 'api_key', '')564565 ENABLE_HTTPS = bool(check_setting_int(CFG, 'General', 'enable_https', 0))566567 HTTPS_CERT = check_setting_str(CFG, 'General', 'https_cert', 'server.crt')568 HTTPS_KEY = check_setting_str(CFG, 'General', 'https_key', 'server.key')569570 ACTUAL_CACHE_DIR = check_setting_str(CFG, 'General', 'cache_dir', 'cache')571 # fix bad configs due to buggy code572 if ACTUAL_CACHE_DIR == 'None':573 ACTUAL_CACHE_DIR = 'cache'574575 # unless they specify, put the cache dir inside the data dir576 if not os.path.isabs(ACTUAL_CACHE_DIR):577 CACHE_DIR = os.path.join(DATA_DIR, ACTUAL_CACHE_DIR)578 else:579 CACHE_DIR = ACTUAL_CACHE_DIR580581 if not helpers.makeDir(CACHE_DIR):582 logger.log(u"!!! Creating local cache dir failed, using system default", logger.ERROR)583 CACHE_DIR = None584585 ROOT_DIRS = check_setting_str(CFG, 'General', 'root_dirs', '')586 if not re.match(r'\d+\|[^|]+(?:\|[^|]+)*', ROOT_DIRS):587 ROOT_DIRS = ''588589 # Set our common tvdb_api options here590 TVDB_API_PARMS = {'apikey': TVDB_API_KEY,591 'language': 'en',592 'useZip': True}593594 if CACHE_DIR:595 TVDB_API_PARMS['cache'] = os.path.join(CACHE_DIR, 'tvdb')596597 QUALITY_DEFAULT = check_setting_int(CFG, 'General', 'quality_default', SD)598 STATUS_DEFAULT = check_setting_int(CFG, 'General', 'status_default', SKIPPED)599 VERSION_NOTIFY = check_setting_int(CFG, 'General', 'version_notify', 1)600 FLATTEN_FOLDERS_DEFAULT = bool(check_setting_int(CFG, 'General', 'flatten_folders_default', 0))601602 PROVIDER_ORDER = check_setting_str(CFG, 'General', 'provider_order', '').split()603604 NAMING_PATTERN = check_setting_str(CFG, 'General', 'naming_pattern', '%SN - %Sx%0E - %EN')605 NAMING_ABD_PATTERN = check_setting_str(CFG, 'General', 'naming_abd_pattern', '%SN - %A-D - %EN')606 NAMING_CUSTOM_ABD = check_setting_int(CFG, 'General', 'naming_custom_abd', 0)607 NAMING_MULTI_EP = check_setting_int(CFG, 'General', 'naming_multi_ep', 1)608 NAMING_FORCE_FOLDERS = naming.check_force_season_folders()609 NAMING_STRIP_YEAR = bool(check_setting_int(CFG, 'General', 'naming_strip_year', 0))610611 TVDB_BASE_URL = 'http://thetvdb.com/api/' + TVDB_API_KEY612613 USE_NZBS = bool(check_setting_int(CFG, 'General', 'use_nzbs', 0))614 USE_TORRENTS = bool(check_setting_int(CFG, 'General', 'use_torrents', 1))615616 NZB_METHOD = check_setting_str(CFG, 'General', 'nzb_method', 'blackhole')617 if NZB_METHOD not in ('blackhole', 'sabnzbd', 'nzbget'):618 NZB_METHOD = 'blackhole'619620 TORRENT_METHOD = check_setting_str(CFG, 'General', 'torrent_method', 'blackhole')621 if TORRENT_METHOD not in ('blackhole', 'utorrent', 'transmission', 'deluge', 'download_station', 'rtorrent'):622 TORRENT_METHOD = 'blackhole'623624 DOWNLOAD_PROPERS = bool(check_setting_int(CFG, 'General', 'download_propers', 1))625626 ALLOW_HIGH_PRIORITY = bool(check_setting_int(CFG, 'General', 'allow_high_priority', 1))627628 USENET_RETENTION = check_setting_int(CFG, 'General', 'usenet_retention', 500)629630 SEARCH_FREQUENCY = check_setting_int(CFG, 'General', 'search_frequency', DEFAULT_SEARCH_FREQUENCY)631 if SEARCH_FREQUENCY < MIN_SEARCH_FREQUENCY:632 SEARCH_FREQUENCY = MIN_SEARCH_FREQUENCY633634 NZB_DIR = check_setting_str(CFG, 'Blackhole', 'nzb_dir', '')635 TORRENT_DIR = check_setting_str(CFG, 'Blackhole', 'torrent_dir', '')636637 TV_DOWNLOAD_DIR = check_setting_str(CFG, 'General', 'tv_download_dir', '')638 PROCESS_AUTOMATICALLY = check_setting_int(CFG, 'General', 'process_automatically', 0)639 UNPACK = check_setting_int(CFG, 'General', 'unpack', 0)640 RENAME_EPISODES = check_setting_int(CFG, 'General', 'rename_episodes', 1)641 KEEP_PROCESSED_DIR = check_setting_int(CFG, 'General', 'keep_processed_dir', 1)642 PROCESS_METHOD = check_setting_str(CFG, 'General', 'process_method', 'copy' if KEEP_PROCESSED_DIR else 'move')643 MOVE_ASSOCIATED_FILES = check_setting_int(CFG, 'General', 'move_associated_files', 0)644 CREATE_MISSING_SHOW_DIRS = check_setting_int(CFG, 'General', 'create_missing_show_dirs', 0)645 ADD_SHOWS_WO_DIR = check_setting_int(CFG, 'General', 'add_shows_wo_dir', 0)646647 EZRSS = bool(check_setting_int(CFG, 'General', 'use_torrent', 0))648 if not EZRSS:649 EZRSS = bool(check_setting_int(CFG, 'EZRSS', 'ezrss', 0))650651 TVTORRENTS = bool(check_setting_int(CFG, 'TVTORRENTS', 'tvtorrents', 0))652 TVTORRENTS_DIGEST = check_setting_str(CFG, 'TVTORRENTS', 'tvtorrents_digest', '')653 TVTORRENTS_HASH = check_setting_str(CFG, 'TVTORRENTS', 'tvtorrents_hash', '')654 TVTORRENTS_OPTIONS = check_setting_str(CFG, 'TVTORRENTS', 'tvtorrents_options', '')655656 BTN = bool(check_setting_int(CFG, 'BTN', 'btn', 0))657 BTN_API_KEY = check_setting_str(CFG, 'BTN', 'btn_api_key', '')658 BTN_OPTIONS = check_setting_str(CFG, 'BTN', 'btn_options', '')659660 THEPIRATEBAY = bool(check_setting_int(CFG, 'THEPIRATEBAY', 'thepiratebay', 1))661 THEPIRATEBAY_TRUSTED = bool(check_setting_int(CFG, 'THEPIRATEBAY', 'thepiratebay_trusted', 1))662 THEPIRATEBAY_PROXY = bool(check_setting_int(CFG, 'THEPIRATEBAY', 'thepiratebay_proxy', 0))663 THEPIRATEBAY_PROXY_URL = check_setting_str(CFG, 'THEPIRATEBAY', 'thepiratebay_proxy_url', '')664 THEPIRATEBAY_BLACKLIST = check_setting_str(CFG, 'THEPIRATEBAY', 'thepiratebay_blacklist', '')665 THEPIRATEBAY_OPTIONS = check_setting_str(CFG, 'THEPIRATEBAY', 'thepiratebay_options', '')666667 TORRENTLEECH = bool(check_setting_int(CFG, 'TORRENTLEECH', 'torrentleech', 0))668 TORRENTLEECH_USERNAME = check_setting_str(CFG, 'TORRENTLEECH', 'torrentleech_username', '')669 TORRENTLEECH_PASSWORD = check_setting_str(CFG, 'TORRENTLEECH', 'torrentleech_password', '')670 TORRENTLEECH_OPTIONS = check_setting_str(CFG, 'TORRENTLEECH', 'torrentleech_options', '')671672 IPTORRENTS = bool(check_setting_int(CFG, 'IPTORRENTS', 'iptorrents', 0))673 IPTORRENTS_USERNAME = check_setting_str(CFG, 'IPTORRENTS', 'iptorrents_username', '')674 IPTORRENTS_PASSWORD = check_setting_str(CFG, 'IPTORRENTS', 'iptorrents_password', '')675 IPTORRENTS_FREELEECH = bool(check_setting_int(CFG, 'IPTORRENTS', 'iptorrents_freeleech', 0))676 IPTORRENTS_OPTIONS = check_setting_str(CFG, 'IPTORRENTS', 'iptorrents_options', '')677678 NEXTGEN = bool(check_setting_int(CFG, 'NEXTGEN', 'nextgen', 0))679 NEXTGEN_USERNAME = check_setting_str(CFG, 'NEXTGEN', 'nextgen_username', '')680 NEXTGEN_PASSWORD = check_setting_str(CFG, 'NEXTGEN', 'nextgen_password', '')681 NEXTGEN_OPTIONS = check_setting_str(CFG, 'NEXTGEN', 'nextgen_options', '') 682683 KAT = bool(check_setting_int(CFG, 'KAT', 'kat', 0))684 KAT_VERIFIED = bool(check_setting_int(CFG, 'KAT', 'kat_verified', 1))685 KAT_OPTIONS = check_setting_str(CFG, 'KAT', 'kat_options', '')686687 PUBLICHD = bool(check_setting_int(CFG, 'PUBLICHD', 'publichd', 0))688 PUBLICHD_OPTIONS = check_setting_str(CFG, 'PUBLICHD', 'publichd_options', '')689690 SCC = bool(check_setting_int(CFG, 'SCC', 'scc', 0))691 SCC_USERNAME = check_setting_str(CFG, 'SCC', 'scc_username', '')692 SCC_PASSWORD = check_setting_str(CFG, 'SCC', 'scc_password', '')693 SCC_OPTIONS = check_setting_str(CFG, 'SCC', 'scc_options', '')694695 HDTORRENTS = bool(check_setting_int(CFG, 'HDTORRENTS', 'hdtorrents', 0))696 HDTORRENTS_USERNAME = check_setting_str(CFG, 'HDTORRENTS', 'hdtorrents_username', '')697 HDTORRENTS_PASSWORD = check_setting_str(CFG, 'HDTORRENTS', 'hdtorrents_password', '')698 HDTORRENTS_OPTIONS = check_setting_str(CFG, 'HDTORRENTS', 'hdtorrents_options', '')699700 TORRENTDAY = bool(check_setting_int(CFG, 'TORRENTDAY', 'torrentday', 0))701 TORRENTDAY_USERNAME = check_setting_str(CFG, 'TORRENTDAY', 'torrentday_username', '')702 TORRENTDAY_PASSWORD = check_setting_str(CFG, 'TORRENTDAY', 'torrentday_password', '')703 TORRENTDAY_FREELEECH = bool(check_setting_int(CFG, 'TORRENTDAY', 'torrentday_freeleech', 0))704 TORRENTDAY_OPTIONS = check_setting_str(CFG, 'TORRENTDAY', 'torrentday_options', '')705706 HDBITS = bool(check_setting_int(CFG, 'HDBITS', 'hdbits', 0))707 HDBITS_USERNAME = check_setting_str(CFG, 'HDBITS', 'hdbits_username', '')708 HDBITS_PASSKEY = check_setting_str(CFG, 'HDBITS', 'hdbits_passkey', '')709 HDBITS_OPTIONS = check_setting_str(CFG, 'HDBITS', 'hdbits_options', '')710711 SPEEDCD = bool(check_setting_int(CFG, 'SPEEDCD', 'speedcd', 0))712 SPEEDCD_USERNAME = check_setting_str(CFG, 'SPEEDCD', 'speedcd_username', '')713 SPEEDCD_PASSWORD = check_setting_str(CFG, 'SPEEDCD', 'speedcd_password', '')714 SPEEDCD_FREELEECH = bool(check_setting_int(CFG, 'SPEEDCD', 'speedcd_freeleech', 0))715716 BINSEARCH = bool(check_setting_int(CFG, 'BinSearch', 'binsearch', 0))717 BINSEARCH_MAX = check_setting_str(CFG, 'BinSearch', 'binsearch_max', '')718 BINSEARCH_ALT = check_setting_str(CFG, 'BinSearch', 'binsearch_alt', '')719 720 NZBS = bool(check_setting_int(CFG, 'NZBs', 'nzbs', 0))721 NZBS_UID = check_setting_str(CFG, 'NZBs', 'nzbs_uid', '')722 NZBS_HASH = check_setting_str(CFG, 'NZBs', 'nzbs_hash', '')723724 NEWZBIN = bool(check_setting_int(CFG, 'Newzbin', 'newzbin', 0))725 NEWZBIN_USERNAME = check_setting_str(CFG, 'Newzbin', 'newzbin_username', '')726 NEWZBIN_PASSWORD = check_setting_str(CFG, 'Newzbin', 'newzbin_password', '')727728 WOMBLE = bool(check_setting_int(CFG, 'Womble', 'womble', 0))729730 OMGWTFNZBS = bool(check_setting_int(CFG, 'omgwtfnzbs', 'omgwtfnzbs', 0))731 OMGWTFNZBS_USERNAME = check_setting_str(CFG, 'omgwtfnzbs', 'omgwtfnzbs_username', '')732 OMGWTFNZBS_APIKEY = check_setting_str(CFG, 'omgwtfnzbs', 'omgwtfnzbs_apikey', '')733734 SAB_USERNAME = check_setting_str(CFG, 'SABnzbd', 'sab_username', '')735 SAB_PASSWORD = check_setting_str(CFG, 'SABnzbd', 'sab_password', '')736 SAB_APIKEY = check_setting_str(CFG, 'SABnzbd', 'sab_apikey', '')737 SAB_CATEGORY = check_setting_str(CFG, 'SABnzbd', 'sab_category', 'tv')738 SAB_HOST = check_setting_str(CFG, 'SABnzbd', 'sab_host', '')739740 NZBGET_USERNAME = check_setting_str(CFG, 'NZBget', 'nzbget_username', 'nzbget') 741 NZBGET_PASSWORD = check_setting_str(CFG, 'NZBget', 'nzbget_password', 'tegbzn6789')742 NZBGET_CATEGORY = check_setting_str(CFG, 'NZBget', 'nzbget_category', 'tv')743 NZBGET_HOST = check_setting_str(CFG, 'NZBget', 'nzbget_host', '')744 NZBGET_USE_HTTPS = bool(check_setting_int(CFG, 'NZBget', 'nzbget_use_https', 0))745746 TORRENT_USERNAME = check_setting_str(CFG, 'TORRENT', 'torrent_username', '')747 TORRENT_PASSWORD = check_setting_str(CFG, 'TORRENT', 'torrent_password', '')748 TORRENT_HOST = check_setting_str(CFG, 'TORRENT', 'torrent_host', '')749 TORRENT_PATH = check_setting_str(CFG, 'TORRENT', 'torrent_path', '')750 TORRENT_RATIO = check_setting_str(CFG, 'TORRENT', 'torrent_ratio', '')751 TORRENT_PAUSED = bool(check_setting_int(CFG, 'TORRENT', 'torrent_paused', 0))752 TORRENT_HIGH_BANDWIDTH = bool(check_setting_int(CFG, 'TORRENT', 'torrent_high_bandwidth', 0))753 TORRENT_LABEL = check_setting_str(CFG, 'TORRENT', 'torrent_label', '')754755 USE_XBMC = bool(check_setting_int(CFG, 'XBMC', 'use_xbmc', 0))756 XBMC_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'XBMC', 'xbmc_notify_onsnatch', 0))757 XBMC_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'XBMC', 'xbmc_notify_ondownload', 0))758 XBMC_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'XBMC', 'xbmc_notify_onsubtitledownload', 0))759 XBMC_UPDATE_LIBRARY = bool(check_setting_int(CFG, 'XBMC', 'xbmc_update_library', 0))760 XBMC_UPDATE_FULL = bool(check_setting_int(CFG, 'XBMC', 'xbmc_update_full', 0))761 XBMC_UPDATE_ONLYFIRST = bool(check_setting_int(CFG, 'XBMC', 'xbmc_update_onlyfirst', 0))762 XBMC_HOST = check_setting_str(CFG, 'XBMC', 'xbmc_host', '')763 XBMC_USERNAME = check_setting_str(CFG, 'XBMC', 'xbmc_username', '')764 XBMC_PASSWORD = check_setting_str(CFG, 'XBMC', 'xbmc_password', '')765766 USE_PLEX = bool(check_setting_int(CFG, 'Plex', 'use_plex', 0))767 PLEX_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Plex', 'plex_notify_onsnatch', 0))768 PLEX_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Plex', 'plex_notify_ondownload', 0))769 PLEX_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'Plex', 'plex_notify_onsubtitledownload', 0))770 PLEX_UPDATE_LIBRARY = bool(check_setting_int(CFG, 'Plex', 'plex_update_library', 0))771 PLEX_SERVER_HOST = check_setting_str(CFG, 'Plex', 'plex_server_host', '')772 PLEX_HOST = check_setting_str(CFG, 'Plex', 'plex_host', '')773 PLEX_USERNAME = check_setting_str(CFG, 'Plex', 'plex_username', '')774 PLEX_PASSWORD = check_setting_str(CFG, 'Plex', 'plex_password', '')775776 USE_GROWL = bool(check_setting_int(CFG, 'Growl', 'use_growl', 0))777 GROWL_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Growl', 'growl_notify_onsnatch', 0))778 GROWL_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Growl', 'growl_notify_ondownload', 0))779 GROWL_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'Growl', 'growl_notify_onsubtitledownload', 0))780 GROWL_HOST = check_setting_str(CFG, 'Growl', 'growl_host', '')781 GROWL_PASSWORD = check_setting_str(CFG, 'Growl', 'growl_password', '')782783 USE_PROWL = bool(check_setting_int(CFG, 'Prowl', 'use_prowl', 0))784 PROWL_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Prowl', 'prowl_notify_onsnatch', 0))785 PROWL_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Prowl', 'prowl_notify_ondownload', 0))786 PROWL_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'Prowl', 'prowl_notify_onsubtitledownload', 0))787 PROWL_API = check_setting_str(CFG, 'Prowl', 'prowl_api', '')788 PROWL_PRIORITY = check_setting_str(CFG, 'Prowl', 'prowl_priority', "0")789790 USE_TWITTER = bool(check_setting_int(CFG, 'Twitter', 'use_twitter', 0))791 TWITTER_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Twitter', 'twitter_notify_onsnatch', 0))792 TWITTER_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Twitter', 'twitter_notify_ondownload', 0))793 TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'Twitter', 'twitter_notify_onsubtitledownload', 0))794 TWITTER_USERNAME = check_setting_str(CFG, 'Twitter', 'twitter_username', '')795 TWITTER_PASSWORD = check_setting_str(CFG, 'Twitter', 'twitter_password', '')796 TWITTER_PREFIX = check_setting_str(CFG, 'Twitter', 'twitter_prefix', 'Sick Beard')797798 USE_BOXCAR = bool(check_setting_int(CFG, 'Boxcar', 'use_boxcar', 0))799 BOXCAR_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Boxcar', 'boxcar_notify_onsnatch', 0))800 BOXCAR_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Boxcar', 'boxcar_notify_ondownload', 0))801 BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'Boxcar', 'boxcar_notify_onsubtitledownload', 0))802 BOXCAR_USERNAME = check_setting_str(CFG, 'Boxcar', 'boxcar_username', '')803804 USE_PUSHOVER = bool(check_setting_int(CFG, 'Pushover', 'use_pushover', 0))805 PUSHOVER_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Pushover', 'pushover_notify_onsnatch', 0))806 PUSHOVER_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Pushover', 'pushover_notify_ondownload', 0))807 PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'Pushover', 'pushover_notify_onsubtitledownload', 0))808 PUSHOVER_USERKEY = check_setting_str(CFG, 'Pushover', 'pushover_userkey', '')809810 USE_LIBNOTIFY = bool(check_setting_int(CFG, 'Libnotify', 'use_libnotify', 0))811 LIBNOTIFY_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Libnotify', 'libnotify_notify_onsnatch', 0))812 LIBNOTIFY_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Libnotify', 'libnotify_notify_ondownload', 0))813 LIBNOTIFY_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'Libnotify', 'libnotify_notify_onsubtitledownload', 0))814815 USE_NMJ = bool(check_setting_int(CFG, 'NMJ', 'use_nmj', 0))816 NMJ_HOST = check_setting_str(CFG, 'NMJ', 'nmj_host', '')817 NMJ_DATABASE = check_setting_str(CFG, 'NMJ', 'nmj_database', '')818 NMJ_MOUNT = check_setting_str(CFG, 'NMJ', 'nmj_mount', '')819820 USE_NMJv2 = bool(check_setting_int(CFG, 'NMJv2', 'use_nmjv2', 0))821 NMJv2_HOST = check_setting_str(CFG, 'NMJv2', 'nmjv2_host', '')822 NMJv2_DATABASE = check_setting_str(CFG, 'NMJv2', 'nmjv2_database', '')823 NMJv2_DBLOC = check_setting_str(CFG, 'NMJv2', 'nmjv2_dbloc', '')824825 USE_SYNOINDEX = bool(check_setting_int(CFG, 'Synology', 'use_synoindex', 0))826827 USE_SYNOLOGYNOTIFIER = bool(check_setting_int(CFG, 'SynologyNotifier', 'use_synologynotifier', 0))828 SYNOLOGYNOTIFIER_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'SynologyNotifier', 'synologynotifier_notify_onsnatch', 0))829 SYNOLOGYNOTIFIER_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'SynologyNotifier', 'synologynotifier_notify_ondownload', 0))830 SYNOLOGYNOTIFIER_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'SynologyNotifier', 'synologynotifier_notify_onsubtitledownload', 0))831832 USE_TRAKT = bool(check_setting_int(CFG, 'Trakt', 'use_trakt', 0))833 TRAKT_USERNAME = check_setting_str(CFG, 'Trakt', 'trakt_username', '')834 TRAKT_PASSWORD = check_setting_str(CFG, 'Trakt', 'trakt_password', '')835 TRAKT_API = check_setting_str(CFG, 'Trakt', 'trakt_api', '')836 TRAKT_REMOVE_WATCHLIST = bool(check_setting_int(CFG, 'Trakt', 'trakt_remove_watchlist', 0))837 TRAKT_USE_WATCHLIST = bool(check_setting_int(CFG, 'Trakt', 'trakt_use_watchlist', 0))838 TRAKT_METHOD_ADD = check_setting_str(CFG, 'Trakt', 'trakt_method_add', "0")839 TRAKT_START_PAUSED = bool(check_setting_int(CFG, 'Trakt', 'trakt_start_paused', 0))840841 CheckSection(CFG, 'pyTivo')842 USE_PYTIVO = bool(check_setting_int(CFG, 'pyTivo', 'use_pytivo', 0))843 PYTIVO_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'pyTivo', 'pytivo_notify_onsnatch', 0))844 PYTIVO_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'pyTivo', 'pytivo_notify_ondownload', 0))845 PYTIVO_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'pyTivo', 'pytivo_notify_onsubtitledownload', 0))846 PYTIVO_UPDATE_LIBRARY = bool(check_setting_int(CFG, 'pyTivo', 'pyTivo_update_library', 0))847 PYTIVO_HOST = check_setting_str(CFG, 'pyTivo', 'pytivo_host', '')848 PYTIVO_SHARE_NAME = check_setting_str(CFG, 'pyTivo', 'pytivo_share_name', '')849 PYTIVO_TIVO_NAME = check_setting_str(CFG, 'pyTivo', 'pytivo_tivo_name', '')850851 USE_NMA = bool(check_setting_int(CFG, 'NMA', 'use_nma', 0))852 NMA_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'NMA', 'nma_notify_onsnatch', 0))853 NMA_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'NMA', 'nma_notify_ondownload', 0))854 NMA_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'NMA', 'nma_notify_onsubtitledownload', 0))855 NMA_API = check_setting_str(CFG, 'NMA', 'nma_api', '')856 NMA_PRIORITY = check_setting_str(CFG, 'NMA', 'nma_priority', "0")857858 USE_PUSHALOT = bool(check_setting_int(CFG, 'Pushalot', 'use_pushalot', 0))859 PUSHALOT_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Pushalot', 'pushalot_notify_onsnatch', 0))860 PUSHALOT_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Pushalot', 'pushalot_notify_ondownload', 0))861 PUSHALOT_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'Pushalot', 'pushalot_notify_onsubtitledownload', 0))862 PUSHALOT_AUTHORIZATIONTOKEN = check_setting_str(CFG, 'Pushalot', 'pushalot_authorizationtoken', '')863864 USE_PUSHBULLET = bool(check_setting_int(CFG, 'Pushbullet', 'use_pushbullet', 0))865 PUSHBULLET_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Pushbullet', 'pushbullet_notify_onsnatch', 0))866 PUSHBULLET_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Pushbullet', 'pushbullet_notify_ondownload', 0))867 PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'Pushbullet', 'pushbullet_notify_onsubtitledownload', 0))868 PUSHBULLET_API = check_setting_str(CFG, 'Pushbullet', 'pushbullet_api', '')869 PUSHBULLET_DEVICE = check_setting_str(CFG, 'Pushbullet', 'pushbullet_device', '')870871 USE_EMAIL = bool(check_setting_int(CFG, 'Email', 'use_email', 0))872 EMAIL_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Email', 'email_notify_onsnatch', 0))873 EMAIL_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Email', 'email_notify_ondownload', 0))874 EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'Email', 'email_notify_onsubtitledownload', 0))875 EMAIL_HOST = check_setting_str(CFG, 'Email', 'email_host', '')876 EMAIL_PORT = check_setting_int(CFG, 'Email', 'email_port', 25)877 EMAIL_TLS = bool(check_setting_int(CFG, 'Email', 'email_tls', 0))878 EMAIL_USER = check_setting_str(CFG, 'Email', 'email_user', '')879 EMAIL_PASSWORD = check_setting_str(CFG, 'Email', 'email_password', '')880 EMAIL_FROM = check_setting_str(CFG, 'Email', 'email_from', '')881 EMAIL_LIST = check_setting_str(CFG, 'Email', 'email_list', '')882883 USE_SUBTITLES = bool(check_setting_int(CFG, 'Subtitles', 'use_subtitles', 0))884 SUBTITLES_LANGUAGES = check_setting_str(CFG, 'Subtitles', 'subtitles_languages', '').split(',')885 if SUBTITLES_LANGUAGES[0] == '':886 SUBTITLES_LANGUAGES = []887 SUBTITLES_DIR = check_setting_str(CFG, 'Subtitles', 'subtitles_dir', '')888 SUBTITLES_SERVICES_LIST = check_setting_str(CFG, 'Subtitles', 'SUBTITLES_SERVICES_LIST', '').split(',')889 SUBTITLES_SERVICES_ENABLED = [int(x) for x in check_setting_str(CFG, 'Subtitles', 'SUBTITLES_SERVICES_ENABLED', '').split('|') if x]890 SUBTITLES_DEFAULT = bool(check_setting_int(CFG, 'Subtitles', 'subtitles_default', 0))891 SUBTITLES_HISTORY = bool(check_setting_int(CFG, 'Subtitles', 'subtitles_history', 0))892 SUBTITLES_FINDER_FREQUENCY = check_setting_int(CFG, 'Subtitles', 'subtitles_finder_frequency', 1)893894 USE_FAILED_DOWNLOADS = bool(check_setting_int(CFG, 'FailedDownloads', 'use_failed_downloads', 0))895 DELETE_FAILED = bool(check_setting_int(CFG, 'FailedDownloads', 'delete_failed', 0))896897 GIT_PATH = check_setting_str(CFG, 'General', 'git_path', '')898899 IGNORE_WORDS = check_setting_str(CFG, 'General', 'ignore_words', IGNORE_WORDS)900 if not IGNORE_WORDS:901 IGNORE_WORDS = "german,french,core2hd,dutch,swedish,reenc,MrLss"902 903 CALENDAR_PROTECTED = bool(check_setting_int(CFG, 'General', 'calendar_protected', 0))904905 EXTRA_SCRIPTS = [x.strip() for x in check_setting_str(CFG, 'General', 'extra_scripts', '').split('|') if x.strip()]906907 USE_LISTVIEW = bool(check_setting_int(CFG, 'General', 'use_listview', 0))908909 METADATA_XBMC = check_setting_str(CFG, 'General', 'metadata_xbmc', '0|0|0|0|0|0|0|0|0|0')910 METADATA_XBMC_12PLUS = check_setting_str(CFG, 'General', 'metadata_xbmc_12plus', '0|0|0|0|0|0|0|0|0|0')911 METADATA_MEDIABROWSER = check_setting_str(CFG, 'General', 'metadata_mediabrowser', '0|0|0|0|0|0|0|0|0|0')912 METADATA_PS3 = check_setting_str(CFG, 'General', 'metadata_ps3', '0|0|0|0|0|0|0|0|0|0')913 METADATA_WDTV = check_setting_str(CFG, 'General', 'metadata_wdtv', '0|0|0|0|0|0|0|0|0|0')914 METADATA_TIVO = check_setting_str(CFG, 'General', 'metadata_tivo', '0|0|0|0|0|0|0|0|0|0')915 METADATA_MEDE8ER = check_setting_str(CFG, 'General', 'metadata_mede8er', '0|0|0|0|0|0|0|0|0|0')916917 GUI_NAME = check_setting_str(CFG, 'GUI', 'gui_name', 'slick')918919 HOME_LAYOUT = check_setting_str(CFG, 'GUI', 'home_layout', 'poster')920 HISTORY_LAYOUT = check_setting_str(CFG, 'GUI', 'history_layout', 'detailed')921 DISPLAY_SHOW_SPECIALS = bool(check_setting_int(CFG, 'GUI', 'display_show_specials', 1))922 COMING_EPS_LAYOUT = check_setting_str(CFG, 'GUI', 'coming_eps_layout', 'banner')923 COMING_EPS_DISPLAY_PAUSED = bool(check_setting_int(CFG, 'GUI', 'coming_eps_display_paused', 0))924 COMING_EPS_SORT = check_setting_str(CFG, 'GUI', 'coming_eps_sort', 'date')925 COMING_EPS_MISSED_RANGE = check_setting_int(CFG, 'GUI', 'coming_eps_missed_range', 7)926 DATE_PRESET = check_setting_str(CFG, 'GUI', 'date_preset', '%x')927 TIME_PRESET_W_SECONDS = check_setting_str(CFG, 'GUI', 'time_preset', '%I:%M:%S %p')928 TIME_PRESET = TIME_PRESET_W_SECONDS.replace(u":%S",u"") 929930 NEWZNAB_DATA = check_setting_str(CFG, 'Newznab', 'newznab_data', '')931 newznabProviderList = providers.getNewznabProviderList(NEWZNAB_DATA) 932 933 torrentRssData = check_setting_str(CFG, 'TorrentRss', 'torrentrss_data', '')934 torrentRssProviderList = providers.getTorrentRssProviderList(torrentRssData)935936 if not os.path.isfile(CONFIG_FILE):937 logger.log(u"Unable to find '" + CONFIG_FILE + "', all settings will be default!", logger.DEBUG)938 save_config()939 940 # start up all the threads941 logger.sb_log_instance.initLogging(consoleLogging=consoleLogging)942943 # initialize the main SB database944 db.upgradeDatabase(db.DBConnection(), mainDB.InitialSchema)945946 # initialize the cache database947 db.upgradeDatabase(db.DBConnection("cache.db"), cache_db.InitialSchema)948949 # initalize the failed downloads database950 db.upgradeDatabase(db.DBConnection("failed.db"), failed_db.InitialSchema)951952 # fix up any db problems953 db.sanityCheckDatabase(db.DBConnection(), mainDB.MainSanityCheck)954955 # migrate the config if it needs it956 migrator = ConfigMigrator(CFG)957 migrator.migrate_config()958959 # initialize metadata_providers960 metadata_provider_dict = metadata.get_metadata_generator_dict()961 for cur_metadata_tuple in [(METADATA_XBMC, metadata.xbmc),962 (METADATA_XBMC_12PLUS, metadata.xbmc_12plus),963 (METADATA_MEDIABROWSER, metadata.mediabrowser),964 (METADATA_PS3, metadata.ps3),965 (METADATA_WDTV, metadata.wdtv),966 (METADATA_TIVO, metadata.tivo),967 (METADATA_MEDE8ER, metadata.mede8er)968 ]:969970 (cur_metadata_config, cur_metadata_class) = cur_metadata_tuple971 tmp_provider = cur_metadata_class.metadata_class()972 tmp_provider.set_config(cur_metadata_config)973 metadata_provider_dict[tmp_provider.name] = tmp_provider974975 # initialize newznab providers 976 newznabProviderList = providers.getNewznabProviderList(NEWZNAB_DATA)977 providerList = providers.makeProviderList()978979 # initialize newznab providers980 currentSearchScheduler = scheduler.Scheduler(searchCurrent.CurrentSearcher(),981 cycleTime=datetime.timedelta(minutes=SEARCH_FREQUENCY),982 threadName="SEARCH",983 runImmediately=True)984985 # the interval for this is stored inside the ShowUpdater class986 showUpdaterInstance = showUpdater.ShowUpdater()987 showUpdateScheduler = scheduler.Scheduler(showUpdaterInstance,988 cycleTime=showUpdaterInstance.updateInterval,989 threadName="SHOWUPDATER",990 runImmediately=False)991992 versionCheckScheduler = scheduler.Scheduler(versionChecker.CheckVersion(),993 cycleTime=datetime.timedelta(hours=12),994 threadName="CHECKVERSION",995 runImmediately=True)996997 showQueueScheduler = scheduler.Scheduler(show_queue.ShowQueue(),998 cycleTime=datetime.timedelta(seconds=3),999 threadName="SHOWQUEUE",1000 silent=True)10011002 searchQueueScheduler = scheduler.Scheduler(search_queue.SearchQueue(),1003 cycleTime=datetime.timedelta(seconds=3),1004 threadName="SEARCHQUEUE",1005 silent=True)10061007 properFinderInstance = properFinder.ProperFinder()1008 properFinderScheduler = scheduler.Scheduler(properFinderInstance,1009 cycleTime=properFinderInstance.updateInterval,1010 threadName="FINDPROPERS",1011 runImmediately=True)1012 if not DOWNLOAD_PROPERS:1013 properFinderScheduler.silent = True10141015 autoPostProcesserScheduler = scheduler.Scheduler(autoPostProcesser.PostProcesser(),1016 cycleTime=datetime.timedelta(minutes=10),1017 threadName="POSTPROCESSER",1018 runImmediately=True)1019 if not PROCESS_AUTOMATICALLY:1020 autoPostProcesserScheduler.silent = True1021 1022 traktWatchListCheckerSchedular = scheduler.Scheduler(traktWatchListChecker.TraktChecker(),1023 cycleTime=datetime.timedelta(hours=1),1024 threadName="TRAKTWATCHLIST",1025 runImmediately=True)1026 1027 if not USE_TRAKT:1028 traktWatchListCheckerSchedular.silent = True1029 1030 backlogSearchScheduler = searchBacklog.BacklogSearchScheduler(searchBacklog.BacklogSearcher(),1031 cycleTime=datetime.timedelta(minutes=get_backlog_cycle_time()),1032 threadName="BACKLOG",1033 runImmediately=True)1034 backlogSearchScheduler.action.cycleTime = BACKLOG_SEARCH_FREQUENCY103510361037 subtitlesFinderScheduler = scheduler.Scheduler(subtitles.SubtitlesFinder(),1038 cycleTime=datetime.timedelta(hours=SUBTITLES_FINDER_FREQUENCY),1039 threadName="FINDSUBTITLES",1040 runImmediately=True)10411042 if not USE_SUBTITLES:1043 subtitlesFinderScheduler.silent = True10441045 showList = []1046 loadingShowList = {}10471048 __INITIALIZED__ = True1049 return True10501051def start():10521053 global __INITIALIZED__, currentSearchScheduler, backlogSearchScheduler, \1054 showUpdateScheduler, versionCheckScheduler, showQueueScheduler, \1055 properFinderScheduler, autoPostProcesserScheduler, searchQueueScheduler, \1056 subtitlesFinderScheduler, started, USE_SUBTITLES, \1057 traktWatchListCheckerSchedular, started10581059 with INIT_LOCK:10601061 if __INITIALIZED__:10621063 # start the search scheduler1064 currentSearchScheduler.thread.start()10651066 # start the backlog scheduler1067 backlogSearchScheduler.thread.start()10681069 # start the show updater1070 showUpdateScheduler.thread.start()10711072 # start the version checker1073 versionCheckScheduler.thread.start()10741075 # start the queue checker1076 showQueueScheduler.thread.start()10771078 # start the search queue checker1079 searchQueueScheduler.thread.start()10801081 # start the queue checker1082 properFinderScheduler.thread.start()10831084 # start the proper finder1085 autoPostProcesserScheduler.thread.start()10861087 # start the subtitles finder1088 if USE_SUBTITLES:1089 subtitlesFinderScheduler.thread.start()10901091 # start the trakt watchlist1092 traktWatchListCheckerSchedular.thread.start()10931094 started = True10951096def halt ():10971098 global __INITIALIZED__, currentSearchScheduler, backlogSearchScheduler, showUpdateScheduler, \1099 showQueueScheduler, properFinderScheduler, autoPostProcesserScheduler, searchQueueScheduler, \1100 subtitlesFinderScheduler, started, \1101 traktWatchListCheckerSchedular11021103 with INIT_LOCK:11041105 if __INITIALIZED__:11061107 logger.log(u"Aborting all threads")11081109 # abort all the threads11101111 currentSearchScheduler.abort = True1112 logger.log(u"Waiting for the SEARCH thread to exit")1113 try:1114 currentSearchScheduler.thread.join(10)1115 except:1116 pass11171118 backlogSearchScheduler.abort = True1119 logger.log(u"Waiting for the BACKLOG thread to exit")1120 try:1121 backlogSearchScheduler.thread.join(10)1122 except:1123 pass11241125 showUpdateScheduler.abort = True1126 logger.log(u"Waiting for the SHOWUPDATER thread to exit")1127 try:1128 showUpdateScheduler.thread.join(10)1129 except:1130 pass11311132 versionCheckScheduler.abort = True1133 logger.log(u"Waiting for the VERSIONCHECKER thread to exit")1134 try:1135 versionCheckScheduler.thread.join(10)1136 except:1137 pass11381139 showQueueScheduler.abort = True1140 logger.log(u"Waiting for the SHOWQUEUE thread to exit")1141 try:1142 showQueueScheduler.thread.join(10)1143 except:1144 pass11451146 searchQueueScheduler.abort = True1147 logger.log(u"Waiting for the SEARCHQUEUE thread to exit")1148 try:1149 searchQueueScheduler.thread.join(10)1150 except:1151 pass11521153 autoPostProcesserScheduler.abort = True1154 logger.log(u"Waiting for the POSTPROCESSER thread to exit")1155 try:1156 autoPostProcesserScheduler.thread.join(10)1157 except:1158 pass11591160 traktWatchListCheckerSchedular.abort = True1161 logger.log(u"Waiting for the TRAKTWATCHLIST thread to exit")1162 try:1163 traktWatchListCheckerSchedular.thread.join(10)1164 except:1165 pass11661167 properFinderScheduler.abort = True1168 logger.log(u"Waiting for the PROPERFINDER thread to exit")1169 try:1170 properFinderScheduler.thread.join(10)1171 except:1172 pass11731174 subtitlesFinderScheduler.abort = True1175 logger.log(u"Waiting for the SUBTITLESFINDER thread to exit")1176 try:1177 subtitlesFinderScheduler.thread.join(10)1178 except:1179 pass118011811182 __INITIALIZED__ = False118311841185def sig_handler(signum=None, frame=None):1186 if type(signum) != type(None):1187 logger.log(u"Signal %i caught, saving and exiting..." % int(signum))1188 saveAndShutdown()118911901191def saveAll():11921193 global showList11941195 # write all shows1196 logger.log(u"Saving all shows to the database")1197 for show in showList:1198 show.saveToDB()11991200 # save config1201 logger.log(u"Saving config file to disk")1202 save_config()120312041205def saveAndShutdown(restart=False):12061207 halt()12081209 saveAll()12101211 logger.log(u"Killing cherrypy")1212 cherrypy.engine.exit()12131214 if CREATEPID:1215 logger.log(u"Removing pidfile " + str(PIDFILE))1216 os.remove(PIDFILE)12171218 if restart:1219 install_type = versionCheckScheduler.action.install_type12201221 popen_list = []12221223 if install_type in ('git', 'source'):1224 popen_list = [sys.executable, MY_FULLNAME]1225 elif install_type == 'win':1226 if hasattr(sys, 'frozen'):1227 # c:\dir\to\updater.exe 12345 c:\dir\to\sickbeard.exe1228 popen_list = [os.path.join(PROG_DIR, 'updater.exe'), str(PID), sys.executable]1229 else:1230 logger.log(u"Unknown SB launch method, please file a bug report about this", logger.ERROR)1231 popen_list = [sys.executable, os.path.join(PROG_DIR, 'updater.py'), str(PID), sys.executable, MY_FULLNAME ]12321233 if popen_list:1234 popen_list += MY_ARGS1235 if '--nolaunch' not in popen_list:1236 popen_list += ['--nolaunch']1237 logger.log(u"Restarting Sick Beard with " + str(popen_list))1238 logger.close()1239 subprocess.Popen(popen_list, cwd=os.getcwd())12401241 os._exit(0)124212431244def invoke_command(to_call, *args, **kwargs):1245 global invoked_command1246 def delegate():1247 to_call(*args, **kwargs)1248 invoked_command = delegate1249 logger.log(u"Placed invoked command: "+repr(invoked_command)+" for "+repr(to_call)+" with "+repr(args)+" and "+repr(kwargs), logger.DEBUG)12501251def invoke_restart(soft=True):1252 invoke_command(restart, soft=soft)12531254def invoke_shutdown():1255 invoke_command(saveAndShutdown)125612571258def restart(soft=True):12591260 if soft:1261 halt()1262 saveAll()1263 #logger.log(u"Restarting cherrypy")1264 #cherrypy.engine.restart()1265 logger.log(u"Re-initializing all data")1266 initialize()12671268 else:1269 saveAndShutdown(restart=True)1270127112721273def save_config():12741275 new_config = ConfigObj()1276 new_config.filename = CONFIG_FILE1277 1278 # For passwords you must include the word `password` in the item_name and add `helpers.encrypt(ITEM_NAME, ENCRYPTION_VERSION)` in save_config()1279 new_config['General'] = {}1280 new_config['General']['config_version'] = CONFIG_VERSION1281 new_config['General']['encryption_version'] = int(ENCRYPTION_VERSION)1282 new_config['General']['log_dir'] = ACTUAL_LOG_DIR if ACTUAL_LOG_DIR else 'Logs'1283 new_config['General']['socket_timeout'] = SOCKET_TIMEOUT1284 new_config['General']['web_port'] = WEB_PORT1285 new_config['General']['web_host'] = WEB_HOST1286 new_config['General']['web_ipv6'] = int(WEB_IPV6)1287 new_config['General']['web_log'] = int(WEB_LOG)1288 new_config['General']['web_root'] = WEB_ROOT1289 new_config['General']['web_username'] = WEB_USERNAME1290 new_config['General']['web_password'] = helpers.encrypt(WEB_PASSWORD, ENCRYPTION_VERSION)1291 new_config['General']['localhost_ip'] = LOCALHOST_IP1292 new_config['General']['anon_redirect'] = ANON_REDIRECT1293 new_config['General']['use_api'] = int(USE_API)1294 new_config['General']['api_key'] = API_KEY1295 new_config['General']['enable_https'] = int(ENABLE_HTTPS)1296 new_config['General']['https_cert'] = HTTPS_CERT1297 new_config['General']['https_key'] = HTTPS_KEY1298 new_config['General']['use_nzbs'] = int(USE_NZBS)1299 new_config['General']['use_torrents'] = int(USE_TORRENTS)1300 new_config['General']['nzb_method'] = NZB_METHOD1301 new_config['General']['torrent_method'] = TORRENT_METHOD1302 new_config['General']['usenet_retention'] = int(USENET_RETENTION)1303 new_config['General']['search_frequency'] = int(SEARCH_FREQUENCY)1304 new_config['General']['download_propers'] = int(DOWNLOAD_PROPERS)1305 new_config['General']['allow_high_priority'] = int(ALLOW_HIGH_PRIORITY)1306 new_config['General']['quality_default'] = int(QUALITY_DEFAULT)1307 new_config['General']['status_default'] = int(STATUS_DEFAULT)1308 new_config['General']['flatten_folders_default'] = int(FLATTEN_FOLDERS_DEFAULT)1309 new_config['General']['provider_order'] = ' '.join(PROVIDER_ORDER)1310 new_config['General']['version_notify'] = int(VERSION_NOTIFY)1311 new_config['General']['naming_strip_year'] = int(NAMING_STRIP_YEAR)1312 new_config['General']['naming_pattern'] = NAMING_PATTERN1313 new_config['General']['naming_custom_abd'] = int(NAMING_CUSTOM_ABD)1314 new_config['General']['naming_abd_pattern'] = NAMING_ABD_PATTERN1315 new_config['General']['naming_multi_ep'] = int(NAMING_MULTI_EP)1316 new_config['General']['launch_browser'] = int(LAUNCH_BROWSER)1317 new_config['General']['update_shows_on_start'] = int(UPDATE_SHOWS_ON_START)1318 new_config['General']['sort_article'] = int(SORT_ARTICLE)13191320 new_config['General']['use_listview'] = int(USE_LISTVIEW)1321 new_config['General']['metadata_xbmc'] = METADATA_XBMC1322 new_config['General']['metadata_xbmc_12plus'] = METADATA_XBMC_12PLUS1323 new_config['General']['metadata_mediabrowser'] = METADATA_MEDIABROWSER1324 new_config['General']['metadata_ps3'] = METADATA_PS31325 new_config['General']['metadata_wdtv'] = METADATA_WDTV1326 new_config['General']['metadata_tivo'] = METADATA_TIVO1327 new_config['General']['metadata_mede8er'] = METADATA_MEDE8ER13281329 new_config['General']['cache_dir'] = ACTUAL_CACHE_DIR if ACTUAL_CACHE_DIR else 'cache'1330 new_config['General']['root_dirs'] = ROOT_DIRS if ROOT_DIRS else ''1331 new_config['General']['tv_download_dir'] = TV_DOWNLOAD_DIR1332 new_config['General']['keep_processed_dir'] = int(KEEP_PROCESSED_DIR)1333 new_config['General']['process_method'] = PROCESS_METHOD1334 new_config['General']['move_associated_files'] = int(MOVE_ASSOCIATED_FILES)1335 new_config['General']['process_automatically'] = int(PROCESS_AUTOMATICALLY)1336 new_config['General']['unpack'] = int(UNPACK)1337 new_config['General']['rename_episodes'] = int(RENAME_EPISODES)1338 new_config['General']['create_missing_show_dirs'] = int(CREATE_MISSING_SHOW_DIRS)1339 new_config['General']['add_shows_wo_dir'] = int(ADD_SHOWS_WO_DIR)13401341 new_config['General']['extra_scripts'] = '|'.join(EXTRA_SCRIPTS)1342 new_config['General']['git_path'] = GIT_PATH1343 new_config['General']['ignore_words'] = IGNORE_WORDS1344 new_config['General']['calendar_protected'] = int(CALENDAR_PROTECTED)13451346 new_config['Blackhole'] = {}1347 new_config['Blackhole']['nzb_dir'] = NZB_DIR1348 new_config['Blackhole']['torrent_dir'] = TORRENT_DIR13491350 new_config['EZRSS'] = {}1351 new_config['EZRSS']['ezrss'] = int(EZRSS)13521353 new_config['TVTORRENTS'] = {}1354 new_config['TVTORRENTS']['tvtorrents'] = int(TVTORRENTS)1355 new_config['TVTORRENTS']['tvtorrents_digest'] = TVTORRENTS_DIGEST1356 new_config['TVTORRENTS']['tvtorrents_hash'] = TVTORRENTS_HASH1357 new_config['TVTORRENTS']['tvtorrents_options'] = TVTORRENTS_OPTIONS13581359 new_config['BTN'] = {}1360 new_config['BTN']['btn'] = int(BTN)1361 new_config['BTN']['btn_api_key'] = BTN_API_KEY1362 new_config['BTN']['btn_options'] = BTN_OPTIONS13631364 new_config['THEPIRATEBAY'] = {}1365 new_config['THEPIRATEBAY']['thepiratebay'] = int(THEPIRATEBAY)1366 new_config['THEPIRATEBAY']['thepiratebay_trusted'] = int(THEPIRATEBAY_TRUSTED)1367 new_config['THEPIRATEBAY']['thepiratebay_proxy'] = int(THEPIRATEBAY_PROXY)1368 new_config['THEPIRATEBAY']['thepiratebay_proxy_url'] = THEPIRATEBAY_PROXY_URL1369 new_config['THEPIRATEBAY']['thepiratebay_blacklist'] = THEPIRATEBAY_BLACKLIST1370 new_config['THEPIRATEBAY']['thepiratebay_options'] = THEPIRATEBAY_OPTIONS13711372 new_config['TORRENTLEECH'] = {}1373 new_config['TORRENTLEECH']['torrentleech'] = int(TORRENTLEECH)1374 new_config['TORRENTLEECH']['torrentleech_username'] = TORRENTLEECH_USERNAME1375 new_config['TORRENTLEECH']['torrentleech_password'] = helpers.encrypt(TORRENTLEECH_PASSWORD, ENCRYPTION_VERSION)1376 new_config['TORRENTLEECH']['torrentleech_options'] = TORRENTLEECH_OPTIONS13771378 new_config['IPTORRENTS'] = {}1379 new_config['IPTORRENTS']['iptorrents'] = int(IPTORRENTS)1380 new_config['IPTORRENTS']['iptorrents_username'] = IPTORRENTS_USERNAME1381 new_config['IPTORRENTS']['iptorrents_password'] = helpers.encrypt(IPTORRENTS_PASSWORD, ENCRYPTION_VERSION)1382 new_config['IPTORRENTS']['iptorrents_freeleech'] = int(IPTORRENTS_FREELEECH)1383 new_config['IPTORRENTS']['iptorrents_options'] = IPTORRENTS_OPTIONS13841385 new_config['NEXTGEN'] = {}1386 new_config['NEXTGEN']['nextgen'] = int(NEXTGEN)1387 new_config['NEXTGEN']['nextgen_username'] = NEXTGEN_USERNAME1388 new_config['NEXTGEN']['nextgen_password'] = helpers.encrypt(NEXTGEN_PASSWORD, ENCRYPTION_VERSION)1389 new_config['NEXTGEN']['nextgen_options'] = NEXTGEN_OPTIONS 1390 1391 new_config['KAT'] = {}1392 new_config['KAT']['kat'] = int(KAT)1393 new_config['KAT']['kat_verified'] = int(KAT_VERIFIED)1394 new_config['KAT']['kat_options'] = KAT_OPTIONS13951396 new_config['PUBLICHD'] = {}1397 new_config['PUBLICHD']['publichd'] = int(PUBLICHD)1398 new_config['PUBLICHD']['publichd_options'] = PUBLICHD_OPTIONS13991400 new_config['SCC'] = {}1401 new_config['SCC']['scc'] = int(SCC)1402 new_config['SCC']['scc_username'] = SCC_USERNAME1403 new_config['SCC']['scc_password'] = helpers.encrypt(SCC_PASSWORD, ENCRYPTION_VERSION)1404 new_config['SCC']['scc_options'] = SCC_OPTIONS14051406 new_config['HDTORRENTS'] = {}1407 new_config['HDTORRENTS']['hdtorrents'] = int(HDTORRENTS)1408 new_config['HDTORRENTS']['hdtorrents_username'] = HDTORRENTS_USERNAME1409 new_config['HDTORRENTS']['hdtorrents_password'] = helpers.encrypt(HDTORRENTS_PASSWORD, ENCRYPTION_VERSION)1410 new_config['HDTORRENTS']['hdtorrents_options'] = HDTORRENTS_OPTIONS14111412 new_config['TORRENTDAY'] = {}1413 new_config['TORRENTDAY']['torrentday'] = int(TORRENTDAY)1414 new_config['TORRENTDAY']['torrentday_username'] = TORRENTDAY_USERNAME1415 new_config['TORRENTDAY']['torrentday_password'] = helpers.encrypt(TORRENTDAY_PASSWORD, ENCRYPTION_VERSION)1416 new_config['TORRENTDAY']['torrentday_freeleech'] = int(TORRENTDAY_FREELEECH)1417 new_config['TORRENTDAY']['torrentday_options'] = TORRENTDAY_OPTIONS14181419 new_config['HDBITS'] = {}1420 new_config['HDBITS']['hdbits'] = int(HDBITS)1421 new_config['HDBITS']['hdbits_username'] = HDBITS_USERNAME1422 new_config['HDBITS']['hdbits_passkey'] = helpers.encrypt(HDBITS_PASSKEY, ENCRYPTION_VERSION)1423 new_config['HDBITS']['hdbits_options'] = HDBITS_OPTIONS14241425 new_config['SPEEDCD'] = {}1426 new_config['SPEEDCD']['speedcd'] = int(SPEEDCD)1427 new_config['SPEEDCD']['speedcd_username'] = SPEEDCD_USERNAME1428 new_config['SPEEDCD']['speedcd_password'] = helpers.encrypt(SPEEDCD_PASSWORD, ENCRYPTION_VERSION)1429 new_config['SPEEDCD']['speedcd_freeleech'] = int(SPEEDCD_FREELEECH)14301431 new_config['BinSearch'] = {}1432 new_config['BinSearch']['binsearch'] = int(BINSEARCH)1433 new_config['BinSearch']['binsearch_max'] = BINSEARCH_MAX1434 new_config['BinSearch']['binsearch_alt'] = BINSEARCH_ALT14351436 new_config['NZBs'] = {}1437 new_config['NZBs']['nzbs'] = int(NZBS)1438 new_config['NZBs']['nzbs_uid'] = NZBS_UID1439 new_config['NZBs']['nzbs_hash'] = NZBS_HASH14401441 new_config['Newzbin'] = {}1442 new_config['Newzbin']['newzbin'] = int(NEWZBIN)1443 new_config['Newzbin']['newzbin_username'] = NEWZBIN_USERNAME1444 new_config['Newzbin']['newzbin_password'] = helpers.encrypt(NEWZBIN_PASSWORD, ENCRYPTION_VERSION)14451446 new_config['Womble'] = {}1447 new_config['Womble']['womble'] = int(WOMBLE)14481449 new_config['omgwtfnzbs'] = {}1450 new_config['omgwtfnzbs']['omgwtfnzbs'] = int(OMGWTFNZBS)1451 new_config['omgwtfnzbs']['omgwtfnzbs_username'] = OMGWTFNZBS_USERNAME1452 new_config['omgwtfnzbs']['omgwtfnzbs_apikey'] = OMGWTFNZBS_APIKEY14531454 new_config['SABnzbd'] = {}1455 new_config['SABnzbd']['sab_username'] = SAB_USERNAME1456 new_config['SABnzbd']['sab_password'] = helpers.encrypt(SAB_PASSWORD, ENCRYPTION_VERSION)1457 new_config['SABnzbd']['sab_apikey'] = SAB_APIKEY1458 new_config['SABnzbd']['sab_category'] = SAB_CATEGORY1459 new_config['SABnzbd']['sab_host'] = SAB_HOST14601461 new_config['NZBget'] = {}14621463 new_config['NZBget']['nzbget_username'] = NZBGET_USERNAME 1464 new_config['NZBget']['nzbget_password'] = helpers.encrypt(NZBGET_PASSWORD, ENCRYPTION_VERSION)1465 new_config['NZBget']['nzbget_category'] = NZBGET_CATEGORY1466 new_config['NZBget']['nzbget_host'] = NZBGET_HOST1467 new_config['NZBget']['nzbget_use_https'] = int(NZBGET_USE_HTTPS)14681469 new_config['TORRENT'] = {}1470 new_config['TORRENT']['torrent_username'] = TORRENT_USERNAME1471 new_config['TORRENT']['torrent_password'] = helpers.encrypt(TORRENT_PASSWORD, ENCRYPTION_VERSION)1472 new_config['TORRENT']['torrent_host'] = TORRENT_HOST1473 new_config['TORRENT']['torrent_path'] = TORRENT_PATH1474 new_config['TORRENT']['torrent_ratio'] = TORRENT_RATIO1475 new_config['TORRENT']['torrent_paused'] = int(TORRENT_PAUSED)1476 new_config['TORRENT']['torrent_high_bandwidth'] = int(TORRENT_HIGH_BANDWIDTH)1477 new_config['TORRENT']['torrent_label'] = TORRENT_LABEL14781479 new_config['XBMC'] = {}1480 new_config['XBMC']['use_xbmc'] = int(USE_XBMC)1481 new_config['XBMC']['xbmc_notify_onsnatch'] = int(XBMC_NOTIFY_ONSNATCH)1482 new_config['XBMC']['xbmc_notify_ondownload'] = int(XBMC_NOTIFY_ONDOWNLOAD)1483 new_config['XBMC']['xbmc_notify_onsubtitledownload'] = int(XBMC_NOTIFY_ONSUBTITLEDOWNLOAD)1484 new_config['XBMC']['xbmc_update_library'] = int(XBMC_UPDATE_LIBRARY)1485 new_config['XBMC']['xbmc_update_full'] = int(XBMC_UPDATE_FULL)1486 new_config['XBMC']['xbmc_update_onlyfirst'] = int(XBMC_UPDATE_ONLYFIRST)1487 new_config['XBMC']['xbmc_host'] = XBMC_HOST1488 new_config['XBMC']['xbmc_username'] = XBMC_USERNAME1489 new_config['XBMC']['xbmc_password'] = helpers.encrypt(XBMC_PASSWORD, ENCRYPTION_VERSION)14901491 new_config['Plex'] = {}1492 new_config['Plex']['use_plex'] = int(USE_PLEX)1493 new_config['Plex']['plex_notify_onsnatch'] = int(PLEX_NOTIFY_ONSNATCH)1494 new_config['Plex']['plex_notify_ondownload'] = int(PLEX_NOTIFY_ONDOWNLOAD)1495 new_config['Plex']['plex_notify_onsubtitledownload'] = int(PLEX_NOTIFY_ONSUBTITLEDOWNLOAD)1496 new_config['Plex']['plex_update_library'] = int(PLEX_UPDATE_LIBRARY)1497 new_config['Plex']['plex_server_host'] = PLEX_SERVER_HOST1498 new_config['Plex']['plex_host'] = PLEX_HOST1499 new_config['Plex']['plex_username'] = PLEX_USERNAME1500 new_config['Plex']['plex_password'] = helpers.encrypt(PLEX_PASSWORD, ENCRYPTION_VERSION)15011502 new_config['Growl'] = {}1503 new_config['Growl']['use_growl'] = int(USE_GROWL)1504 new_config['Growl']['growl_notify_onsnatch'] = int(GROWL_NOTIFY_ONSNATCH)1505 new_config['Growl']['growl_notify_ondownload'] = int(GROWL_NOTIFY_ONDOWNLOAD)1506 new_config['Growl']['growl_notify_onsubtitledownload'] = int(GROWL_NOTIFY_ONSUBTITLEDOWNLOAD)1507 new_config['Growl']['growl_host'] = GROWL_HOST1508 new_config['Growl']['growl_password'] = helpers.encrypt(GROWL_PASSWORD, ENCRYPTION_VERSION)15091510 new_config['Prowl'] = {}1511 new_config['Prowl']['use_prowl'] = int(USE_PROWL)1512 new_config['Prowl']['prowl_notify_onsnatch'] = int(PROWL_NOTIFY_ONSNATCH)1513 new_config['Prowl']['prowl_notify_ondownload'] = int(PROWL_NOTIFY_ONDOWNLOAD)1514 new_config['Prowl']['prowl_notify_onsubtitledownload'] = int(PROWL_NOTIFY_ONSUBTITLEDOWNLOAD)1515 new_config['Prowl']['prowl_api'] = PROWL_API1516 new_config['Prowl']['prowl_priority'] = PROWL_PRIORITY15171518 new_config['Twitter'] = {}1519 new_config['Twitter']['use_twitter'] = int(USE_TWITTER)1520 new_config['Twitter']['twitter_notify_onsnatch'] = int(TWITTER_NOTIFY_ONSNATCH)1521 new_config['Twitter']['twitter_notify_ondownload'] = int(TWITTER_NOTIFY_ONDOWNLOAD)1522 new_config['Twitter']['twitter_notify_onsubtitledownload'] = int(TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD)1523 new_config['Twitter']['twitter_username'] = TWITTER_USERNAME1524 new_config['Twitter']['twitter_password'] = helpers.encrypt(TWITTER_PASSWORD, ENCRYPTION_VERSION)1525 new_config['Twitter']['twitter_prefix'] = TWITTER_PREFIX15261527 new_config['Boxcar'] = {}1528 new_config['Boxcar']['use_boxcar'] = int(USE_BOXCAR)1529 new_config['Boxcar']['boxcar_notify_onsnatch'] = int(BOXCAR_NOTIFY_ONSNATCH)1530 new_config['Boxcar']['boxcar_notify_ondownload'] = int(BOXCAR_NOTIFY_ONDOWNLOAD)1531 new_config['Boxcar']['boxcar_notify_onsubtitledownload'] = int(BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD)1532 new_config['Boxcar']['boxcar_username'] = BOXCAR_USERNAME15331534 new_config['Pushover'] = {}1535 new_config['Pushover']['use_pushover'] = int(USE_PUSHOVER)1536 new_config['Pushover']['pushover_notify_onsnatch'] = int(PUSHOVER_NOTIFY_ONSNATCH)1537 new_config['Pushover']['pushover_notify_ondownload'] = int(PUSHOVER_NOTIFY_ONDOWNLOAD)1538 new_config['Pushover']['pushover_notify_onsubtitledownload'] = int(PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD)1539 new_config['Pushover']['pushover_userkey'] = PUSHOVER_USERKEY15401541 new_config['Libnotify'] = {}1542 new_config['Libnotify']['use_libnotify'] = int(USE_LIBNOTIFY)1543 new_config['Libnotify']['libnotify_notify_onsnatch'] = int(LIBNOTIFY_NOTIFY_ONSNATCH)1544 new_config['Libnotify']['libnotify_notify_ondownload'] = int(LIBNOTIFY_NOTIFY_ONDOWNLOAD)1545 new_config['Libnotify']['libnotify_notify_onsubtitledownload'] = int(LIBNOTIFY_NOTIFY_ONSUBTITLEDOWNLOAD)15461547 new_config['NMJ'] = {}1548 new_config['NMJ']['use_nmj'] = int(USE_NMJ)1549 new_config['NMJ']['nmj_host'] = NMJ_HOST1550 new_config['NMJ']['nmj_database'] = NMJ_DATABASE1551 new_config['NMJ']['nmj_mount'] = NMJ_MOUNT15521553 new_config['NMJv2'] = {}1554 new_config['NMJv2']['use_nmjv2'] = int(USE_NMJv2)1555 new_config['NMJv2']['nmjv2_host'] = NMJv2_HOST1556 new_config['NMJv2']['nmjv2_database'] = NMJv2_DATABASE1557 new_config['NMJv2']['nmjv2_dbloc'] = NMJv2_DBLOC15581559 new_config['Synology'] = {}1560 new_config['Synology']['use_synoindex'] = int(USE_SYNOINDEX)15611562 new_config['SynologyNotifier'] = {}1563 new_config['SynologyNotifier']['use_synologynotifier'] = int(USE_SYNOLOGYNOTIFIER)1564 new_config['SynologyNotifier']['synologynotifier_notify_onsnatch'] = int(SYNOLOGYNOTIFIER_NOTIFY_ONSNATCH)1565 new_config['SynologyNotifier']['synologynotifier_notify_ondownload'] = int(SYNOLOGYNOTIFIER_NOTIFY_ONDOWNLOAD)1566 new_config['SynologyNotifier']['synologynotifier_notify_onsubtitledownload'] = int(SYNOLOGYNOTIFIER_NOTIFY_ONSUBTITLEDOWNLOAD)15671568 new_config['Trakt'] = {}1569 new_config['Trakt']['use_trakt'] = int(USE_TRAKT)1570 new_config['Trakt']['trakt_username'] = TRAKT_USERNAME1571 new_config['Trakt']['trakt_password'] = helpers.encrypt(TRAKT_PASSWORD, ENCRYPTION_VERSION)1572 new_config['Trakt']['trakt_api'] = TRAKT_API1573 new_config['Trakt']['trakt_remove_watchlist'] = int(TRAKT_REMOVE_WATCHLIST)1574 new_config['Trakt']['trakt_use_watchlist'] = int(TRAKT_USE_WATCHLIST)1575 new_config['Trakt']['trakt_method_add'] = TRAKT_METHOD_ADD1576 new_config['Trakt']['trakt_start_paused'] = int(TRAKT_START_PAUSED)15771578 new_config['pyTivo'] = {}1579 new_config['pyTivo']['use_pytivo'] = int(USE_PYTIVO)1580 new_config['pyTivo']['pytivo_notify_onsnatch'] = int(PYTIVO_NOTIFY_ONSNATCH)1581 new_config['pyTivo']['pytivo_notify_ondownload'] = int(PYTIVO_NOTIFY_ONDOWNLOAD)1582 new_config['pyTivo']['pytivo_notify_onsubtitledownload'] = int(PYTIVO_NOTIFY_ONSUBTITLEDOWNLOAD)1583 new_config['pyTivo']['pyTivo_update_library'] = int(PYTIVO_UPDATE_LIBRARY)1584 new_config['pyTivo']['pytivo_host'] = PYTIVO_HOST1585 new_config['pyTivo']['pytivo_share_name'] = PYTIVO_SHARE_NAME1586 new_config['pyTivo']['pytivo_tivo_name'] = PYTIVO_TIVO_NAME15871588 new_config['NMA'] = {}1589 new_config['NMA']['use_nma'] = int(USE_NMA)1590 new_config['NMA']['nma_notify_onsnatch'] = int(NMA_NOTIFY_ONSNATCH)1591 new_config['NMA']['nma_notify_ondownload'] = int(NMA_NOTIFY_ONDOWNLOAD)1592 new_config['NMA']['nma_notify_onsubtitledownload'] = int(NMA_NOTIFY_ONSUBTITLEDOWNLOAD)1593 new_config['NMA']['nma_api'] = NMA_API1594 new_config['NMA']['nma_priority'] = NMA_PRIORITY15951596 new_config['Pushalot'] = {}1597 new_config['Pushalot']['use_pushalot'] = int(USE_PUSHALOT)1598 new_config['Pushalot']['pushalot_notify_onsnatch'] = int(PUSHALOT_NOTIFY_ONSNATCH)1599 new_config['Pushalot']['pushalot_notify_ondownload'] = int(PUSHALOT_NOTIFY_ONDOWNLOAD)1600 new_config['Pushalot']['pushalot_notify_onsubtitledownload'] = int(PUSHALOT_NOTIFY_ONSUBTITLEDOWNLOAD)1601 new_config['Pushalot']['pushalot_authorizationtoken'] = PUSHALOT_AUTHORIZATIONTOKEN16021603 new_config['Pushbullet'] = {}1604 new_config['Pushbullet']['use_pushbullet'] = int(USE_PUSHBULLET)1605 new_config['Pushbullet']['pushbullet_notify_onsnatch'] = int(PUSHBULLET_NOTIFY_ONSNATCH)1606 new_config['Pushbullet']['pushbullet_notify_ondownload'] = int(PUSHBULLET_NOTIFY_ONDOWNLOAD)1607 new_config['Pushbullet']['pushbullet_notify_onsubtitledownload'] = int(PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD)1608 new_config['Pushbullet']['pushbullet_api'] = PUSHBULLET_API1609 new_config['Pushbullet']['pushbullet_device'] = PUSHBULLET_DEVICE161016111612 new_config['Email'] = {}1613 new_config['Email']['use_email'] = int(USE_EMAIL)1614 new_config['Email']['email_notify_onsnatch'] = int(EMAIL_NOTIFY_ONSNATCH)1615 new_config['Email']['email_notify_ondownload'] = int(EMAIL_NOTIFY_ONDOWNLOAD)1616 new_config['Email']['email_notify_onsubtitledownload'] = int(EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD)1617 new_config['Email']['email_host'] = EMAIL_HOST1618 new_config['Email']['email_port'] = int(EMAIL_PORT)1619 new_config['Email']['email_tls'] = int(EMAIL_TLS)1620 new_config['Email']['email_user'] = EMAIL_USER1621 new_config['Email']['email_password'] = helpers.encrypt(EMAIL_PASSWORD, ENCRYPTION_VERSION)1622 new_config['Email']['email_from'] = EMAIL_FROM1623 new_config['Email']['email_list'] = EMAIL_LIST16241625 new_config['Newznab'] = {}1626 new_config['Newznab']['newznab_data'] = NEWZNAB_DATA16271628 new_config['TorrentRss'] = {}1629 new_config['TorrentRss']['torrentrss_data'] = '!!!'.join([x.configStr() for x in torrentRssProviderList])16301631 new_config['GUI'] = {}1632 new_config['GUI']['gui_name'] = GUI_NAME1633 new_config['GUI']['home_layout'] = HOME_LAYOUT1634 new_config['GUI']['history_layout'] = HISTORY_LAYOUT1635 new_config['GUI']['display_show_specials'] = int(DISPLAY_SHOW_SPECIALS)1636 new_config['GUI']['coming_eps_layout'] = COMING_EPS_LAYOUT1637 new_config['GUI']['coming_eps_display_paused'] = int(COMING_EPS_DISPLAY_PAUSED)1638 new_config['GUI']['coming_eps_sort'] = COMING_EPS_SORT1639 new_config['GUI']['coming_eps_missed_range'] = int(COMING_EPS_MISSED_RANGE)1640 new_config['GUI']['date_preset'] = DATE_PRESET1641 new_config['GUI']['time_preset'] = TIME_PRESET_W_SECONDS16421643 new_config['Subtitles'] = {}1644 new_config['Subtitles']['use_subtitles'] = int(USE_SUBTITLES)1645 new_config['Subtitles']['subtitles_languages'] = ','.join(SUBTITLES_LANGUAGES)1646 new_config['Subtitles']['SUBTITLES_SERVICES_LIST'] = ','.join(SUBTITLES_SERVICES_LIST)1647 new_config['Subtitles']['SUBTITLES_SERVICES_ENABLED'] = '|'.join([str(x) for x in SUBTITLES_SERVICES_ENABLED])1648 new_config['Subtitles']['subtitles_dir'] = SUBTITLES_DIR1649 new_config['Subtitles']['subtitles_default'] = int(SUBTITLES_DEFAULT)1650 new_config['Subtitles']['subtitles_history'] = int(SUBTITLES_HISTORY)1651 new_config['Subtitles']['subtitles_finder_frequency'] = int(SUBTITLES_FINDER_FREQUENCY)16521653 new_config['FailedDownloads']= {}1654 new_config['FailedDownloads']['use_failed_downloads'] = int(USE_FAILED_DOWNLOADS)1655 new_config['FailedDownloads']['delete_failed'] = int(DELETE_FAILED)16561657 new_config.write()165816591660def launchBrowser(startPort=None):1661 if not startPort:1662 startPort = WEB_PORT1663 if ENABLE_HTTPS:1664 browserURL = 'https://localhost:%d%s' % (startPort, WEB_ROOT)1665 else:1666 browserURL = 'http://localhost:%d%s' % (startPort, WEB_ROOT)1667 try:1668 webbrowser.open(browserURL, 2, 1)1669 except:1670 try:1671 webbrowser.open(browserURL, 1, 1)1672 except:1673 logger.log(u"Unable to launch a browser", logger.ERROR)16741675def getEpList(epIDs, showid=None):16761677 if epIDs == None or len(epIDs) == 0:1678 return []16791680 query = "SELECT * FROM tv_episodes WHERE tvdbid in (%s)" % (",".join(['?']*len(epIDs)),)1681 params = epIDs16821683 if showid != None:1684 query += " AND showid = ?"1685 params.append(showid)16861687 myDB = db.DBConnection()1688 sqlResults = myDB.select(query, params)16891690 epList = []16911692 for curEp in sqlResults:1693 curShowObj = helpers.findCertainShow(showList, int(curEp["showid"]))1694 curEpObj = curShowObj.getEpisode(int(curEp["season"]), int(curEp["episode"]))1695 epList.append(curEpObj)1696 ...

Full Screen

Full Screen

adwind.py

Source:adwind.py Github

copy

Full Screen

1# Originally written by Kevin Breen (@KevTheHermit):2# https://github.com/kevthehermit/RATDecoders/blob/master/AdWind.py3import string4import binascii5from zipfile import ZipFile6from cStringIO import StringIO7from Crypto.Cipher import ARC4, DES8import xml.etree.ElementTree as ET9def sortConfig(old_config):10 if old_config['Version'] == 'Adwind RAT v1.0':11 new_config = {}12 new_config['Version'] = old_config['Version']13 new_config['Delay'] = old_config['delay']14 new_config['Domain'] = old_config['dns']15 new_config['Install Flag'] = old_config['instalar']16 new_config['Jar Name'] = old_config['jarname']17 new_config['Reg Key'] = old_config['keyClase']18 new_config['Install Folder'] = old_config['nombreCarpeta']19 new_config['Password'] = old_config['password']20 new_config['Campaign ID'] = old_config['prefijo']21 new_config['Port1'] = old_config['puerto1']22 new_config['Port2'] = old_config['puerto2']23 new_config['Reg Value'] = old_config['regname']24 return new_config25 if old_config['Version'] == 'Adwind RAT v2.0':26 new_config = {}27 new_config['Version'] = old_config['Version']28 new_config['Delay'] = old_config['delay']29 new_config['Domain'] = old_config['dns']30 new_config['Install Flag'] = old_config['instalar']31 new_config['Reg Key'] = old_config['keyClase']32 new_config['Password'] = old_config['password']33 new_config['Campaign ID'] = old_config['prefijo']34 new_config['Port1'] = old_config['puerto']35 return new_config36 return old_config37 38def decrypt_des(enckey, data):39 cipher = DES.new(enckey, DES.MODE_ECB) # set the ciper40 return cipher.decrypt(data) # decrpyt the data41 42def decrypt_rc4(enckey, data):43 cipher = ARC4.new(enckey) # set the ciper44 return cipher.decrypt(data) # decrpyt the data45def config(data):46 Key = "awenubisskqi"47 newZip = StringIO(data)48 raw_config = {}49 with ZipFile(newZip, 'r') as zip:50 for name in zip.namelist():51 if name == "config.xml": # contains the encryption key52 # We need two attempts here first try DES for V1 If not try RC4 for V253 try:54 config = zip.read(name)55 result = decrypt_des(Key[:-4], config)56 except:57 config = zip.read(name)58 result = decrypt_rc4(Key, config) 59 xml = filter(lambda x: x in string.printable, result)60 root = ET.fromstring(xml)61 for child in root:62 if child.text.startswith("Adwind RAT"):63 raw_config['Version'] = child.text64 else:65 raw_config[child.attrib['key']] = child.text66 new_config = sortConfig(raw_config)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tox automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful