def searchProviders(show, season, episode=None, manualSearch=False): logger.log(u"Searching for stuff we need from " + show.name + " season " + str(season)) foundResults = {} didSearch = False seasonSearch = False # gather all episodes for season and then pick out the wanted episodes and compare to determin if we want whole season or just a few episodes if episode is None: seasonEps = show.getAllEpisodes(season) wantedEps = [x for x in seasonEps if show.getOverview(x.status) in (Overview.WANTED, Overview.QUAL)] if len(seasonEps) == len(wantedEps): seasonSearch = True else: ep_obj = show.getEpisode(season, episode) wantedEps = [ep_obj] for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue # update cache if manualSearch: curProvider.cache.updateCache() # search cache first for wanted episodes for ep_obj in wantedEps: curResults = curProvider.cache.searchCache(ep_obj, manualSearch) curResults = filterSearchResults(show, curResults) if len(curResults): foundResults.update(curResults) logger.log(u"Cache results: " + repr(foundResults), logger.DEBUG) didSearch = True if not len(foundResults): for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue try: curResults = curProvider.getSearchResults(show, season, wantedEps, seasonSearch, manualSearch) except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) continue except Exception, e: logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR) logger.log(traceback.format_exc(), logger.DEBUG) continue # finished searching this provider successfully didSearch = True curResults = filterSearchResults(show, curResults) if len(curResults): foundResults.update(curResults) logger.log(u"Provider search results: " + str(foundResults), logger.DEBUG)
def findSeason(show, season): logger.log(u"Searching for stuff we need from "+show.name+" season "+str(season)) foundResults = {} didSearch = False for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue try: curResults = curProvider.findSeasonResults(show, season) # make a list of all the results for this provider for curEp in curResults: # skip non-tv crap curResults[curEp] = filter(lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name, show), curResults[curEp]) if curEp in foundResults: foundResults[curEp] += curResults[curEp] else: foundResults[curEp] = curResults[curEp] except exceptions.AuthException, e: logger.log(u"Authentication error: "+str(e).decode('utf-8'), logger.ERROR) continue except Exception, e: logger.log(u"Error while searching "+curProvider.name+", skipping: "+str(e).decode('utf-8'), logger.ERROR) logger.log(traceback.format_exc(), logger.DEBUG) continue
def _getProperList(self): propers = {} # for each provider get a list of the propers for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue search_date = datetime.datetime.today() - datetime.timedelta( days=2) logger.log(u"Searching for any new PROPER releases from " + curProvider.name) try: curPropers = curProvider.findPropers(search_date) except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) continue # if they haven't been added by a different provider than add the proper to the list for x in curPropers: name = self._genericName(x.name) if not name in propers: logger.log(u"Found new proper: " + x.name, logger.DEBUG) x.provider = curProvider propers[name] = x
def get_data(self, url): result = None data_json = self.get_url(url % dict(ts=self.ts()), parse_json=True) if self.should_skip(): return result url = data_json.get('url', '') if url.lower().startswith('magnet:'): result = url else: from sickbeard import providers if 'torlock' in url.lower(): prov = next( filter_iter( lambda p: 'torlock' == p.name.lower(), (filter_iter( lambda sp: sp.providerType == self.providerType, providers.sortedProviderList())))) state = prov.enabled prov.enabled = True _ = prov.url prov.enabled = state if prov.url: try: result = prov.urls.get('get', '') % re.findall( r'(\d+).torrent', url)[0] except (IndexError, TypeError): pass return result
def _getProperList(self): propers = {} # for each provider get a list of the propers for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue search_date = datetime.datetime.today() - datetime.timedelta(days=2) logger.log(u"Searching for any new PROPER releases from " + curProvider.name) try: curPropers = curProvider.findPropers(search_date) except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) continue # if they haven't been added by a different provider than add the proper to the list for x in curPropers: time.sleep(0.01) showObj = helpers.findCertainShow(sickbeard.showList, x.indexerid) if not showObj: logger.log(u"Unable to find the show we watch with indexerID " + str(x.indexerid), logger.ERROR) continue name = self._genericName(x.name) if not name in propers: logger.log(u"Found new proper: " + x.name, logger.DEBUG) x.provider = curProvider propers[name] = x
def searchForNeededEpisodes(): logger.log(u"Searching all providers for any needed episodes") foundResults = {} didSearch = False # ask all providers for any episodes it finds for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue curFoundResults = {} try: curFoundResults = curProvider.searchRSS() except exceptions.AuthException, e: logger.log(u"Authentication error: "+str(e).decode('utf-8'), logger.ERROR) continue except Exception, e: logger.log(u"Error while searching "+curProvider.name+", skipping: "+str(e).decode('utf-8'), logger.ERROR) logger.log(traceback.format_exc(), logger.DEBUG) continue
def _getProperList(self): propers = {} # for each provider get a list of the propers for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue search_date = datetime.datetime.today() - datetime.timedelta(days=2) logger.log(u"Searching for any new PROPER releases from " + curProvider.name) try: curPropers = curProvider.findPropers(search_date) except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) continue # if they haven't been added by a different provider than add the proper to the list for x in curPropers: name = self._genericName(x.name) if not name in propers: logger.log(u"Found new proper: " + x.name, logger.DEBUG) x.provider = curProvider propers[name] = x
def searchForNeededEpisodes(): logger.log(u"Searching all providers for any needed episodes") foundResults = {} didSearch = False # ask all providers for any episodes it finds for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue curFoundResults = {} try: curFoundResults = curProvider.searchRSS() except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) continue except Exception, e: logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR) logger.log(traceback.format_exc(), logger.DEBUG) continue
def findSeason(show, season): logger.log(u"Searching for stuff we need from " + show.name + " season " + str(season)) foundResults = {} didSearch = False for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue try: curResults = curProvider.findSeasonResults(show, season) # make a list of all the results for this provider for curEp in curResults: # skip non-tv crap curResults[curEp] = filter(lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name, show), curResults[curEp]) if curEp in foundResults: foundResults[curEp] += curResults[curEp] else: foundResults[curEp] = curResults[curEp] except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) continue except Exception, e: logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR) logger.log(traceback.format_exc(), logger.DEBUG) continue
def findEpisode(episode, manualSearch=False): logger.log(u"Searching for " + episode.prettyName()) foundResults = [] didSearch = False for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue try: curFoundResults = curProvider.findEpisode( episode, manualSearch=manualSearch) except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) continue except Exception, e: logger.log( u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR) logger.log(traceback.format_exc(), logger.DEBUG) continue
def findSeason(show, season): myDB = db.DBConnection() allEps = [int(x["episode"]) for x in myDB.select("SELECT episode FROM tv_episodes WHERE showid = ? AND season = ?", [show.tvdbid, season])] logger.log(u"Episode list: "+str(allEps), logger.DEBUG) reallywanted=[] notwanted=[] finalResults = [] for curEpNum in allEps: sqlResults = myDB.select("SELECT status FROM tv_episodes WHERE showid = ? AND season = ? AND episode = ?", [show.tvdbid, season, curEpNum]) epStatus = int(sqlResults[0]["status"]) if epStatus ==3: reallywanted.append(curEpNum) else: notwanted.append(curEpNum) if notwanted != []: for EpNum in reallywanted: showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, show.tvdbid) episode = showObj.getEpisode(season, EpNum) res=findEpisode(episode, manualSearch=True) snatchEpisode(res) return else: logger.log(u"Searching for stuff we need from "+show.name+" season "+str(season)) foundResults = {} didSearch = False for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue try: curResults = curProvider.findSeasonResults(show, season) # make a list of all the results for this provider for curEp in curResults: # skip non-tv crap curResults[curEp] = filter(lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name, show), curResults[curEp]) if curEp in foundResults: foundResults[curEp] += curResults[curEp] else: foundResults[curEp] = curResults[curEp] except exceptions.AuthException, e: logger.log(u"Authentication error: "+ex(e), logger.ERROR) continue except Exception, e: logger.log(u"Error while searching "+curProvider.name+", skipping: "+ex(e), logger.DEBUG) logger.log(traceback.format_exc(), logger.DEBUG) continue didSearch = True
def searchProviders(show, season, episode=None, manualSearch=False): logger.log(u"Searching for stuff we need from " + show.name + " season " + str(season)) foundResults = {} didSearch = False seasonSearch = False # gather all episodes for season and then pick out the wanted episodes and compare to determin if we want whole season or just a few episodes if episode is None: seasonEps = show.getAllEpisodes(season) wantedEps = [ x for x in seasonEps if show.getOverview(x.status) in (Overview.WANTED, Overview.QUAL) ] if len(seasonEps) == len(wantedEps): seasonSearch = True else: ep_obj = show.getEpisode(season, episode) wantedEps = [ep_obj] for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue try: curResults = curProvider.getSearchResults(show, season, wantedEps, seasonSearch, manualSearch) # make a list of all the results for this provider for curEp in curResults: # skip non-tv crap curResults[curEp] = filter( lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name, show), curResults[curEp]) if curEp in foundResults: foundResults[curEp] += curResults[curEp] else: foundResults[curEp] = curResults[curEp] except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) continue except Exception, e: logger.log( u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR) logger.log(traceback.format_exc(), logger.DEBUG) continue
def _migrate_v6(self): sickbeard.RECENTSEARCH_FREQUENCY = check_setting_int(self.config_obj, 'General', 'dailysearch_frequency', sickbeard.DEFAULT_RECENTSEARCH_FREQUENCY) sickbeard.RECENTSEARCH_STARTUP = bool(check_setting_int(self.config_obj, 'General', 'dailysearch_startup', 1)) if sickbeard.RECENTSEARCH_FREQUENCY < sickbeard.MIN_RECENTSEARCH_FREQUENCY: sickbeard.RECENTSEARCH_FREQUENCY = sickbeard.MIN_RECENTSEARCH_FREQUENCY for curProvider in providers.sortedProviderList(): if hasattr(curProvider, 'enable_recentsearch'): curProvider.enable_recentsearch = bool(check_setting_int( self.config_obj, curProvider.get_id().upper(), curProvider.get_id() + '_enable_dailysearch', 1))
def searchProviders(show, season, episode=None, manualSearch=False): logger.log(u"Searching for stuff we need from " + show.name + " season " + str(season)) foundResults = {} didSearch = False seasonSearch = False # gather all episodes for season and then pick out the wanted episodes and compare to determin if we want whole season or just a few episodes if episode is None: seasonEps = show.getAllEpisodes(season) wantedEps = [x for x in seasonEps if show.getOverview(x.status) in (Overview.WANTED, Overview.QUAL)] if len(seasonEps) == len(wantedEps): seasonSearch = True else: ep_obj = show.getEpisode(season, episode) wantedEps = [ep_obj] for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue try: curResults = curProvider.getSearchResults(show, season, wantedEps, seasonSearch, manualSearch) # make a list of all the results for this provider for curEp in curResults: # skip non-tv crap curResults[curEp] = filter( lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name, show), curResults[curEp]) if curEp in foundResults: foundResults[curEp] += curResults[curEp] else: foundResults[curEp] = curResults[curEp] except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) continue except Exception, e: logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR) logger.log(traceback.format_exc(), logger.DEBUG) continue
def _migrate_v6(self): sickbeard.RECENTSEARCH_FREQUENCY = check_setting_int( self.config_obj, 'General', 'dailysearch_frequency', sickbeard.DEFAULT_RECENTSEARCH_FREQUENCY) sickbeard.RECENTSEARCH_STARTUP = bool( check_setting_int(self.config_obj, 'General', 'dailysearch_startup', 1)) if sickbeard.RECENTSEARCH_FREQUENCY < sickbeard.MIN_RECENTSEARCH_FREQUENCY: sickbeard.RECENTSEARCH_FREQUENCY = sickbeard.MIN_RECENTSEARCH_FREQUENCY for curProvider in providers.sortedProviderList(): if hasattr(curProvider, 'enable_recentsearch'): curProvider.enable_recentsearch = bool( check_setting_int( self.config_obj, curProvider.get_id().upper(), curProvider.get_id() + '_enable_dailysearch', 1))
def searchProviders(show, season, episodes, seasonSearch=False, manualSearch=False): logger.log(u"Searching for stuff we need from " + show.name + " season " + str(season)) foundResults = {} didSearch = False for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue try: curResults = curProvider.findSearchResults(show, season, episodes, seasonSearch, manualSearch) except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) continue except Exception, e: logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR) logger.log(traceback.format_exc(), logger.DEBUG) continue
def findEpisode(episode, manualSearch=False): logger.log(u"Searching for " + episode.prettyName()) foundResults = [] didSearch = False for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue try: curFoundResults = curProvider.findEpisode(episode, manualSearch=manualSearch) except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) continue except Exception, e: logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR) logger.log(traceback.format_exc(), logger.DEBUG) continue
def get_data(self, url): result = None data_json = self.get_url(url % dict(ts=self.ts()), json=True) if self.should_skip(): return result url = data_json.get('url', '') if url.lower().startswith('magnet:'): result = url else: from sickbeard import providers if 'torlock' in url.lower(): prov = (filter(lambda p: 'torlock' == p.name.lower(), (filter( lambda sp: sp.providerType == self.providerType, providers.sortedProviderList()))))[0] state = prov.enabled prov.enabled = True _ = prov.url prov.enabled = state if prov.url: try: result = prov.urls.get('get', '') % re.findall(r'(\d+).torrent', url)[0] except (IndexError, TypeError): pass return result
def save_config(): CFG['General']['log_dir'] = LOG_DIR CFG['General']['web_port'] = WEB_PORT CFG['General']['web_host'] = WEB_HOST CFG['General']['web_log'] = int(WEB_LOG) CFG['General']['web_root'] = WEB_ROOT CFG['General']['web_username'] = WEB_USERNAME CFG['General']['web_password'] = WEB_PASSWORD CFG['General']['nzb_method'] = NZB_METHOD CFG['General']['usenet_retention'] = int(USENET_RETENTION) CFG['General']['search_frequency'] = int(SEARCH_FREQUENCY) CFG['General']['backlog_search_frequency'] = int(BACKLOG_SEARCH_FREQUENCY) CFG['General']['use_nzb'] = int(USE_NZB) CFG['General']['quality_default'] = int(QUALITY_DEFAULT) CFG['General']['season_folders_default'] = int(SEASON_FOLDERS_DEFAULT) CFG['General']['provider_order'] = ' '.join([x.getID() for x in providers.sortedProviderList()]) CFG['General']['version_notify'] = int(VERSION_NOTIFY) CFG['General']['naming_ep_name'] = int(NAMING_EP_NAME) CFG['General']['naming_show_name'] = int(NAMING_SHOW_NAME) CFG['General']['naming_ep_type'] = int(NAMING_EP_TYPE) CFG['General']['naming_multi_ep_type'] = int(NAMING_MULTI_EP_TYPE) CFG['General']['naming_sep_type'] = int(NAMING_SEP_TYPE) CFG['General']['naming_use_periods'] = int(NAMING_USE_PERIODS) CFG['General']['naming_quality'] = int(NAMING_QUALITY) CFG['General']['naming_dates'] = int(NAMING_DATES) CFG['General']['use_torrent'] = int(USE_TORRENT) CFG['General']['launch_browser'] = int(LAUNCH_BROWSER) CFG['General']['create_metadata'] = int(CREATE_METADATA) CFG['General']['create_images'] = int(CREATE_IMAGES) CFG['General']['cache_dir'] = CACHE_DIR CFG['General']['tv_download_dir'] = TV_DOWNLOAD_DIR CFG['General']['keep_processed_dir'] = int(KEEP_PROCESSED_DIR) CFG['General']['process_automatically'] = int(PROCESS_AUTOMATICALLY) CFG['General']['rename_episodes'] = int(RENAME_EPISODES) CFG['Blackhole']['nzb_dir'] = NZB_DIR CFG['Blackhole']['torrent_dir'] = TORRENT_DIR CFG['TVBinz']['tvbinz'] = int(TVBINZ) CFG['TVBinz']['tvbinz_uid'] = TVBINZ_UID CFG['TVBinz']['tvbinz_sabuid'] = TVBINZ_SABUID CFG['TVBinz']['tvbinz_hash'] = TVBINZ_HASH CFG['TVBinz']['tvbinz_auth'] = TVBINZ_AUTH CFG['NZBs']['nzbs'] = int(NZBS) CFG['NZBs']['nzbs_uid'] = NZBS_UID CFG['NZBs']['nzbs_hash'] = NZBS_HASH CFG['NZBsRUS']['nzbsrus'] = int(NZBSRUS) CFG['NZBsRUS']['nzbsrus_uid'] = NZBSRUS_UID CFG['NZBsRUS']['nzbsrus_hash'] = NZBSRUS_HASH CFG['NZBMatrix']['nzbmatrix'] = int(NZBMATRIX) CFG['NZBMatrix']['nzbmatrix_username'] = NZBMATRIX_USERNAME CFG['NZBMatrix']['nzbmatrix_apikey'] = NZBMATRIX_APIKEY CFG['Bin-Req']['binreq'] = int(BINREQ) CFG['SABnzbd']['sab_username'] = SAB_USERNAME CFG['SABnzbd']['sab_password'] = SAB_PASSWORD CFG['SABnzbd']['sab_apikey'] = SAB_APIKEY CFG['SABnzbd']['sab_category'] = SAB_CATEGORY CFG['SABnzbd']['sab_host'] = SAB_HOST CFG['XBMC']['xbmc_notify_onsnatch'] = int(XBMC_NOTIFY_ONSNATCH) CFG['XBMC']['xbmc_notify_ondownload'] = int(XBMC_NOTIFY_ONDOWNLOAD) CFG['XBMC']['xbmc_update_library'] = int(XBMC_UPDATE_LIBRARY) CFG['XBMC']['xbmc_update_full'] = int(XBMC_UPDATE_FULL) CFG['XBMC']['xbmc_host'] = XBMC_HOST CFG['XBMC']['xbmc_username'] = XBMC_USERNAME CFG['XBMC']['xbmc_password'] = XBMC_PASSWORD CFG['Growl']['use_growl'] = int(USE_GROWL) CFG['Growl']['growl_host'] = GROWL_HOST CFG['Growl']['growl_password'] = GROWL_PASSWORD CFG['Newznab']['newznab_data'] = '!!!'.join([x.configStr() for x in newznabProviderList]) CFG.write()
def run(self, force=None, show=None): if sickbeard.showList == None: return logger.log(u"Beginning the search for french episodes older than " + str(sickbeard.FRENCH_DELAY) + " days") foundResults = {} finalResults = [] #show = self frenchlist = [] #get list of english episodes that we want to search in french myDB = db.DBConnection() today = datetime.date.today().toordinal() if show: frenchsql = myDB.select( "SELECT showid, season, episode from tv_episodes where audio_langs='eng' and tv_episodes.showid =? and (? - tv_episodes.airdate) > ? order by showid, airdate asc", [show, today, sickbeard.FRENCH_DELAY]) logger.log( "SELECT showid, season, episode from tv_episodes where audio_langs='eng' and tv_episodes.showid =" + str(show) + "and (" + str(today) + " - tv_episodes.airdate) > " + str(sickbeard.FRENCH_DELAY) + "order by showid, airdate asc") count = myDB.select( "SELECT count(*) from tv_episodes where audio_langs='eng' and tv_episodes.showid =? and (? - tv_episodes.airdate) > ?", [show, today, sickbeard.FRENCH_DELAY]) else: frenchsql = myDB.select( "SELECT showid, season, episode from tv_episodes, tv_shows where audio_langs='eng' and tv_episodes.showid = tv_shows.indexer_id and tv_shows.frenchsearch = 1 and (? - tv_episodes.airdate) > ? order by showid, airdate asc", [today, sickbeard.FRENCH_DELAY]) count = myDB.select( "SELECT count(*) from tv_episodes, tv_shows where audio_langs='eng' and tv_episodes.showid = tv_shows.indexer_id and tv_shows.frenchsearch = 1 and (? - tv_episodes.airdate) > ?", [today, sickbeard.FRENCH_DELAY]) #make the episodes objects #logger.log("SELECT showid, season, episode from tv_episodes where audio_langs='eng' and tv_episodes.showid =" + str(show) +"and (" +str(today)+" - tv_episodes.airdate) > "+ str(sickbeard.FRENCH_DELAY) +"order by showid, airdate asc") logger.log( "SELECT showid, season, episode from tv_episodes, tv_shows where audio_langs='eng' and tv_episodes.showid = tv_shows.indexer_id and tv_shows.frenchsearch = 1 and (" + str(today) + " - tv_episodes.airdate) > " + str(sickbeard.FRENCH_DELAY) + " order by showid, airdate asc") logger.log(u"Searching for " + str(count[0][0]) + " episodes in french") #logger.log(frenchsql) #logger.log(sickbeard.showList.) for episode in frenchsql: showObj = Show.find(sickbeard.showList, int(episode[0])) if showObj == None: logger.log("Show not in show list") #showObj = helpers.findCertainShow(sickbeard.showList, episode[0]) epObj = showObj.getEpisode(episode[1], episode[2]) #epObj = showObj.getEpisode(int(epInfo[0]), int(epInfo[1])) frenchlist.append(epObj) #for each episode in frenchlist fire a search in french delay = [] temp = None rest = count[0][0] for frepisode in frenchlist: rest = rest - 1 if frepisode.show.indexerid in delay: logger.log( u"Previous episode for show " + str(frepisode.show.name) + " not found in french so skipping this search", logger.DEBUG) continue result = [] for curProvider in providers.sortedProviderList(): foundResults[curProvider.name] = {} if not curProvider.is_active(): continue logger.log(u"Searching for french episode on " + curProvider.name + " for " + frepisode.show.name + " season " + str(frepisode.season) + " episode " + str(frepisode.episode)) #try: # logger.log(frepisode) # temp = GenericProvider() # curfrench = temp.findFrench(self, episode=frepisode, manualSearch=True) #curfrench = GenericProvider.findFrench(episode=frepi sode,manualSearch=True) #curProvider.findFrench(frepisode, manualSearch=True) #except: # logger.log(u"Exception", logger.DEBUG) # pass #for curProvider in providers: # if curProvider.anime_only and not show.is_anime: # logger.log(u"" + str(show.name) + " is not an anime, skipping", logger.DEBUG) # continue curfrench = curProvider.find_search_results( frepisode.show, frenchlist, 'sponly', True, True, 'french') #curfrench = curProvider.findFrench(frepisode, True) #temp = GenericProvider('temp') #curfrench = temp.findFrench( episode=frepisode, manualSearch=True) if len(curfrench): #make a list of all the results for this provider for curEp in curfrench: if curEp in foundResults: foundResults[ curProvider.name][curEp] += curfrench[curEp] else: foundResults[ curProvider.name][curEp] = curfrench[curEp] if not foundResults[curProvider.name]: continue bestSeasonResult = None #if SEASON_RESULT in foundResults[curProvider.name]: # bestSeasonResult = search.pickBestResult(foundResults[curProvider.name][SEASON_RESULT], show) #_______________________________________________________ test = 0 if foundResults[curProvider.name]: for cur_episode in foundResults[curProvider.name]: for x in foundResults[curProvider.name][cur_episode]: tmp = x if not show_name_helpers.filterBadReleases( x.name): #x.name): logger.log( u"French " + x.name + " isn't a valid scene release that we want, ignoring it", logger.DEBUG) test += 1 continue if sickbeard.IGNORE_WORDS == "": ignore_words = "ztreyfgut" else: ignore_words = str(sickbeard.IGNORE_WORDS) for fil in resultFilters + ignore_words.split(','): if fil == showLanguages.get(u"fre"): continue if re.search('(^|[\W_])' + fil + '($|[\W_])', x.url, re.I) or re.search( '(^|[\W_])' + fil + '($|[\W_])', x.name, re.I): logger.log( u"Invalid scene release: " + x.url + " contains " + fil + ", ignoring it", logger.DEBUG) test += 1 if test == 0: result.append(x) best = None try: epi = {} epi[1] = frepisode best = search.pickBestResult(result, showObj) except: pass if best: best.name = best.name + ' snatchedfr' logger.log(u"Found french episode for " + frepisode.show.name + " season " + str(frepisode.season) + " episode " + str(frepisode.episode)) try: search.snatchEpisode(best, SNATCHED_FRENCH) except: logger.log(u"Exception", logger.DEBUG) pass else: delay.append(frepisode.show.indexerid) logger.log(u"No french episode found for " + frepisode.show.name + " season " + str(frepisode.season) + " episode " + str(frepisode.episode)) logger.log(str(rest) + u" episodes left")
def save_config(): new_config = ConfigObj() new_config.filename = CONFIG_FILE new_config["General"] = {} new_config["General"]["log_dir"] = LOG_DIR new_config["General"]["web_port"] = WEB_PORT new_config["General"]["web_host"] = WEB_HOST new_config["General"]["web_ipv6"] = int(WEB_IPV6) new_config["General"]["web_log"] = int(WEB_LOG) new_config["General"]["web_root"] = WEB_ROOT new_config["General"]["web_username"] = WEB_USERNAME new_config["General"]["web_password"] = WEB_PASSWORD new_config["General"]["use_api"] = int(USE_API) new_config["General"]["api_key"] = API_KEY new_config["General"]["use_nzbs"] = int(USE_NZBS) new_config["General"]["use_torrents"] = int(USE_TORRENTS) new_config["General"]["nzb_method"] = NZB_METHOD new_config["General"]["usenet_retention"] = int(USENET_RETENTION) new_config["General"]["search_frequency"] = int(SEARCH_FREQUENCY) new_config["General"]["download_propers"] = int(DOWNLOAD_PROPERS) new_config["General"]["quality_default"] = int(QUALITY_DEFAULT) new_config["General"]["status_default"] = int(STATUS_DEFAULT) new_config["General"]["season_folders_format"] = SEASON_FOLDERS_FORMAT new_config["General"]["season_folders_default"] = int(SEASON_FOLDERS_DEFAULT) new_config["General"]["provider_order"] = " ".join([x.getID() for x in providers.sortedProviderList()]) new_config["General"]["version_notify"] = int(VERSION_NOTIFY) new_config["General"]["naming_ep_name"] = int(NAMING_EP_NAME) new_config["General"]["naming_show_name"] = int(NAMING_SHOW_NAME) new_config["General"]["naming_ep_type"] = int(NAMING_EP_TYPE) new_config["General"]["naming_multi_ep_type"] = int(NAMING_MULTI_EP_TYPE) new_config["General"]["naming_sep_type"] = int(NAMING_SEP_TYPE) new_config["General"]["naming_use_periods"] = int(NAMING_USE_PERIODS) new_config["General"]["naming_quality"] = int(NAMING_QUALITY) new_config["General"]["naming_dates"] = int(NAMING_DATES) new_config["General"]["launch_browser"] = int(LAUNCH_BROWSER) new_config["General"]["use_banner"] = int(USE_BANNER) new_config["General"]["use_listview"] = int(USE_LISTVIEW) new_config["General"]["metadata_xbmc"] = metadata_provider_dict["XBMC"].get_config() new_config["General"]["metadata_mediabrowser"] = metadata_provider_dict["MediaBrowser"].get_config() new_config["General"]["metadata_ps3"] = metadata_provider_dict["Sony PS3"].get_config() new_config["General"]["metadata_wdtv"] = metadata_provider_dict["WDTV"].get_config() new_config["General"]["metadata_tivo"] = metadata_provider_dict["TIVO"].get_config() new_config["General"]["cache_dir"] = ACTUAL_CACHE_DIR if ACTUAL_CACHE_DIR else "cache" new_config["General"]["root_dirs"] = ROOT_DIRS if ROOT_DIRS else "" new_config["General"]["tv_download_dir"] = TV_DOWNLOAD_DIR new_config["General"]["keep_processed_dir"] = int(KEEP_PROCESSED_DIR) new_config["General"]["move_associated_files"] = int(MOVE_ASSOCIATED_FILES) new_config["General"]["process_automatically"] = int(PROCESS_AUTOMATICALLY) new_config["General"]["rename_episodes"] = int(RENAME_EPISODES) new_config["General"]["extra_scripts"] = "|".join(EXTRA_SCRIPTS) new_config["General"]["git_path"] = GIT_PATH new_config["General"]["ignore_words"] = IGNORE_WORDS new_config["Blackhole"] = {} new_config["Blackhole"]["nzb_dir"] = NZB_DIR new_config["Blackhole"]["torrent_dir"] = TORRENT_DIR new_config["EZRSS"] = {} new_config["EZRSS"]["ezrss"] = int(EZRSS) new_config["TVTORRENTS"] = {} new_config["TVTORRENTS"]["tvtorrents"] = int(TVTORRENTS) new_config["TVTORRENTS"]["tvtorrents_digest"] = TVTORRENTS_DIGEST new_config["TVTORRENTS"]["tvtorrents_hash"] = TVTORRENTS_HASH new_config["NZBs"] = {} new_config["NZBs"]["nzbs"] = int(NZBS) new_config["NZBs"]["nzbs_uid"] = NZBS_UID new_config["NZBs"]["nzbs_hash"] = NZBS_HASH new_config["NZBsRUS"] = {} new_config["NZBsRUS"]["nzbsrus"] = int(NZBSRUS) new_config["NZBsRUS"]["nzbsrus_uid"] = NZBSRUS_UID new_config["NZBsRUS"]["nzbsrus_hash"] = NZBSRUS_HASH new_config["NZBMatrix"] = {} new_config["NZBMatrix"]["nzbmatrix"] = int(NZBMATRIX) new_config["NZBMatrix"]["nzbmatrix_username"] = NZBMATRIX_USERNAME new_config["NZBMatrix"]["nzbmatrix_apikey"] = NZBMATRIX_APIKEY new_config["Newzbin"] = {} new_config["Newzbin"]["newzbin"] = int(NEWZBIN) new_config["Newzbin"]["newzbin_username"] = NEWZBIN_USERNAME new_config["Newzbin"]["newzbin_password"] = NEWZBIN_PASSWORD new_config["Womble"] = {} new_config["Womble"]["womble"] = int(WOMBLE) new_config["SABnzbd"] = {} new_config["SABnzbd"]["sab_username"] = SAB_USERNAME new_config["SABnzbd"]["sab_password"] = SAB_PASSWORD new_config["SABnzbd"]["sab_apikey"] = SAB_APIKEY new_config["SABnzbd"]["sab_category"] = SAB_CATEGORY new_config["SABnzbd"]["sab_host"] = SAB_HOST new_config["NZBget"] = {} new_config["NZBget"]["nzbget_password"] = NZBGET_PASSWORD new_config["NZBget"]["nzbget_category"] = NZBGET_CATEGORY new_config["NZBget"]["nzbget_host"] = NZBGET_HOST new_config["XBMC"] = {} new_config["XBMC"]["use_xbmc"] = int(USE_XBMC) new_config["XBMC"]["xbmc_notify_onsnatch"] = int(XBMC_NOTIFY_ONSNATCH) new_config["XBMC"]["xbmc_notify_ondownload"] = int(XBMC_NOTIFY_ONDOWNLOAD) new_config["XBMC"]["xbmc_update_library"] = int(XBMC_UPDATE_LIBRARY) new_config["XBMC"]["xbmc_update_full"] = int(XBMC_UPDATE_FULL) new_config["XBMC"]["xbmc_host"] = XBMC_HOST new_config["XBMC"]["xbmc_username"] = XBMC_USERNAME new_config["XBMC"]["xbmc_password"] = XBMC_PASSWORD new_config["Plex"] = {} new_config["Plex"]["use_plex"] = int(USE_PLEX) new_config["Plex"]["plex_notify_onsnatch"] = int(PLEX_NOTIFY_ONSNATCH) new_config["Plex"]["plex_notify_ondownload"] = int(PLEX_NOTIFY_ONDOWNLOAD) new_config["Plex"]["plex_update_library"] = int(PLEX_UPDATE_LIBRARY) new_config["Plex"]["plex_server_host"] = PLEX_SERVER_HOST new_config["Plex"]["plex_host"] = PLEX_HOST new_config["Plex"]["plex_username"] = PLEX_USERNAME new_config["Plex"]["plex_password"] = PLEX_PASSWORD new_config["Growl"] = {} new_config["Growl"]["use_growl"] = int(USE_GROWL) new_config["Growl"]["growl_notify_onsnatch"] = int(GROWL_NOTIFY_ONSNATCH) new_config["Growl"]["growl_notify_ondownload"] = int(GROWL_NOTIFY_ONDOWNLOAD) new_config["Growl"]["growl_host"] = GROWL_HOST new_config["Growl"]["growl_password"] = GROWL_PASSWORD new_config["Prowl"] = {} new_config["Prowl"]["use_prowl"] = int(USE_PROWL) new_config["Prowl"]["prowl_notify_onsnatch"] = int(PROWL_NOTIFY_ONSNATCH) new_config["Prowl"]["prowl_notify_ondownload"] = int(PROWL_NOTIFY_ONDOWNLOAD) new_config["Prowl"]["prowl_api"] = PROWL_API new_config["Prowl"]["prowl_priority"] = PROWL_PRIORITY new_config["Twitter"] = {} new_config["Twitter"]["use_twitter"] = int(USE_TWITTER) new_config["Twitter"]["twitter_notify_onsnatch"] = int(TWITTER_NOTIFY_ONSNATCH) new_config["Twitter"]["twitter_notify_ondownload"] = int(TWITTER_NOTIFY_ONDOWNLOAD) new_config["Twitter"]["twitter_username"] = TWITTER_USERNAME new_config["Twitter"]["twitter_password"] = TWITTER_PASSWORD new_config["Twitter"]["twitter_prefix"] = TWITTER_PREFIX new_config["Notifo"] = {} new_config["Notifo"]["use_notifo"] = int(USE_NOTIFO) new_config["Notifo"]["notifo_notify_onsnatch"] = int(NOTIFO_NOTIFY_ONSNATCH) new_config["Notifo"]["notifo_notify_ondownload"] = int(NOTIFO_NOTIFY_ONDOWNLOAD) new_config["Notifo"]["notifo_username"] = NOTIFO_USERNAME new_config["Notifo"]["notifo_apisecret"] = NOTIFO_APISECRET new_config["Boxcar"] = {} new_config["Boxcar"]["use_boxcar"] = int(USE_BOXCAR) new_config["Boxcar"]["boxcar_notify_onsnatch"] = int(BOXCAR_NOTIFY_ONSNATCH) new_config["Boxcar"]["boxcar_notify_ondownload"] = int(BOXCAR_NOTIFY_ONDOWNLOAD) new_config["Boxcar"]["boxcar_username"] = BOXCAR_USERNAME new_config["Libnotify"] = {} new_config["Libnotify"]["use_libnotify"] = int(USE_LIBNOTIFY) new_config["Libnotify"]["libnotify_notify_onsnatch"] = int(LIBNOTIFY_NOTIFY_ONSNATCH) new_config["Libnotify"]["libnotify_notify_ondownload"] = int(LIBNOTIFY_NOTIFY_ONDOWNLOAD) new_config["NMJ"] = {} new_config["NMJ"]["use_nmj"] = int(USE_NMJ) new_config["NMJ"]["nmj_host"] = NMJ_HOST new_config["NMJ"]["nmj_database"] = NMJ_DATABASE new_config["NMJ"]["nmj_mount"] = NMJ_MOUNT new_config["Synology"] = {} new_config["Synology"]["use_synoindex"] = int(USE_SYNOINDEX) new_config["Trakt"] = {} new_config["Trakt"]["use_trakt"] = int(USE_TRAKT) new_config["Trakt"]["trakt_username"] = TRAKT_USERNAME new_config["Trakt"]["trakt_password"] = TRAKT_PASSWORD new_config["Trakt"]["trakt_api"] = TRAKT_API new_config["pyTivo"] = {} new_config["pyTivo"]["use_pytivo"] = int(USE_PYTIVO) new_config["pyTivo"]["pytivo_notify_onsnatch"] = int(PYTIVO_NOTIFY_ONSNATCH) new_config["pyTivo"]["pytivo_notify_ondownload"] = int(PYTIVO_NOTIFY_ONDOWNLOAD) new_config["pyTivo"]["pyTivo_update_library"] = int(PYTIVO_UPDATE_LIBRARY) new_config["pyTivo"]["pytivo_host"] = PYTIVO_HOST new_config["pyTivo"]["pytivo_share_name"] = PYTIVO_SHARE_NAME new_config["pyTivo"]["pytivo_tivo_name"] = PYTIVO_TIVO_NAME new_config["Newznab"] = {} new_config["Newznab"]["newznab_data"] = "!!!".join([x.configStr() for x in newznabProviderList]) new_config["GUI"] = {} new_config["GUI"]["coming_eps_layout"] = COMING_EPS_LAYOUT new_config["GUI"]["coming_eps_display_paused"] = int(COMING_EPS_DISPLAY_PAUSED) new_config["GUI"]["coming_eps_sort"] = COMING_EPS_SORT new_config.write()
def __init__(self, force=None, show=None): #TODOif not sickbeard.DOWNLOAD_FRENCH: # return if sickbeard.showList == None: return logger.log(u"Beginning the search for french episodes older than " + str(sickbeard.FRENCH_DELAY) + " days") frenchlist = [] #get list of english episodes that we want to search in french myDB = db.DBConnection() today = datetime.date.today().toordinal() if show: frenchsql = myDB.select( "SELECT showid, season, episode from tv_episodes where audio_langs='en' and tv_episodes.showid =? and (? - tv_episodes.airdate) > ? order by showid, airdate asc", [show, today, sickbeard.FRENCH_DELAY]) count = myDB.select( "SELECT count(*) from tv_episodes where audio_langs='en' and tv_episodes.showid =? and (? - tv_episodes.airdate) > ?", [show, today, sickbeard.FRENCH_DELAY]) else: frenchsql = myDB.select( "SELECT showid, season, episode from tv_episodes, tv_shows where audio_langs='en' and tv_episodes.showid = tv_shows.tvdb_id and tv_shows.frenchsearch = 1 and (? - tv_episodes.airdate) > ? order by showid, airdate asc", [today, sickbeard.FRENCH_DELAY]) count = myDB.select( "SELECT count(*) from tv_episodes, tv_shows where audio_langs='en' and tv_episodes.showid = tv_shows.tvdb_id and tv_shows.frenchsearch = 1 and (? - tv_episodes.airdate) > ?", [today, sickbeard.FRENCH_DELAY]) #make the episodes objects logger.log(u"Searching for " + str(count[0][0]) + " episodes in french") for episode in frenchsql: showObj = helpers.findCertainShow(sickbeard.showList, episode[0]) epObj = showObj.getEpisode(episode[1], episode[2]) frenchlist.append(epObj) #for each episode in frenchlist fire a search in french delay = [] for frepisode in frenchlist: if frepisode.show.tvdbid in delay: logger.log( u"Previous episode for show " + str(frepisode.show.tvdbid) + " not found in french so skipping this search", logger.DEBUG) continue result = [] for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue logger.log(u"Searching for french episodes on " + curProvider.name + " for " + frepisode.show.name + " season " + str(frepisode.season) + " episode " + str(frepisode.episode)) try: curfrench = curProvider.findFrench(frepisode, manualSearch=True) except: logger.log(u"Exception", logger.DEBUG) pass for x in curfrench: result.append(x) best = None try: epi = {} epi[1] = frepisode best = search.pickBestResult(result, episode=epi) except: pass if best: best.name = best.name + ' snatchedfr' logger.log(u"Found french episode for " + frepisode.show.name + " season " + str(frepisode.season) + " episode " + str(frepisode.episode)) try: search.snatchEpisode(best, SNATCHED_FRENCH) except: logger.log(u"Exception", logger.DEBUG) pass else: delay.append(frepisode.show.tvdbid) logger.log(u"No french episodes found for " + frepisode.show.name + " season " + str(frepisode.season) + " episode " + str(frepisode.episode))
import unittest from tests import SiCKRAGETestCase import certifi import requests import sickbeard.providers as providers from sickrage.helper.exceptions import ex class SNI_Tests(SiCKRAGETestCase): pass def test_sni(self, provider): try: requests.head(provider.url, verify=certifi.where(), timeout=5) except requests.exceptions.Timeout: pass except requests.exceptions.SSLError as error: if 'SSL3_GET_SERVER_CERTIFICATE' not in ex(error): print(error) except Exception: pass for provider in providers.sortedProviderList(): setattr(SNI_Tests, 'test_%s' % provider.name, lambda self, x=provider: test_sni(self, x)) if __name__ == "__main__": print("==================") print("STARTING - SSL TESTS") print("==================") print("######################################################################") unittest.main()
def run(self, force=None, show=None): if sickbeard.showList == None: return logger.log(u"Beginning the search for french episodes older than " + str(sickbeard.FRENCH_DELAY) + " days") foundResults = {} finalResults = [] # show = self frenchlist = [] # get list of english episodes that we want to search in french myDB = db.DBConnection() today = datetime.date.today().toordinal() if show: frenchsql = myDB.select( "SELECT showid, season, episode from tv_episodes where audio_langs='eng' and tv_episodes.showid =? and (? - tv_episodes.airdate) > ? order by showid, airdate asc", [show, today, sickbeard.FRENCH_DELAY], ) logger.log( "SELECT showid, season, episode from tv_episodes where audio_langs='eng' and tv_episodes.showid =" + str(show) + "and (" + str(today) + " - tv_episodes.airdate) > " + str(sickbeard.FRENCH_DELAY) + "order by showid, airdate asc" ) count = myDB.select( "SELECT count(*) from tv_episodes where audio_langs='eng' and tv_episodes.showid =? and (? - tv_episodes.airdate) > ?", [show, today, sickbeard.FRENCH_DELAY], ) else: frenchsql = myDB.select( "SELECT showid, season, episode from tv_episodes, tv_shows where audio_langs='eng' and tv_episodes.showid = tv_shows.indexer_id and tv_shows.frenchsearch = 1 and (? - tv_episodes.airdate) > ? order by showid, airdate asc", [today, sickbeard.FRENCH_DELAY], ) count = myDB.select( "SELECT count(*) from tv_episodes, tv_shows where audio_langs='eng' and tv_episodes.showid = tv_shows.indexer_id and tv_shows.frenchsearch = 1 and (? - tv_episodes.airdate) > ?", [today, sickbeard.FRENCH_DELAY], ) # make the episodes objects # logger.log("SELECT showid, season, episode from tv_episodes where audio_langs='eng' and tv_episodes.showid =" + str(show) +"and (" +str(today)+" - tv_episodes.airdate) > "+ str(sickbeard.FRENCH_DELAY) +"order by showid, airdate asc") logger.log( "SELECT showid, season, episode from tv_episodes, tv_shows where audio_langs='eng' and tv_episodes.showid = tv_shows.indexer_id and tv_shows.frenchsearch = 1 and (" + str(today) + " - tv_episodes.airdate) > " + str(sickbeard.FRENCH_DELAY) + " order by showid, airdate asc" ) logger.log(u"Searching for " + str(count[0][0]) + " episodes in french") # logger.log(frenchsql) # logger.log(sickbeard.showList.) for episode in frenchsql: showObj = Show.find(sickbeard.showList, int(episode[0])) if showObj == None: logger.log("Show not in show list") # showObj = helpers.findCertainShow(sickbeard.showList, episode[0]) epObj = showObj.getEpisode(episode[1], episode[2]) # epObj = showObj.getEpisode(int(epInfo[0]), int(epInfo[1])) frenchlist.append(epObj) # for each episode in frenchlist fire a search in french delay = [] temp = None rest = count[0][0] for frepisode in frenchlist: rest = rest - 1 if frepisode.show.indexerid in delay: logger.log( u"Previous episode for show " + str(frepisode.show.name) + " not found in french so skipping this search", logger.DEBUG, ) continue result = [] for curProvider in providers.sortedProviderList(): foundResults[curProvider.name] = {} if not curProvider.is_active(): continue logger.log( u"Searching for french episode on " + curProvider.name + " for " + frepisode.show.name + " season " + str(frepisode.season) + " episode " + str(frepisode.episode) ) # try: # logger.log(frepisode) # temp = GenericProvider() # curfrench = temp.findFrench(self, episode=frepisode, manualSearch=True) # curfrench = GenericProvider.findFrench(episode=frepi sode,manualSearch=True) # curProvider.findFrench(frepisode, manualSearch=True) # except: # logger.log(u"Exception", logger.DEBUG) # pass # for curProvider in providers: # if curProvider.anime_only and not show.is_anime: # logger.log(u"" + str(show.name) + " is not an anime, skipping", logger.DEBUG) # continue curfrench = curProvider.find_search_results(frepisode.show, frenchlist, "sponly", True, True, "french") # curfrench = curProvider.findFrench(frepisode, True) # temp = GenericProvider('temp') # curfrench = temp.findFrench( episode=frepisode, manualSearch=True) if len(curfrench): # make a list of all the results for this provider for curEp in curfrench: if curEp in foundResults: foundResults[curProvider.name][curEp] += curfrench[curEp] else: foundResults[curProvider.name][curEp] = curfrench[curEp] if not foundResults[curProvider.name]: continue bestSeasonResult = None # if SEASON_RESULT in foundResults[curProvider.name]: # bestSeasonResult = search.pickBestResult(foundResults[curProvider.name][SEASON_RESULT], show) # _______________________________________________________ test = 0 if foundResults[curProvider.name]: for cur_episode in foundResults[curProvider.name]: for x in foundResults[curProvider.name][cur_episode]: tmp = x if not show_name_helpers.filterBadReleases(x.name): # x.name): logger.log( u"French " + x.name + " isn't a valid scene release that we want, ignoring it", logger.DEBUG, ) test += 1 continue if sickbeard.IGNORE_WORDS == "": ignore_words = "ztreyfgut" else: ignore_words = str(sickbeard.IGNORE_WORDS) for fil in resultFilters + ignore_words.split(","): if fil == showLanguages.get(u"fre"): continue if re.search("(^|[\W_])" + fil + "($|[\W_])", x.url, re.I) or re.search( "(^|[\W_])" + fil + "($|[\W_])", x.name, re.I ): logger.log( u"Invalid scene release: " + x.url + " contains " + fil + ", ignoring it", logger.DEBUG, ) test += 1 if test == 0: result.append(x) best = None try: epi = {} epi[1] = frepisode best = search.pickBestResult(result, showObj) except: pass if best: best.name = best.name + " snatchedfr" logger.log( u"Found french episode for " + frepisode.show.name + " season " + str(frepisode.season) + " episode " + str(frepisode.episode) ) try: search.snatchEpisode(best, SNATCHED_FRENCH) except: logger.log(u"Exception", logger.DEBUG) pass else: delay.append(frepisode.show.indexerid) logger.log( u"No french episode found for " + frepisode.show.name + " season " + str(frepisode.season) + " episode " + str(frepisode.episode) ) logger.log(str(rest) + u" episodes left")
def _getProperList(self): propers = {} # for each provider get a list of the propers for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue date = datetime.datetime.today() - datetime.timedelta(days=2) logger.log(u"Searching for any new PROPER releases from "+curProvider.name) curPropers = curProvider.findPropers(date) # if they haven't been added by a different provider than add the proper to the list for x in curPropers: name = self._genericName(x.name) if not name in propers: logger.log(u"Found new proper: "+x.name, logger.DEBUG) x.provider = curProvider propers[name] = x # take the list of unique propers and get it sorted by sortedPropers = sorted(propers.values(), key=operator.attrgetter('date'), reverse=True) finalPropers = [] for curProper in sortedPropers: # parse the file name try: myParser = NameParser(False) parse_result = myParser.parse(curProper.name) except InvalidNameException: logger.log(u"Unable to parse the filename "+curProper.name+" into a valid episode", logger.DEBUG) continue if not parse_result.episode_numbers: logger.log(u"Ignoring "+curProper.name+" because it's for a full season rather than specific episode", logger.DEBUG) continue # populate our Proper instance if parse_result.air_by_date: curProper.season == -1 curProper.episode = parse_result.air_date else: curProper.season = parse_result.season_number if parse_result.season_number != None else 1 curProper.episode = parse_result.episode_numbers[0] curProper.quality = Quality.nameQuality(curProper.name) # for each show in our list for curShow in sickbeard.showList: genericName = self._genericName(parse_result.series_name) # get the scene name masks sceneNames = set(sceneHelpers.makeSceneShowSearchStrings(curShow)) # for each scene name mask for curSceneName in sceneNames: # if it matches if genericName == self._genericName(curSceneName): logger.log(u"Successful match! Result "+parse_result.series_name+" matched to show "+curShow.name, logger.DEBUG) # set the tvdbid in the db to the show's tvdbid curProper.tvdbid = curShow.tvdbid # since we found it, break out break # if we found something in the inner for loop break out of this one if curProper.tvdbid != -1: break if curProper.tvdbid == -1: continue if not sceneHelpers.filterBadReleases(curProper.name): logger.log(u"Proper "+curProper.name+" isn't a valid scene release that we want, igoring it", logger.DEBUG) continue # if we have an air-by-date show then get the real season/episode numbers if curProper.season == -1 and curProper.tvdbid: showObj = helpers.findCertainShow(sickbeard.showList, curProper.tvdbid) if not showObj: logger.log(u"This should never have happened, post a bug about this!", logger.ERROR) raise Exception("BAD STUFF HAPPENED") tvdb_lang = showObj.lang # There's gotta be a better way of doing this but we don't wanna # change the language value elsewhere ltvdb_api_parms = sickbeard.TVDB_API_PARMS.copy() if tvdb_lang and not tvdb_lang == 'en': ltvdb_api_parms['language'] = tvdb_lang try: t = tvdb_api.Tvdb(**ltvdb_api_parms) epObj = t[curProper.tvdbid].airedOn(curProper.episode)[0] season = int(epObj["seasonnumber"]) episodes = [int(epObj["episodenumber"])] except tvdb_exceptions.tvdb_episodenotfound, e: logger.log(u"Unable to find episode with date "+str(curProper.episode)+" for show "+parse_result.series_name+", skipping", logger.WARNING) continue # check if we actually want this proper (if it's the right quality) sqlResults = db.DBConnection().select("SELECT status FROM tv_episodes WHERE showid = ? AND season = ? AND episode = ?", [curProper.tvdbid, curProper.season, curProper.episode]) if not sqlResults: continue oldStatus, oldQuality = Quality.splitCompositeStatus(int(sqlResults[0]["status"])) # only keep the proper if we have already retrieved the same quality ep (don't get better/worse ones) if oldStatus not in (DOWNLOADED, SNATCHED) or oldQuality != curProper.quality: continue # if the show is in our list and there hasn't been a proper already added for that particular episode then add it to our list of propers if curProper.tvdbid != -1 and (curProper.tvdbid, curProper.season, curProper.episode) not in map(operator.attrgetter('tvdbid', 'season', 'episode'), finalPropers): logger.log(u"Found a proper that we need: "+str(curProper.name)) finalPropers.append(curProper)
def _getProperList(self): propers = {} # for each provider get a list of the propers for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue date = datetime.datetime.today() - datetime.timedelta(days=2) logger.log("Searching for any new PROPER releases from "+curProvider.name) curPropers = curProvider.findPropers(date) # if they haven't been added by a different provider than add the proper to the list for x in curPropers: name = self._genericName(x.name) if not name in propers: logger.log("Found new proper: "+x.name, logger.DEBUG) x.provider = curProvider propers[name] = x # take the list of unique propers and get it sorted by sortedPropers = sorted(propers.values(), key=operator.attrgetter('date'), reverse=True) finalPropers = [] for curProper in sortedPropers: # parse the file name try: myParser = FileParser(curProper.name) epInfo = myParser.parse() except tvnamer_exceptions.InvalidFilename: logger.log("Unable to parse the filename "+curProper.name+" into a valid episode", logger.ERROR) continue if not epInfo.episodenumbers: logger.log("Ignoring "+curProper.name+" because it's for a full season rather than specific episode", logger.DEBUG) continue # populate our Proper instance curProper.season = epInfo.seasonnumber curProper.episode = epInfo.episodenumbers[0] curProper.quality = Quality.nameQuality(curProper.name) # for each show in our list for curShow in sickbeard.showList: genericName = self._genericName(epInfo.seriesname) # get the scene name masks sceneNames = set(sceneHelpers.makeSceneShowSearchStrings(curShow)) # for each scene name mask for curSceneName in sceneNames: # if it matches if genericName == self._genericName(curSceneName): logger.log("Successful match! Result "+epInfo.seriesname+" matched to show "+curShow.name, logger.DEBUG) # set the tvdbid in the db to the show's tvdbid curProper.tvdbid = curShow.tvdbid # since we found it, break out break # if we found something in the inner for loop break out of this one if curProper.tvdbid != -1: break if curProper.tvdbid == -1: continue # if we have an air-by-date show then get the real season/episode numbers if curProper.season == -1 and curProper.tvdbid: try: t = tvdb_api.Tvdb(**sickbeard.TVDB_API_PARMS) epObj = t[curProper.tvdbid].airedOn(curProper.episode)[0] season = int(epObj["seasonnumber"]) episodes = [int(epObj["episodenumber"])] except tvdb_exceptions.tvdb_episodenotfound, e: logger.log("Unable to find episode with date "+str(curProper.episode)+" for show "+epInfo.seriesname+", skipping", logger.WARNING) continue # check if we actually want this proper (if it's the right quality) sqlResults = db.DBConnection().select("SELECT status FROM tv_episodes WHERE showid = ? AND season = ? AND episode = ?", [curProper.tvdbid, curProper.season, curProper.episode]) if not sqlResults: continue oldStatus, oldQuality = Quality.splitCompositeStatus(int(sqlResults[0]["status"])) # only keep the proper if we have already retrieved the same quality ep (don't get better/worse ones) if oldStatus not in (DOWNLOADED, SNATCHED) or oldQuality != curProper.quality: continue # if the show is in our list and there hasn't been a proper already added for that particular episode then add it to our list of propers if curProper.tvdbid != -1 and (curProper.tvdbid, curProper.season, curProper.episode) not in map(operator.attrgetter('tvdbid', 'season', 'episode'), finalPropers): logger.log("Found a proper that we need: "+str(curProper.name)) finalPropers.append(curProper)
def __init__(self, force=None, show=None): #TODOif not sickbeard.DOWNLOAD_FRENCH: # return if sickbeard.showList==None: return logger.log(u"Beginning the search for french episodes older than "+ str(sickbeard.FRENCH_DELAY) +" days") frenchlist=[] #get list of english episodes that we want to search in french myDB = db.DBConnection() today = datetime.date.today().toordinal() if show: frenchsql=myDB.select("SELECT showid, season, episode from tv_episodes where audio_langs='en' and tv_episodes.showid =? and (? - tv_episodes.airdate) > ? order by showid, airdate asc",[show,today,sickbeard.FRENCH_DELAY]) count=myDB.select("SELECT count(*) from tv_episodes where audio_langs='en' and tv_episodes.showid =? and (? - tv_episodes.airdate) > ?",[show,today,sickbeard.FRENCH_DELAY]) else: frenchsql=myDB.select("SELECT showid, season, episode from tv_episodes, tv_shows where audio_langs='en' and tv_episodes.showid = tv_shows.tvdb_id and tv_shows.frenchsearch = 1 and (? - tv_episodes.airdate) > ? order by showid, airdate asc",[today,sickbeard.FRENCH_DELAY]) count=myDB.select("SELECT count(*) from tv_episodes, tv_shows where audio_langs='en' and tv_episodes.showid = tv_shows.tvdb_id and tv_shows.frenchsearch = 1 and (? - tv_episodes.airdate) > ?",[today,sickbeard.FRENCH_DELAY]) #make the episodes objects logger.log(u"Searching for "+str(count[0][0]) +" episodes in french") for episode in frenchsql: showObj = helpers.findCertainShow(sickbeard.showList, episode[0]) epObj = showObj.getEpisode(episode[1], episode[2]) frenchlist.append(epObj) #for each episode in frenchlist fire a search in french delay=[] for frepisode in frenchlist: if frepisode.show.tvdbid in delay: logger.log(u"Previous episode for show "+str(frepisode.show.tvdbid)+" not found in french so skipping this search", logger.DEBUG) continue result=[] for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue logger.log(u"Searching for french episodes on "+curProvider.name +" for " +frepisode.show.name +" season "+str(frepisode.season)+" episode "+str(frepisode.episode)) try: curfrench = curProvider.findFrench(frepisode, manualSearch=True) except: logger.log(u"Exception", logger.DEBUG) pass test=0 if curfrench: for x in curfrench: if not show_name_helpers.filterBadReleases(x.name): logger.log(u"French "+x.name+" isn't a valid scene release that we want, ignoring it", logger.DEBUG) test+=1 continue if sickbeard.IGNORE_WORDS == "": ignore_words="ztreyfgut" else: ignore_words=str(sickbeard.IGNORE_WORDS) for fil in resultFilters + ignore_words.split(','): if fil == showLanguages.get(u"fr"): continue if re.search('(^|[\W_])'+fil+'($|[\W_])', x.url, re.I): logger.log(u"Invalid scene release: "+x.url+" contains "+fil+", ignoring it", logger.DEBUG) test+=1 if test==0: result.append(x) best=None try: epi={} epi[1]=frepisode best = search.pickBestResult(result, episode = epi) except: pass if best: best.name=best.name + ' snatchedfr' logger.log(u"Found french episode for " +frepisode.show.name +" season "+str(frepisode.season)+" episode "+str(frepisode.episode)) try: search.snatchEpisode(best, SNATCHED_FRENCH) except: logger.log(u"Exception", logger.DEBUG) pass else: delay.append(frepisode.show.tvdbid) logger.log(u"No french episodes found for " +frepisode.show.name +" season "+str(frepisode.season)+" episode "+str(frepisode.episode))
def findEpisode(episode, manualSearch=False): logger.log(u"Searching for " + episode.prettyName(True)) foundResults = [] didSearch = False for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue # we check our results after every search string # this is done because in the future we will have a ordered list of all show aliases and release_group aliases # ordered by success rate ... # lets get all search strings # we use the method from the curProvider to accommodate for the internal join functions # this way we do not break the special abilities of the providers e.g. nzbmatrix searchStrings = curProvider.get_episode_search_strings(episode) logger.log("All search string permutations (" + curProvider.name + "):" + str(searchStrings)) """ try: searchStrings = list(set(searchStrings)) except TypeError: pass """ done_searching = False for searchString in searchStrings: try: curFoundResults = curProvider.findEpisode(episode, manualSearch=manualSearch, searchString=searchString) except exceptions.AuthException, e: logger.log(u"Authentication error: "+ex(e), logger.ERROR) break # break the while loop except Exception, e: logger.log(u"Error while searching "+curProvider.name+", skipping: "+ex(e), logger.ERROR) logger.log(traceback.format_exc(), logger.DEBUG) break # break the while loop didSearch = True # skip non-tv crap curFoundResults = filter(lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name, episode.show, season=episode.season), curFoundResults) # loop all results and see if any of them are good enough that we can stop searching for cur_result in curFoundResults: done_searching = isFinalResult(cur_result) logger.log(u"Should we stop searching after finding "+cur_result.name+": "+str(done_searching), logger.DEBUG) if done_searching: break # if we are searching an anime we are a little more loose # this means we check every turn for a possible result # in contrast the isFinalResultlooks function looks for a perfect result (best quality) # but this will accept any result that would have been picked in the end -> pickBestResult # and then stop and use that if episode.show.is_anime: logger.log(u"We are searching an anime. i am checking if we got a good result with search provider "+curProvider.name, logger.DEBUG) bestResult = pickBestResult(curFoundResults, show=episode.show) if bestResult: return bestResult foundResults += curFoundResults # if we did find a result that's good enough to stop then don't continue # this breaks the turn loop if done_searching: break
def save_config(): new_config = ConfigObj() new_config.filename = sickbeard.CONFIG_FILE new_config["General"] = {} new_config["General"]["log_dir"] = LOG_DIR new_config["General"]["web_port"] = WEB_PORT new_config["General"]["web_host"] = WEB_HOST new_config["General"]["web_ipv6"] = WEB_IPV6 new_config["General"]["web_log"] = int(WEB_LOG) new_config["General"]["web_root"] = WEB_ROOT new_config["General"]["web_username"] = WEB_USERNAME new_config["General"]["web_password"] = WEB_PASSWORD new_config["General"]["nzb_method"] = NZB_METHOD new_config["General"]["usenet_retention"] = int(USENET_RETENTION) new_config["General"]["search_frequency"] = int(SEARCH_FREQUENCY) new_config["General"]["backlog_search_frequency"] = int(BACKLOG_SEARCH_FREQUENCY) new_config["General"]["use_nzb"] = int(USE_NZB) new_config["General"]["download_propers"] = int(DOWNLOAD_PROPERS) new_config["General"]["quality_default"] = int(QUALITY_DEFAULT) new_config["General"]["season_folders_format"] = SEASON_FOLDERS_FORMAT new_config["General"]["season_folders_default"] = int(SEASON_FOLDERS_DEFAULT) new_config["General"]["provider_order"] = " ".join([x.getID() for x in providers.sortedProviderList()]) new_config["General"]["version_notify"] = int(VERSION_NOTIFY) new_config["General"]["naming_ep_name"] = int(NAMING_EP_NAME) new_config["General"]["naming_show_name"] = int(NAMING_SHOW_NAME) new_config["General"]["naming_ep_type"] = int(NAMING_EP_TYPE) new_config["General"]["naming_multi_ep_type"] = int(NAMING_MULTI_EP_TYPE) new_config["General"]["naming_sep_type"] = int(NAMING_SEP_TYPE) new_config["General"]["naming_use_periods"] = int(NAMING_USE_PERIODS) new_config["General"]["naming_quality"] = int(NAMING_QUALITY) new_config["General"]["naming_dates"] = int(NAMING_DATES) new_config["General"]["use_torrent"] = int(USE_TORRENT) new_config["General"]["launch_browser"] = int(LAUNCH_BROWSER) new_config["General"]["metadata_type"] = METADATA_TYPE new_config["General"]["metadata_show"] = int(METADATA_SHOW) new_config["General"]["metadata_episode"] = int(METADATA_EPISODE) new_config["General"]["art_poster"] = int(ART_POSTER) new_config["General"]["art_fanart"] = int(ART_FANART) new_config["General"]["art_thumbnails"] = int(ART_THUMBNAILS) new_config["General"]["art_season_thumbnails"] = int(ART_SEASON_THUMBNAILS) new_config["General"]["cache_dir"] = CACHE_DIR if CACHE_DIR else "cache" new_config["General"]["tv_download_dir"] = TV_DOWNLOAD_DIR new_config["General"]["keep_processed_dir"] = int(KEEP_PROCESSED_DIR) new_config["General"]["process_automatically"] = int(PROCESS_AUTOMATICALLY) new_config["General"]["rename_episodes"] = int(RENAME_EPISODES) new_config["General"]["extra_scripts"] = "|".join(EXTRA_SCRIPTS) new_config["General"]["git_path"] = GIT_PATH new_config["Blackhole"] = {} new_config["Blackhole"]["nzb_dir"] = NZB_DIR new_config["Blackhole"]["torrent_dir"] = TORRENT_DIR new_config["TVBinz"] = {} new_config["TVBinz"]["tvbinz"] = int(TVBINZ) new_config["TVBinz"]["tvbinz_uid"] = TVBINZ_UID new_config["TVBinz"]["tvbinz_hash"] = TVBINZ_HASH new_config["TVBinz"]["tvbinz_auth"] = TVBINZ_AUTH new_config["NZBs"] = {} new_config["NZBs"]["nzbs"] = int(NZBS) new_config["NZBs"]["nzbs_uid"] = NZBS_UID new_config["NZBs"]["nzbs_hash"] = NZBS_HASH new_config["NZBsRUS"] = {} new_config["NZBsRUS"]["nzbsrus"] = int(NZBSRUS) new_config["NZBsRUS"]["nzbsrus_uid"] = NZBSRUS_UID new_config["NZBsRUS"]["nzbsrus_hash"] = NZBSRUS_HASH new_config["NZBMatrix"] = {} new_config["NZBMatrix"]["nzbmatrix"] = int(NZBMATRIX) new_config["NZBMatrix"]["nzbmatrix_username"] = NZBMATRIX_USERNAME new_config["NZBMatrix"]["nzbmatrix_apikey"] = NZBMATRIX_APIKEY new_config["Newzbin"] = {} new_config["Newzbin"]["newzbin"] = int(NEWZBIN) new_config["Newzbin"]["newzbin_username"] = NEWZBIN_USERNAME new_config["Newzbin"]["newzbin_password"] = NEWZBIN_PASSWORD new_config["Bin-Req"] = {} new_config["Bin-Req"]["binreq"] = int(BINREQ) new_config["Womble"] = {} new_config["Womble"]["womble"] = int(WOMBLE) new_config["SABnzbd"] = {} new_config["SABnzbd"]["sab_username"] = SAB_USERNAME new_config["SABnzbd"]["sab_password"] = SAB_PASSWORD new_config["SABnzbd"]["sab_apikey"] = SAB_APIKEY new_config["SABnzbd"]["sab_category"] = SAB_CATEGORY new_config["SABnzbd"]["sab_host"] = SAB_HOST new_config["XBMC"] = {} new_config["XBMC"]["xbmc_notify_onsnatch"] = int(XBMC_NOTIFY_ONSNATCH) new_config["XBMC"]["xbmc_notify_ondownload"] = int(XBMC_NOTIFY_ONDOWNLOAD) new_config["XBMC"]["xbmc_update_library"] = int(XBMC_UPDATE_LIBRARY) new_config["XBMC"]["xbmc_update_full"] = int(XBMC_UPDATE_FULL) new_config["XBMC"]["xbmc_host"] = XBMC_HOST new_config["XBMC"]["xbmc_username"] = XBMC_USERNAME new_config["XBMC"]["xbmc_password"] = XBMC_PASSWORD new_config["Growl"] = {} new_config["Growl"]["use_growl"] = int(USE_GROWL) new_config["Growl"]["growl_host"] = GROWL_HOST new_config["Growl"]["growl_password"] = GROWL_PASSWORD new_config["Twitter"] = {} new_config["Twitter"]["use_twitter"] = int(USE_TWITTER) new_config["Twitter"]["twitter_username"] = TWITTER_USERNAME new_config["Twitter"]["twitter_password"] = TWITTER_PASSWORD new_config["Twitter"]["twitter_prefix"] = TWITTER_PREFIX new_config["Newznab"] = {} new_config["Newznab"]["newznab_data"] = "!!!".join([x.configStr() for x in newznabProviderList]) new_config.write()
def _getProperList(self): propers = {} # for each provider get a list of the propers for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue date = datetime.datetime.today() - datetime.timedelta(days=2) logger.log(u"Searching for any new PROPER releases from " + curProvider.name) curPropers = curProvider.findPropers(date) # if they haven't been added by a different provider than add the proper to the list for x in curPropers: name = self._genericName(x.name) if not name in propers: logger.log(u"Found new proper: " + x.name, logger.DEBUG) x.provider = curProvider propers[name] = x # take the list of unique propers and get it sorted by sortedPropers = sorted(propers.values(), key=operator.attrgetter('date'), reverse=True) finalPropers = [] for curProper in sortedPropers: # parse the file name try: myParser = NameParser(False) parse_result = myParser.parse(curProper.name) except InvalidNameException: logger.log( u"Unable to parse the filename " + curProper.name + " into a valid episode", logger.DEBUG) continue if not parse_result.episode_numbers: logger.log( u"Ignoring " + curProper.name + " because it's for a full season rather than specific episode", logger.DEBUG) continue # populate our Proper instance if parse_result.air_by_date: curProper.season = -1 curProper.episode = parse_result.air_date else: curProper.season = parse_result.season_number if parse_result.season_number != None else 1 curProper.episode = parse_result.episode_numbers[0] curProper.quality = Quality.nameQuality(curProper.name) # for each show in our list for curShow in sickbeard.showList: genericName = self._genericName(parse_result.series_name) # get the scene name masks sceneNames = set( show_name_helpers.makeSceneShowSearchStrings(curShow)) # for each scene name mask for curSceneName in sceneNames: # if it matches if genericName == self._genericName(curSceneName): logger.log( u"Successful match! Result " + parse_result.series_name + " matched to show " + curShow.name, logger.DEBUG) # set the tvdbid in the db to the show's tvdbid curProper.tvdbid = curShow.tvdbid # since we found it, break out break # if we found something in the inner for loop break out of this one if curProper.tvdbid != -1: break if curProper.tvdbid == -1: continue if not show_name_helpers.filterBadReleases(curProper.name): logger.log( u"Proper " + curProper.name + " isn't a valid scene release that we want, igoring it", logger.DEBUG) continue # if we have an air-by-date show then get the real season/episode numbers if curProper.season == -1 and curProper.tvdbid: showObj = helpers.findCertainShow(sickbeard.showList, curProper.tvdbid) if not showObj: logger.log( u"This should never have happened, post a bug about this!", logger.ERROR) raise Exception("BAD STUFF HAPPENED") tvdb_lang = showObj.lang # There's gotta be a better way of doing this but we don't wanna # change the language value elsewhere ltvdb_api_parms = sickbeard.TVDB_API_PARMS.copy() if tvdb_lang and not tvdb_lang == 'en': ltvdb_api_parms['language'] = tvdb_lang try: t = tvdb_api.Tvdb(**ltvdb_api_parms) epObj = t[curProper.tvdbid].airedOn(curProper.episode)[0] curProper.season = int(epObj["seasonnumber"]) curProper.episodes = [int(epObj["episodenumber"])] except tvdb_exceptions.tvdb_episodenotfound: logger.log( u"Unable to find episode with date " + str(curProper.episode) + " for show " + parse_result.series_name + ", skipping", logger.WARNING) continue # check if we actually want this proper (if it's the right quality) sqlResults = db.DBConnection().select( "SELECT status FROM tv_episodes WHERE showid = ? AND season = ? AND episode = ?", [curProper.tvdbid, curProper.season, curProper.episode]) if not sqlResults: continue oldStatus, oldQuality = Quality.splitCompositeStatus( int(sqlResults[0]["status"])) # only keep the proper if we have already retrieved the same quality ep (don't get better/worse ones) if oldStatus not in (DOWNLOADED, SNATCHED) or oldQuality != curProper.quality: continue # if the show is in our list and there hasn't been a proper already added for that particular episode then add it to our list of propers if curProper.tvdbid != -1 and (curProper.tvdbid, curProper.season, curProper.episode) not in map( operator.attrgetter( 'tvdbid', 'season', 'episode'), finalPropers): logger.log(u"Found a proper that we need: " + str(curProper.name)) finalPropers.append(curProper) return finalPropers
def save_config(): new_config = ConfigObj() new_config.filename = sickbeard.CONFIG_FILE new_config['General'] = {} new_config['General']['log_dir'] = LOG_DIR new_config['General']['web_port'] = WEB_PORT new_config['General']['web_host'] = WEB_HOST new_config['General']['web_ipv6'] = WEB_IPV6 new_config['General']['web_log'] = int(WEB_LOG) new_config['General']['web_root'] = WEB_ROOT new_config['General']['web_username'] = WEB_USERNAME new_config['General']['web_password'] = WEB_PASSWORD new_config['General']['use_nzbs'] = int(USE_NZBS) new_config['General']['use_torrents'] = int(USE_TORRENTS) new_config['General']['nzb_method'] = NZB_METHOD new_config['General']['usenet_retention'] = int(USENET_RETENTION) new_config['General']['search_frequency'] = int(SEARCH_FREQUENCY) new_config['General']['download_propers'] = int(DOWNLOAD_PROPERS) new_config['General']['quality_default'] = int(QUALITY_DEFAULT) new_config['General']['status_default'] = int(STATUS_DEFAULT) new_config['General']['season_folders_format'] = SEASON_FOLDERS_FORMAT new_config['General']['season_folders_default'] = int( SEASON_FOLDERS_DEFAULT) new_config['General']['provider_order'] = ' '.join( [x.getID() for x in providers.sortedProviderList()]) new_config['General']['version_notify'] = int(VERSION_NOTIFY) new_config['General']['naming_ep_name'] = int(NAMING_EP_NAME) new_config['General']['naming_show_name'] = int(NAMING_SHOW_NAME) new_config['General']['naming_ep_type'] = int(NAMING_EP_TYPE) new_config['General']['naming_multi_ep_type'] = int(NAMING_MULTI_EP_TYPE) new_config['General']['naming_sep_type'] = int(NAMING_SEP_TYPE) new_config['General']['naming_use_periods'] = int(NAMING_USE_PERIODS) new_config['General']['naming_quality'] = int(NAMING_QUALITY) new_config['General']['naming_dates'] = int(NAMING_DATES) new_config['General']['launch_browser'] = int(LAUNCH_BROWSER) new_config['General']['use_banner'] = int(USE_BANNER) new_config['General']['use_listview'] = int(USE_LISTVIEW) new_config['General']['metadata_xbmc'] = metadata_provider_dict[ 'XBMC'].get_config() new_config['General']['metadata_mediabrowser'] = metadata_provider_dict[ 'MediaBrowser'].get_config() new_config['General']['metadata_ps3'] = metadata_provider_dict[ 'Sony PS3'].get_config() new_config['General']['metadata_wdtv'] = metadata_provider_dict[ 'WDTV'].get_config() new_config['General']['cache_dir'] = CACHE_DIR if CACHE_DIR else 'cache' new_config['General']['root_dirs'] = ROOT_DIRS if ROOT_DIRS else '' new_config['General']['tv_download_dir'] = TV_DOWNLOAD_DIR new_config['General']['keep_processed_dir'] = int(KEEP_PROCESSED_DIR) new_config['General']['move_associated_files'] = int(MOVE_ASSOCIATED_FILES) new_config['General']['process_automatically'] = int(PROCESS_AUTOMATICALLY) new_config['General']['rename_episodes'] = int(RENAME_EPISODES) new_config['General']['extra_scripts'] = '|'.join(EXTRA_SCRIPTS) new_config['General']['git_path'] = GIT_PATH new_config['Blackhole'] = {} new_config['Blackhole']['nzb_dir'] = NZB_DIR new_config['Blackhole']['torrent_dir'] = TORRENT_DIR new_config['EZRSS'] = {} new_config['EZRSS']['ezrss'] = int(EZRSS) new_config['TVTORRENTS'] = {} new_config['TVTORRENTS']['tvtorrents'] = int(TVTORRENTS) new_config['TVTORRENTS']['tvtorrents_digest'] = TVTORRENTS_DIGEST new_config['TVTORRENTS']['tvtorrents_hash'] = TVTORRENTS_HASH new_config['TVBinz'] = {} new_config['TVBinz']['tvbinz'] = int(TVBINZ) new_config['TVBinz']['tvbinz_uid'] = TVBINZ_UID new_config['TVBinz']['tvbinz_hash'] = TVBINZ_HASH new_config['TVBinz']['tvbinz_auth'] = TVBINZ_AUTH new_config['NZBs'] = {} new_config['NZBs']['nzbs'] = int(NZBS) new_config['NZBs']['nzbs_uid'] = NZBS_UID new_config['NZBs']['nzbs_hash'] = NZBS_HASH new_config['NZBsRUS'] = {} new_config['NZBsRUS']['nzbsrus'] = int(NZBSRUS) new_config['NZBsRUS']['nzbsrus_uid'] = NZBSRUS_UID new_config['NZBsRUS']['nzbsrus_hash'] = NZBSRUS_HASH new_config['NZBMatrix'] = {} new_config['NZBMatrix']['nzbmatrix'] = int(NZBMATRIX) new_config['NZBMatrix']['nzbmatrix_username'] = NZBMATRIX_USERNAME new_config['NZBMatrix']['nzbmatrix_apikey'] = NZBMATRIX_APIKEY new_config['Newzbin'] = {} new_config['Newzbin']['newzbin'] = int(NEWZBIN) new_config['Newzbin']['newzbin_username'] = NEWZBIN_USERNAME new_config['Newzbin']['newzbin_password'] = NEWZBIN_PASSWORD new_config['Womble'] = {} new_config['Womble']['womble'] = int(WOMBLE) new_config['SABnzbd'] = {} new_config['SABnzbd']['sab_username'] = SAB_USERNAME new_config['SABnzbd']['sab_password'] = SAB_PASSWORD new_config['SABnzbd']['sab_apikey'] = SAB_APIKEY new_config['SABnzbd']['sab_category'] = SAB_CATEGORY new_config['SABnzbd']['sab_host'] = SAB_HOST new_config['NZBget'] = {} new_config['NZBget']['nzbget_password'] = NZBGET_PASSWORD new_config['NZBget']['nzbget_category'] = NZBGET_CATEGORY new_config['NZBget']['nzbget_host'] = NZBGET_HOST new_config['XBMC'] = {} new_config['XBMC']['use_xbmc'] = int(USE_XBMC) new_config['XBMC']['xbmc_notify_onsnatch'] = int(XBMC_NOTIFY_ONSNATCH) new_config['XBMC']['xbmc_notify_ondownload'] = int(XBMC_NOTIFY_ONDOWNLOAD) new_config['XBMC']['xbmc_update_library'] = int(XBMC_UPDATE_LIBRARY) new_config['XBMC']['xbmc_update_full'] = int(XBMC_UPDATE_FULL) new_config['XBMC']['xbmc_host'] = XBMC_HOST new_config['XBMC']['xbmc_username'] = XBMC_USERNAME new_config['XBMC']['xbmc_password'] = XBMC_PASSWORD new_config['Plex'] = {} new_config['Plex']['use_plex'] = int(USE_PLEX) new_config['Plex']['plex_notify_onsnatch'] = int(PLEX_NOTIFY_ONSNATCH) new_config['Plex']['plex_notify_ondownload'] = int(PLEX_NOTIFY_ONDOWNLOAD) new_config['Plex']['plex_update_library'] = int(PLEX_UPDATE_LIBRARY) new_config['Plex']['plex_server_host'] = PLEX_SERVER_HOST new_config['Plex']['plex_host'] = PLEX_HOST new_config['Plex']['plex_username'] = PLEX_USERNAME new_config['Plex']['plex_password'] = PLEX_PASSWORD new_config['Growl'] = {} new_config['Growl']['use_growl'] = int(USE_GROWL) new_config['Growl']['growl_notify_onsnatch'] = int(GROWL_NOTIFY_ONSNATCH) new_config['Growl']['growl_notify_ondownload'] = int( GROWL_NOTIFY_ONDOWNLOAD) new_config['Growl']['growl_host'] = GROWL_HOST new_config['Growl']['growl_password'] = GROWL_PASSWORD new_config['Prowl'] = {} new_config['Prowl']['use_prowl'] = int(USE_PROWL) new_config['Prowl']['prowl_notify_onsnatch'] = int(PROWL_NOTIFY_ONSNATCH) new_config['Prowl']['prowl_notify_ondownload'] = int( PROWL_NOTIFY_ONDOWNLOAD) new_config['Prowl']['prowl_api'] = PROWL_API new_config['Prowl']['prowl_priority'] = PROWL_PRIORITY new_config['Twitter'] = {} new_config['Twitter']['use_twitter'] = int(USE_TWITTER) new_config['Twitter']['twitter_notify_onsnatch'] = int( TWITTER_NOTIFY_ONSNATCH) new_config['Twitter']['twitter_notify_ondownload'] = int( TWITTER_NOTIFY_ONDOWNLOAD) new_config['Twitter']['twitter_username'] = TWITTER_USERNAME new_config['Twitter']['twitter_password'] = TWITTER_PASSWORD new_config['Twitter']['twitter_prefix'] = TWITTER_PREFIX new_config['Notifo'] = {} new_config['Notifo']['use_notifo'] = int(USE_NOTIFO) new_config['Notifo']['notifo_notify_onsnatch'] = int( NOTIFO_NOTIFY_ONSNATCH) new_config['Notifo']['notifo_notify_ondownload'] = int( NOTIFO_NOTIFY_ONDOWNLOAD) new_config['Notifo']['notifo_username'] = NOTIFO_USERNAME new_config['Notifo']['notifo_apisecret'] = NOTIFO_APISECRET new_config['Libnotify'] = {} new_config['Libnotify']['use_libnotify'] = int(USE_LIBNOTIFY) new_config['Libnotify']['libnotify_notify_onsnatch'] = int( LIBNOTIFY_NOTIFY_ONSNATCH) new_config['Libnotify']['libnotify_notify_ondownload'] = int( LIBNOTIFY_NOTIFY_ONDOWNLOAD) new_config['NMJ'] = {} new_config['NMJ']['use_nmj'] = int(USE_NMJ) new_config['NMJ']['nmj_host'] = NMJ_HOST new_config['NMJ']['nmj_database'] = NMJ_DATABASE new_config['NMJ']['nmj_mount'] = NMJ_MOUNT new_config['Newznab'] = {} new_config['Newznab']['newznab_data'] = '!!!'.join( [x.configStr() for x in newznabProviderList]) new_config['GUI'] = {} new_config['GUI']['coming_eps_layout'] = COMING_EPS_LAYOUT new_config['GUI']['coming_eps_display_paused'] = int( COMING_EPS_DISPLAY_PAUSED) new_config['GUI']['coming_eps_sort'] = COMING_EPS_SORT new_config.write()
def save_config(): new_config = ConfigObj() new_config.filename = sickbeard.CONFIG_FILE new_config['General'] = {} new_config['General']['log_dir'] = LOG_DIR new_config['General']['web_port'] = WEB_PORT new_config['General']['web_host'] = WEB_HOST new_config['General']['web_ipv6'] = WEB_IPV6 new_config['General']['web_log'] = int(WEB_LOG) new_config['General']['web_root'] = WEB_ROOT new_config['General']['web_username'] = WEB_USERNAME new_config['General']['web_password'] = WEB_PASSWORD new_config['General']['nzb_method'] = NZB_METHOD new_config['General']['usenet_retention'] = int(USENET_RETENTION) new_config['General']['search_frequency'] = int(SEARCH_FREQUENCY) new_config['General']['backlog_search_frequency'] = int(BACKLOG_SEARCH_FREQUENCY) new_config['General']['use_nzb'] = int(USE_NZB) new_config['General']['download_propers'] = int(DOWNLOAD_PROPERS) new_config['General']['quality_default'] = int(QUALITY_DEFAULT) new_config['General']['season_folders_format'] = SEASON_FOLDERS_FORMAT new_config['General']['season_folders_default'] = int(SEASON_FOLDERS_DEFAULT) new_config['General']['provider_order'] = ' '.join([x.getID() for x in providers.sortedProviderList()]) new_config['General']['version_notify'] = int(VERSION_NOTIFY) new_config['General']['naming_ep_name'] = int(NAMING_EP_NAME) new_config['General']['naming_show_name'] = int(NAMING_SHOW_NAME) new_config['General']['naming_ep_type'] = int(NAMING_EP_TYPE) new_config['General']['naming_multi_ep_type'] = int(NAMING_MULTI_EP_TYPE) new_config['General']['naming_sep_type'] = int(NAMING_SEP_TYPE) new_config['General']['naming_use_periods'] = int(NAMING_USE_PERIODS) new_config['General']['naming_quality'] = int(NAMING_QUALITY) new_config['General']['naming_dates'] = int(NAMING_DATES) new_config['General']['use_torrent'] = int(USE_TORRENT) new_config['General']['launch_browser'] = int(LAUNCH_BROWSER) new_config['General']['metadata_type'] = METADATA_TYPE new_config['General']['metadata_show'] = int(METADATA_SHOW) new_config['General']['metadata_episode'] = int(METADATA_EPISODE) new_config['General']['art_poster'] = int(ART_POSTER) new_config['General']['art_fanart'] = int(ART_FANART) new_config['General']['art_thumbnails'] = int(ART_THUMBNAILS) new_config['General']['art_season_thumbnails'] = int(ART_SEASON_THUMBNAILS) new_config['General']['cache_dir'] = CACHE_DIR new_config['General']['tv_download_dir'] = TV_DOWNLOAD_DIR new_config['General']['keep_processed_dir'] = int(KEEP_PROCESSED_DIR) new_config['General']['process_automatically'] = int(PROCESS_AUTOMATICALLY) new_config['General']['rename_episodes'] = int(RENAME_EPISODES) new_config['General']['extra_scripts'] = '|'.join(EXTRA_SCRIPTS) new_config['General']['git_path'] = GIT_PATH new_config['Blackhole'] = {} new_config['Blackhole']['nzb_dir'] = NZB_DIR new_config['Blackhole']['torrent_dir'] = TORRENT_DIR new_config['TVBinz'] = {} new_config['TVBinz']['tvbinz'] = int(TVBINZ) new_config['TVBinz']['tvbinz_uid'] = TVBINZ_UID new_config['TVBinz']['tvbinz_hash'] = TVBINZ_HASH new_config['TVBinz']['tvbinz_auth'] = TVBINZ_AUTH new_config['NZBs'] = {} new_config['NZBs']['nzbs'] = int(NZBS) new_config['NZBs']['nzbs_uid'] = NZBS_UID new_config['NZBs']['nzbs_hash'] = NZBS_HASH new_config['NZBsRUS'] = {} new_config['NZBsRUS']['nzbsrus'] = int(NZBSRUS) new_config['NZBsRUS']['nzbsrus_uid'] = NZBSRUS_UID new_config['NZBsRUS']['nzbsrus_hash'] = NZBSRUS_HASH new_config['NZBMatrix'] = {} new_config['NZBMatrix']['nzbmatrix'] = int(NZBMATRIX) new_config['NZBMatrix']['nzbmatrix_username'] = NZBMATRIX_USERNAME new_config['NZBMatrix']['nzbmatrix_apikey'] = NZBMATRIX_APIKEY new_config['Newzbin'] = {} new_config['Newzbin']['newzbin'] = int(NEWZBIN) new_config['Newzbin']['newzbin_username'] = NEWZBIN_USERNAME new_config['Newzbin']['newzbin_password'] = NEWZBIN_PASSWORD new_config['Bin-Req'] = {} new_config['Bin-Req']['binreq'] = int(BINREQ) new_config['Womble'] = {} new_config['Womble']['womble'] = int(WOMBLE) new_config['SABnzbd'] = {} new_config['SABnzbd']['sab_username'] = SAB_USERNAME new_config['SABnzbd']['sab_password'] = SAB_PASSWORD new_config['SABnzbd']['sab_apikey'] = SAB_APIKEY new_config['SABnzbd']['sab_category'] = SAB_CATEGORY new_config['SABnzbd']['sab_host'] = SAB_HOST new_config['XBMC'] = {} new_config['XBMC']['xbmc_notify_onsnatch'] = int(XBMC_NOTIFY_ONSNATCH) new_config['XBMC']['xbmc_notify_ondownload'] = int(XBMC_NOTIFY_ONDOWNLOAD) new_config['XBMC']['xbmc_update_library'] = int(XBMC_UPDATE_LIBRARY) new_config['XBMC']['xbmc_update_full'] = int(XBMC_UPDATE_FULL) new_config['XBMC']['xbmc_host'] = XBMC_HOST new_config['XBMC']['xbmc_username'] = XBMC_USERNAME new_config['XBMC']['xbmc_password'] = XBMC_PASSWORD new_config['Growl'] = {} new_config['Growl']['use_growl'] = int(USE_GROWL) new_config['Growl']['growl_host'] = GROWL_HOST new_config['Growl']['growl_password'] = GROWL_PASSWORD new_config['Twitter'] = {} new_config['Twitter']['use_twitter'] = int(USE_TWITTER) new_config['Twitter']['twitter_username'] = TWITTER_USERNAME new_config['Twitter']['twitter_password'] = TWITTER_PASSWORD new_config['Twitter']['twitter_prefix'] = TWITTER_PREFIX new_config['Jabber'] = {} new_config['Jabber']['use_jabber'] = int(USE_JABBER) new_config['Jabber']['jabber_username'] = JABBER_USERNAME new_config['Jabber']['jabber_password'] = JABBER_PASSWORD new_config['Jabber']['jabber_server'] = JABBER_SERVER new_config['Jabber']['jabber_port'] = JABBER_PORT new_config['Jabber']['jabber_recipient'] = JABBER_RECIPIENT new_config['Newznab'] = {} new_config['Newznab']['newznab_data'] = '!!!'.join([x.configStr() for x in newznabProviderList]) new_config.write()
def __init__(self, force=None, show=None): #TODOif not sickbeard.DOWNLOAD_FRENCH: # return if sickbeard.showList==None: return logger.log(u"Beginning the search for french episodes older than "+ str(sickbeard.FRENCH_DELAY) +" days") frenchlist=[] #get list of english episodes that we want to search in french myDB = db.DBConnection() today = datetime.date.today().toordinal() if show: frenchsql=myDB.select("SELECT showid, season, episode from tv_episodes where audio_langs='en' and tv_episodes.showid =? and (? - tv_episodes.airdate) > ? order by showid, airdate asc",[show,today,sickbeard.FRENCH_DELAY]) count=myDB.select("SELECT count(*) from tv_episodes where audio_langs='en' and tv_episodes.showid =? and (? - tv_episodes.airdate) > ?",[show,today,sickbeard.FRENCH_DELAY]) else: frenchsql=myDB.select("SELECT showid, season, episode from tv_episodes, tv_shows where audio_langs='en' and tv_episodes.showid = tv_shows.tvdb_id and tv_shows.frenchsearch = 1 and (? - tv_episodes.airdate) > ? order by showid, airdate asc",[today,sickbeard.FRENCH_DELAY]) count=myDB.select("SELECT count(*) from tv_episodes, tv_shows where audio_langs='en' and tv_episodes.showid = tv_shows.tvdb_id and tv_shows.frenchsearch = 1 and (? - tv_episodes.airdate) > ?",[today,sickbeard.FRENCH_DELAY]) #make the episodes objects logger.log(u"Searching for "+str(count[0][0]) +" episodes in french") for episode in frenchsql: showObj = helpers.findCertainShow(sickbeard.showList, episode[0]) epObj = showObj.getEpisode(episode[1], episode[2]) frenchlist.append(epObj) #for each episode in frenchlist fire a search in french delay=[] for frepisode in frenchlist: if frepisode.show.tvdbid in delay: logger.log(u"Previous episode for show "+str(frepisode.show.tvdbid)+" not found in french so skipping this search", logger.DEBUG) continue result=[] for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue logger.log(u"Searching for french episodes on "+curProvider.name +" for " +frepisode.show.name +" season "+str(frepisode.season)+" episode "+str(frepisode.episode)) try: curfrench = curProvider.findFrench(frepisode, manualSearch=True) except: logger.log(u"Exception", logger.DEBUG) pass for x in curfrench: result.append(x) best=None try: epi={} epi[1]=frepisode best = search.pickBestResult(result, episode = epi) except: pass if best: best.name=best.name + ' snatchedfr' logger.log(u"Found french episode for " +frepisode.show.name +" season "+str(frepisode.season)+" episode "+str(frepisode.episode)) try: search.snatchEpisode(best, SNATCHED_FRENCH) except: logger.log(u"Exception", logger.DEBUG) pass else: delay.append(frepisode.show.tvdbid) logger.log(u"No french episodes found for " +frepisode.show.name +" season "+str(frepisode.season)+" episode "+str(frepisode.episode))
def findEpisode(episode, manualSearch=False): logger.log(u"Searching for " + episode.prettyName(True)) foundResults = [] didSearch = False for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue # we check our results after every search string # this is done because in the future we will have a ordered list of all show aliases and release_group aliases # ordered by success rate ... # lets get all search strings # we use the method from the curProvider to accommodate for the internal join functions # this way we do not break the special abilities of the providers e.g. nzbmatrix searchStrings = curProvider.get_episode_search_strings(episode) logger.log("All search string permutations (" + curProvider.name + "):" + str(searchStrings)) """ try: searchStrings = list(set(searchStrings)) except TypeError: pass """ done_searching = False for searchString in searchStrings: try: curFoundResults = curProvider.findEpisode( episode, manualSearch=manualSearch, searchString=searchString) except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) break # break the while loop except Exception, e: logger.log( u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR) logger.log(traceback.format_exc(), logger.DEBUG) break # break the while loop didSearch = True # skip non-tv crap curFoundResults = filter( lambda x: show_name_helpers.filterBadReleases( x.name) and show_name_helpers.isGoodResult( x.name, episode.show, season=episode.season), curFoundResults) # loop all results and see if any of them are good enough that we can stop searching for cur_result in curFoundResults: done_searching = isFinalResult(cur_result) logger.log( u"Should we stop searching after finding " + cur_result.name + ": " + str(done_searching), logger.DEBUG) if done_searching: break # if we are searching an anime we are a little more loose # this means we check every turn for a possible result # in contrast the isFinalResultlooks function looks for a perfect result (best quality) # but this will accept any result that would have been picked in the end -> pickBestResult # and then stop and use that if episode.show.is_anime: logger.log( u"We are searching an anime. i am checking if we got a good result with search provider " + curProvider.name, logger.DEBUG) bestResult = pickBestResult(curFoundResults, show=episode.show) if bestResult: return bestResult foundResults += curFoundResults # if we did find a result that's good enough to stop then don't continue # this breaks the turn loop if done_searching: break
class SNI_Tests(SiCKRAGETestCase): pass def test_sni(self, provider): try: requests.head(provider.url, verify=certifi.where(), timeout=5) except requests.exceptions.Timeout: pass except requests.exceptions.SSLError as error: if 'SSL3_GET_SERVER_CERTIFICATE' not in ex(error): print(error) except Exception: pass for provider in providers.sortedProviderList(): setattr(SNI_Tests, 'test_%s' % provider.name, lambda self, x=provider: test_sni(self, x)) if __name__ == "__main__": print("==================") print("STARTING - SSL TESTS") print("==================") print( "######################################################################" ) unittest.main()
def save_config(): new_config = ConfigObj() new_config.filename = sickbeard.CONFIG_FILE new_config['General'] = {} new_config['General']['log_dir'] = LOG_DIR new_config['General']['web_port'] = WEB_PORT new_config['General']['web_host'] = WEB_HOST new_config['General']['web_ipv6'] = WEB_IPV6 new_config['General']['web_log'] = int(WEB_LOG) new_config['General']['web_root'] = WEB_ROOT new_config['General']['web_username'] = WEB_USERNAME new_config['General']['web_password'] = WEB_PASSWORD new_config['General']['nzb_method'] = NZB_METHOD new_config['General']['usenet_retention'] = int(USENET_RETENTION) new_config['General']['search_frequency'] = int(SEARCH_FREQUENCY) new_config['General']['download_propers'] = int(DOWNLOAD_PROPERS) new_config['General']['quality_default'] = int(QUALITY_DEFAULT) new_config['General']['season_folders_format'] = SEASON_FOLDERS_FORMAT new_config['General']['season_folders_default'] = int(SEASON_FOLDERS_DEFAULT) new_config['General']['provider_order'] = ' '.join([x.getID() for x in providers.sortedProviderList()]) new_config['General']['version_notify'] = int(VERSION_NOTIFY) new_config['General']['naming_ep_name'] = int(NAMING_EP_NAME) new_config['General']['naming_show_name'] = int(NAMING_SHOW_NAME) new_config['General']['naming_ep_type'] = int(NAMING_EP_TYPE) new_config['General']['naming_multi_ep_type'] = int(NAMING_MULTI_EP_TYPE) new_config['General']['naming_sep_type'] = int(NAMING_SEP_TYPE) new_config['General']['naming_use_periods'] = int(NAMING_USE_PERIODS) new_config['General']['naming_quality'] = int(NAMING_QUALITY) new_config['General']['naming_dates'] = int(NAMING_DATES) new_config['General']['launch_browser'] = int(LAUNCH_BROWSER) new_config['General']['use_banner'] = int(USE_BANNER) new_config['General']['use_listview'] = int(USE_LISTVIEW) new_config['General']['metadata_xbmc'] = metadata_provider_dict['XBMC'].get_config() new_config['General']['metadata_mediabrowser'] = metadata_provider_dict['MediaBrowser'].get_config() new_config['General']['metadata_ps3'] = metadata_provider_dict['Sony PS3'].get_config() new_config['General']['cache_dir'] = CACHE_DIR if CACHE_DIR else 'cache' new_config['General']['tv_download_dir'] = TV_DOWNLOAD_DIR new_config['General']['keep_processed_dir'] = int(KEEP_PROCESSED_DIR) new_config['General']['move_associated_files'] = int(MOVE_ASSOCIATED_FILES) new_config['General']['process_automatically'] = int(PROCESS_AUTOMATICALLY) new_config['General']['rename_episodes'] = int(RENAME_EPISODES) new_config['General']['extra_scripts'] = '|'.join(EXTRA_SCRIPTS) new_config['General']['git_path'] = GIT_PATH new_config['Blackhole'] = {} new_config['Blackhole']['nzb_dir'] = NZB_DIR new_config['Blackhole']['torrent_dir'] = TORRENT_DIR new_config['EZRSS'] = {} new_config['EZRSS']['ezrss'] = int(EZRSS) new_config['TVBinz'] = {} new_config['TVBinz']['tvbinz'] = int(TVBINZ) new_config['TVBinz']['tvbinz_uid'] = TVBINZ_UID new_config['TVBinz']['tvbinz_hash'] = TVBINZ_HASH new_config['TVBinz']['tvbinz_auth'] = TVBINZ_AUTH new_config['NZBs'] = {} new_config['NZBs']['nzbs'] = int(NZBS) new_config['NZBs']['nzbs_uid'] = NZBS_UID new_config['NZBs']['nzbs_hash'] = NZBS_HASH new_config['NZBsRUS'] = {} new_config['NZBsRUS']['nzbsrus'] = int(NZBSRUS) new_config['NZBsRUS']['nzbsrus_uid'] = NZBSRUS_UID new_config['NZBsRUS']['nzbsrus_hash'] = NZBSRUS_HASH new_config['NZBMatrix'] = {} new_config['NZBMatrix']['nzbmatrix'] = int(NZBMATRIX) new_config['NZBMatrix']['nzbmatrix_username'] = NZBMATRIX_USERNAME new_config['NZBMatrix']['nzbmatrix_apikey'] = NZBMATRIX_APIKEY new_config['Newzbin'] = {} new_config['Newzbin']['newzbin'] = int(NEWZBIN) new_config['Newzbin']['newzbin_username'] = NEWZBIN_USERNAME new_config['Newzbin']['newzbin_password'] = NEWZBIN_PASSWORD new_config['Bin-Req'] = {} new_config['Bin-Req']['binreq'] = int(BINREQ) new_config['Womble'] = {} new_config['Womble']['womble'] = int(WOMBLE) new_config['SABnzbd'] = {} new_config['SABnzbd']['sab_username'] = SAB_USERNAME new_config['SABnzbd']['sab_password'] = SAB_PASSWORD new_config['SABnzbd']['sab_apikey'] = SAB_APIKEY new_config['SABnzbd']['sab_category'] = SAB_CATEGORY new_config['SABnzbd']['sab_host'] = SAB_HOST new_config['XBMC'] = {} new_config['XBMC']['use_xbmc'] = int(USE_XBMC) new_config['XBMC']['xbmc_notify_onsnatch'] = int(XBMC_NOTIFY_ONSNATCH) new_config['XBMC']['xbmc_notify_ondownload'] = int(XBMC_NOTIFY_ONDOWNLOAD) new_config['XBMC']['xbmc_update_library'] = int(XBMC_UPDATE_LIBRARY) new_config['XBMC']['xbmc_update_full'] = int(XBMC_UPDATE_FULL) new_config['XBMC']['xbmc_host'] = XBMC_HOST new_config['XBMC']['xbmc_username'] = XBMC_USERNAME new_config['XBMC']['xbmc_password'] = XBMC_PASSWORD new_config['Growl'] = {} new_config['Growl']['use_growl'] = int(USE_GROWL) new_config['Growl']['growl_notify_onsnatch'] = int(GROWL_NOTIFY_ONSNATCH) new_config['Growl']['growl_notify_ondownload'] = int(GROWL_NOTIFY_ONDOWNLOAD) new_config['Growl']['growl_host'] = GROWL_HOST new_config['Growl']['growl_password'] = GROWL_PASSWORD new_config['Twitter'] = {} new_config['Twitter']['use_twitter'] = int(USE_TWITTER) new_config['Twitter']['twitter_notify_onsnatch'] = int(TWITTER_NOTIFY_ONSNATCH) new_config['Twitter']['twitter_notify_ondownload'] = int(TWITTER_NOTIFY_ONDOWNLOAD) new_config['Twitter']['twitter_username'] = TWITTER_USERNAME new_config['Twitter']['twitter_password'] = TWITTER_PASSWORD new_config['Twitter']['twitter_prefix'] = TWITTER_PREFIX new_config['Newznab'] = {} new_config['Newznab']['newznab_data'] = '!!!'.join([x.configStr() for x in newznabProviderList]) new_config['GUI'] = {} new_config['GUI']['coming_eps_layout'] = COMING_EPS_LAYOUT new_config['GUI']['coming_eps_display_paused'] = int(COMING_EPS_DISPLAY_PAUSED) new_config['GUI']['coming_eps_sort'] = COMING_EPS_SORT new_config.write()
def save_config(): new_config = ConfigObj() new_config.filename = CONFIG_FILE new_config['General'] = {} new_config['General']['log_dir'] = LOG_DIR new_config['General']['web_port'] = WEB_PORT new_config['General']['web_host'] = WEB_HOST new_config['General']['web_ipv6'] = int(WEB_IPV6) new_config['General']['web_log'] = int(WEB_LOG) new_config['General']['web_root'] = WEB_ROOT new_config['General']['web_username'] = WEB_USERNAME new_config['General']['web_password'] = WEB_PASSWORD new_config['General']['use_api'] = int(USE_API) new_config['General']['api_key'] = API_KEY new_config['General']['use_nzbs'] = int(USE_NZBS) new_config['General']['use_torrents'] = int(USE_TORRENTS) new_config['General']['nzb_method'] = NZB_METHOD new_config['General']['usenet_retention'] = int(USENET_RETENTION) new_config['General']['search_frequency'] = int(SEARCH_FREQUENCY) new_config['General']['download_propers'] = int(DOWNLOAD_PROPERS) new_config['General']['quality_default'] = int(QUALITY_DEFAULT) new_config['General']['status_default'] = int(STATUS_DEFAULT) new_config['General']['season_folders_format'] = SEASON_FOLDERS_FORMAT new_config['General']['season_folders_default'] = int(SEASON_FOLDERS_DEFAULT) new_config['General']['provider_order'] = ' '.join([x.getID() for x in providers.sortedProviderList()]) new_config['General']['version_notify'] = int(VERSION_NOTIFY) new_config['General']['naming_ep_name'] = int(NAMING_EP_NAME) new_config['General']['naming_show_name'] = int(NAMING_SHOW_NAME) new_config['General']['naming_ep_type'] = int(NAMING_EP_TYPE) new_config['General']['naming_multi_ep_type'] = int(NAMING_MULTI_EP_TYPE) new_config['General']['naming_sep_type'] = int(NAMING_SEP_TYPE) new_config['General']['naming_use_periods'] = int(NAMING_USE_PERIODS) new_config['General']['naming_quality'] = int(NAMING_QUALITY) new_config['General']['naming_dates'] = int(NAMING_DATES) new_config['General']['launch_browser'] = int(LAUNCH_BROWSER) new_config['General']['use_banner'] = int(USE_BANNER) new_config['General']['use_listview'] = int(USE_LISTVIEW) new_config['General']['metadata_xbmc'] = metadata_provider_dict['XBMC'].get_config() new_config['General']['metadata_mediabrowser'] = metadata_provider_dict['MediaBrowser'].get_config() new_config['General']['metadata_ps3'] = metadata_provider_dict['Sony PS3'].get_config() new_config['General']['metadata_wdtv'] = metadata_provider_dict['WDTV'].get_config() new_config['General']['metadata_tivo'] = metadata_provider_dict['TIVO'].get_config() new_config['General']['cache_dir'] = ACTUAL_CACHE_DIR if ACTUAL_CACHE_DIR else 'cache' new_config['General']['root_dirs'] = ROOT_DIRS if ROOT_DIRS else '' new_config['General']['tv_download_dir'] = TV_DOWNLOAD_DIR new_config['General']['keep_processed_dir'] = int(KEEP_PROCESSED_DIR) new_config['General']['move_associated_files'] = int(MOVE_ASSOCIATED_FILES) new_config['General']['process_automatically'] = int(PROCESS_AUTOMATICALLY) new_config['General']['rename_episodes'] = int(RENAME_EPISODES) new_config['General']['extra_scripts'] = '|'.join(EXTRA_SCRIPTS) new_config['General']['git_path'] = GIT_PATH new_config['General']['ignore_words'] = IGNORE_WORDS new_config['Blackhole'] = {} new_config['Blackhole']['nzb_dir'] = NZB_DIR new_config['Blackhole']['torrent_dir'] = TORRENT_DIR new_config['EZRSS'] = {} new_config['EZRSS']['ezrss'] = int(EZRSS) new_config['TVTORRENTS'] = {} new_config['TVTORRENTS']['tvtorrents'] = int(TVTORRENTS) new_config['TVTORRENTS']['tvtorrents_digest'] = TVTORRENTS_DIGEST new_config['TVTORRENTS']['tvtorrents_hash'] = TVTORRENTS_HASH new_config['NZBs'] = {} new_config['NZBs']['nzbs'] = int(NZBS) new_config['NZBs']['nzbs_uid'] = NZBS_UID new_config['NZBs']['nzbs_hash'] = NZBS_HASH new_config['NZBsRUS'] = {} new_config['NZBsRUS']['nzbsrus'] = int(NZBSRUS) new_config['NZBsRUS']['nzbsrus_uid'] = NZBSRUS_UID new_config['NZBsRUS']['nzbsrus_hash'] = NZBSRUS_HASH new_config['NZBMatrix'] = {} new_config['NZBMatrix']['nzbmatrix'] = int(NZBMATRIX) new_config['NZBMatrix']['nzbmatrix_username'] = NZBMATRIX_USERNAME new_config['NZBMatrix']['nzbmatrix_apikey'] = NZBMATRIX_APIKEY new_config['Newzbin'] = {} new_config['Newzbin']['newzbin'] = int(NEWZBIN) new_config['Newzbin']['newzbin_username'] = NEWZBIN_USERNAME new_config['Newzbin']['newzbin_password'] = NEWZBIN_PASSWORD new_config['Womble'] = {} new_config['Womble']['womble'] = int(WOMBLE) new_config['SABnzbd'] = {} new_config['SABnzbd']['sab_username'] = SAB_USERNAME new_config['SABnzbd']['sab_password'] = SAB_PASSWORD new_config['SABnzbd']['sab_apikey'] = SAB_APIKEY new_config['SABnzbd']['sab_category'] = SAB_CATEGORY new_config['SABnzbd']['sab_host'] = SAB_HOST new_config['NZBget'] = {} new_config['NZBget']['nzbget_password'] = NZBGET_PASSWORD new_config['NZBget']['nzbget_category'] = NZBGET_CATEGORY new_config['NZBget']['nzbget_host'] = NZBGET_HOST new_config['XBMC'] = {} new_config['XBMC']['use_xbmc'] = int(USE_XBMC) new_config['XBMC']['xbmc_notify_onsnatch'] = int(XBMC_NOTIFY_ONSNATCH) new_config['XBMC']['xbmc_notify_ondownload'] = int(XBMC_NOTIFY_ONDOWNLOAD) new_config['XBMC']['xbmc_update_library'] = int(XBMC_UPDATE_LIBRARY) new_config['XBMC']['xbmc_update_full'] = int(XBMC_UPDATE_FULL) new_config['XBMC']['xbmc_host'] = XBMC_HOST new_config['XBMC']['xbmc_username'] = XBMC_USERNAME new_config['XBMC']['xbmc_password'] = XBMC_PASSWORD new_config['Plex'] = {} new_config['Plex']['use_plex'] = int(USE_PLEX) new_config['Plex']['plex_notify_onsnatch'] = int(PLEX_NOTIFY_ONSNATCH) new_config['Plex']['plex_notify_ondownload'] = int(PLEX_NOTIFY_ONDOWNLOAD) new_config['Plex']['plex_update_library'] = int(PLEX_UPDATE_LIBRARY) new_config['Plex']['plex_server_host'] = PLEX_SERVER_HOST new_config['Plex']['plex_host'] = PLEX_HOST new_config['Plex']['plex_username'] = PLEX_USERNAME new_config['Plex']['plex_password'] = PLEX_PASSWORD new_config['Growl'] = {} new_config['Growl']['use_growl'] = int(USE_GROWL) new_config['Growl']['growl_notify_onsnatch'] = int(GROWL_NOTIFY_ONSNATCH) new_config['Growl']['growl_notify_ondownload'] = int(GROWL_NOTIFY_ONDOWNLOAD) new_config['Growl']['growl_host'] = GROWL_HOST new_config['Growl']['growl_password'] = GROWL_PASSWORD new_config['Prowl'] = {} new_config['Prowl']['use_prowl'] = int(USE_PROWL) new_config['Prowl']['prowl_notify_onsnatch'] = int(PROWL_NOTIFY_ONSNATCH) new_config['Prowl']['prowl_notify_ondownload'] = int(PROWL_NOTIFY_ONDOWNLOAD) new_config['Prowl']['prowl_api'] = PROWL_API new_config['Prowl']['prowl_priority'] = PROWL_PRIORITY new_config['Twitter'] = {} new_config['Twitter']['use_twitter'] = int(USE_TWITTER) new_config['Twitter']['twitter_notify_onsnatch'] = int(TWITTER_NOTIFY_ONSNATCH) new_config['Twitter']['twitter_notify_ondownload'] = int(TWITTER_NOTIFY_ONDOWNLOAD) new_config['Twitter']['twitter_username'] = TWITTER_USERNAME new_config['Twitter']['twitter_password'] = TWITTER_PASSWORD new_config['Twitter']['twitter_prefix'] = TWITTER_PREFIX new_config['Notifo'] = {} new_config['Notifo']['use_notifo'] = int(USE_NOTIFO) new_config['Notifo']['notifo_notify_onsnatch'] = int(NOTIFO_NOTIFY_ONSNATCH) new_config['Notifo']['notifo_notify_ondownload'] = int(NOTIFO_NOTIFY_ONDOWNLOAD) new_config['Notifo']['notifo_username'] = NOTIFO_USERNAME new_config['Notifo']['notifo_apisecret'] = NOTIFO_APISECRET new_config['Boxcar'] = {} new_config['Boxcar']['use_boxcar'] = int(USE_BOXCAR) new_config['Boxcar']['boxcar_notify_onsnatch'] = int(BOXCAR_NOTIFY_ONSNATCH) new_config['Boxcar']['boxcar_notify_ondownload'] = int(BOXCAR_NOTIFY_ONDOWNLOAD) new_config['Boxcar']['boxcar_username'] = BOXCAR_USERNAME new_config['Libnotify'] = {} new_config['Libnotify']['use_libnotify'] = int(USE_LIBNOTIFY) new_config['Libnotify']['libnotify_notify_onsnatch'] = int(LIBNOTIFY_NOTIFY_ONSNATCH) new_config['Libnotify']['libnotify_notify_ondownload'] = int(LIBNOTIFY_NOTIFY_ONDOWNLOAD) new_config['NMJ'] = {} new_config['NMJ']['use_nmj'] = int(USE_NMJ) new_config['NMJ']['nmj_host'] = NMJ_HOST new_config['NMJ']['nmj_database'] = NMJ_DATABASE new_config['NMJ']['nmj_mount'] = NMJ_MOUNT new_config['Synology'] = {} new_config['Synology']['use_synoindex'] = int(USE_SYNOINDEX) new_config['Trakt'] = {} new_config['Trakt']['use_trakt'] = int(USE_TRAKT) new_config['Trakt']['trakt_username'] = TRAKT_USERNAME new_config['Trakt']['trakt_password'] = TRAKT_PASSWORD new_config['Trakt']['trakt_api'] = TRAKT_API new_config['pyTivo'] = {} new_config['pyTivo']['use_pytivo'] = int(USE_PYTIVO) new_config['pyTivo']['pytivo_notify_onsnatch'] = int(PYTIVO_NOTIFY_ONSNATCH) new_config['pyTivo']['pytivo_notify_ondownload'] = int(PYTIVO_NOTIFY_ONDOWNLOAD) new_config['pyTivo']['pyTivo_update_library'] = int(PYTIVO_UPDATE_LIBRARY) new_config['pyTivo']['pytivo_host'] = PYTIVO_HOST new_config['pyTivo']['pytivo_share_name'] = PYTIVO_SHARE_NAME new_config['pyTivo']['pytivo_tivo_name'] = PYTIVO_TIVO_NAME new_config['Newznab'] = {} new_config['Newznab']['newznab_data'] = '!!!'.join([x.configStr() for x in newznabProviderList]) new_config['GUI'] = {} new_config['GUI']['coming_eps_layout'] = COMING_EPS_LAYOUT new_config['GUI']['coming_eps_display_paused'] = int(COMING_EPS_DISPLAY_PAUSED) new_config['GUI']['coming_eps_sort'] = COMING_EPS_SORT new_config.write()
def save_config(): new_config = ConfigObj() new_config.filename = CONFIG_FILE new_config['General'] = {} new_config['General']['log_dir'] = LOG_DIR new_config['General']['web_port'] = WEB_PORT new_config['General']['web_host'] = WEB_HOST new_config['General']['web_ipv6'] = int(WEB_IPV6) new_config['General']['web_log'] = int(WEB_LOG) new_config['General']['web_root'] = WEB_ROOT new_config['General']['web_username'] = WEB_USERNAME new_config['General']['web_password'] = WEB_PASSWORD new_config['General']['use_api'] = int(USE_API) new_config['General']['api_key'] = API_KEY new_config['General']['enable_https'] = int(ENABLE_HTTPS) new_config['General']['https_cert'] = HTTPS_CERT new_config['General']['https_key'] = HTTPS_KEY new_config['General']['use_nzbs'] = int(USE_NZBS) new_config['General']['use_torrents'] = int(USE_TORRENTS) new_config['General']['nzb_method'] = NZB_METHOD new_config['General']['usenet_retention'] = int(USENET_RETENTION) new_config['General']['search_frequency'] = int(SEARCH_FREQUENCY) new_config['General']['download_propers'] = int(DOWNLOAD_PROPERS) new_config['General']['quality_default'] = int(QUALITY_DEFAULT) new_config['General']['status_default'] = int(STATUS_DEFAULT) new_config['General']['flatten_folders_default'] = int( FLATTEN_FOLDERS_DEFAULT) new_config['General']['provider_order'] = ' '.join( [x.getID() for x in providers.sortedProviderList()]) new_config['General']['version_notify'] = int(VERSION_NOTIFY) new_config['General']['naming_pattern'] = NAMING_PATTERN new_config['General']['naming_custom_abd'] = int(NAMING_CUSTOM_ABD) new_config['General']['naming_abd_pattern'] = NAMING_ABD_PATTERN new_config['General']['naming_multi_ep'] = int(NAMING_MULTI_EP) new_config['General']['launch_browser'] = int(LAUNCH_BROWSER) new_config['General']['use_banner'] = int(USE_BANNER) new_config['General']['use_listview'] = int(USE_LISTVIEW) new_config['General']['metadata_xbmc'] = metadata_provider_dict[ 'XBMC'].get_config() new_config['General']['metadata_mediabrowser'] = metadata_provider_dict[ 'MediaBrowser'].get_config() new_config['General']['metadata_ps3'] = metadata_provider_dict[ 'Sony PS3'].get_config() new_config['General']['metadata_wdtv'] = metadata_provider_dict[ 'WDTV'].get_config() new_config['General']['metadata_tivo'] = metadata_provider_dict[ 'TIVO'].get_config() new_config['General']['metadata_synology'] = metadata_provider_dict[ 'Synology'].get_config() new_config['General'][ 'cache_dir'] = ACTUAL_CACHE_DIR if ACTUAL_CACHE_DIR else 'cache' new_config['General']['root_dirs'] = ROOT_DIRS if ROOT_DIRS else '' new_config['General']['tv_download_dir'] = TV_DOWNLOAD_DIR new_config['General']['keep_processed_dir'] = int(KEEP_PROCESSED_DIR) new_config['General']['move_associated_files'] = int(MOVE_ASSOCIATED_FILES) new_config['General']['process_automatically'] = int(PROCESS_AUTOMATICALLY) new_config['General']['rename_episodes'] = int(RENAME_EPISODES) new_config['General'][ 'create_missing_show_dirs'] = CREATE_MISSING_SHOW_DIRS new_config['General']['add_shows_wo_dir'] = ADD_SHOWS_WO_DIR new_config['General']['extra_scripts'] = '|'.join(EXTRA_SCRIPTS) new_config['General']['git_path'] = GIT_PATH new_config['General']['ignore_words'] = IGNORE_WORDS new_config['Blackhole'] = {} new_config['Blackhole']['nzb_dir'] = NZB_DIR new_config['Blackhole']['torrent_dir'] = TORRENT_DIR new_config['EZRSS'] = {} new_config['EZRSS']['ezrss'] = int(EZRSS) new_config['TVTORRENTS'] = {} new_config['TVTORRENTS']['tvtorrents'] = int(TVTORRENTS) new_config['TVTORRENTS']['tvtorrents_digest'] = TVTORRENTS_DIGEST new_config['TVTORRENTS']['tvtorrents_hash'] = TVTORRENTS_HASH new_config['BTN'] = {} new_config['BTN']['btn'] = int(BTN) new_config['BTN']['btn_api_key'] = BTN_API_KEY new_config['NZBs'] = {} new_config['NZBs']['nzbs'] = int(NZBS) new_config['NZBs']['nzbs_uid'] = NZBS_UID new_config['NZBs']['nzbs_hash'] = NZBS_HASH new_config['NZBsRUS'] = {} new_config['NZBsRUS']['nzbsrus'] = int(NZBSRUS) new_config['NZBsRUS']['nzbsrus_uid'] = NZBSRUS_UID new_config['NZBsRUS']['nzbsrus_hash'] = NZBSRUS_HASH new_config['NZBMatrix'] = {} new_config['NZBMatrix']['nzbmatrix'] = int(NZBMATRIX) new_config['NZBMatrix']['nzbmatrix_username'] = NZBMATRIX_USERNAME new_config['NZBMatrix']['nzbmatrix_apikey'] = NZBMATRIX_APIKEY new_config['Newzbin'] = {} new_config['Newzbin']['newzbin'] = int(NEWZBIN) new_config['Newzbin']['newzbin_username'] = NEWZBIN_USERNAME new_config['Newzbin']['newzbin_password'] = NEWZBIN_PASSWORD new_config['Womble'] = {} new_config['Womble']['womble'] = int(WOMBLE) new_config['SABnzbd'] = {} new_config['SABnzbd']['sab_username'] = SAB_USERNAME new_config['SABnzbd']['sab_password'] = SAB_PASSWORD new_config['SABnzbd']['sab_apikey'] = SAB_APIKEY new_config['SABnzbd']['sab_category'] = SAB_CATEGORY new_config['SABnzbd']['sab_host'] = SAB_HOST new_config['NZBget'] = {} new_config['NZBget']['nzbget_password'] = NZBGET_PASSWORD new_config['NZBget']['nzbget_category'] = NZBGET_CATEGORY new_config['NZBget']['nzbget_host'] = NZBGET_HOST new_config['XBMC'] = {} new_config['XBMC']['use_xbmc'] = int(USE_XBMC) new_config['XBMC']['xbmc_notify_onsnatch'] = int(XBMC_NOTIFY_ONSNATCH) new_config['XBMC']['xbmc_notify_ondownload'] = int(XBMC_NOTIFY_ONDOWNLOAD) new_config['XBMC']['xbmc_update_library'] = int(XBMC_UPDATE_LIBRARY) new_config['XBMC']['xbmc_update_full'] = int(XBMC_UPDATE_FULL) new_config['XBMC']['xbmc_host'] = XBMC_HOST new_config['XBMC']['xbmc_username'] = XBMC_USERNAME new_config['XBMC']['xbmc_password'] = XBMC_PASSWORD new_config['Plex'] = {} new_config['Plex']['use_plex'] = int(USE_PLEX) new_config['Plex']['plex_notify_onsnatch'] = int(PLEX_NOTIFY_ONSNATCH) new_config['Plex']['plex_notify_ondownload'] = int(PLEX_NOTIFY_ONDOWNLOAD) new_config['Plex']['plex_update_library'] = int(PLEX_UPDATE_LIBRARY) new_config['Plex']['plex_server_host'] = PLEX_SERVER_HOST new_config['Plex']['plex_host'] = PLEX_HOST new_config['Plex']['plex_username'] = PLEX_USERNAME new_config['Plex']['plex_password'] = PLEX_PASSWORD new_config['Growl'] = {} new_config['Growl']['use_growl'] = int(USE_GROWL) new_config['Growl']['growl_notify_onsnatch'] = int(GROWL_NOTIFY_ONSNATCH) new_config['Growl']['growl_notify_ondownload'] = int( GROWL_NOTIFY_ONDOWNLOAD) new_config['Growl']['growl_host'] = GROWL_HOST new_config['Growl']['growl_password'] = GROWL_PASSWORD new_config['Prowl'] = {} new_config['Prowl']['use_prowl'] = int(USE_PROWL) new_config['Prowl']['prowl_notify_onsnatch'] = int(PROWL_NOTIFY_ONSNATCH) new_config['Prowl']['prowl_notify_ondownload'] = int( PROWL_NOTIFY_ONDOWNLOAD) new_config['Prowl']['prowl_api'] = PROWL_API new_config['Prowl']['prowl_priority'] = PROWL_PRIORITY new_config['Twitter'] = {} new_config['Twitter']['use_twitter'] = int(USE_TWITTER) new_config['Twitter']['twitter_notify_onsnatch'] = int( TWITTER_NOTIFY_ONSNATCH) new_config['Twitter']['twitter_notify_ondownload'] = int( TWITTER_NOTIFY_ONDOWNLOAD) new_config['Twitter']['twitter_username'] = TWITTER_USERNAME new_config['Twitter']['twitter_password'] = TWITTER_PASSWORD new_config['Twitter']['twitter_prefix'] = TWITTER_PREFIX new_config['Notifo'] = {} new_config['Notifo']['use_notifo'] = int(USE_NOTIFO) new_config['Notifo']['notifo_notify_onsnatch'] = int( NOTIFO_NOTIFY_ONSNATCH) new_config['Notifo']['notifo_notify_ondownload'] = int( NOTIFO_NOTIFY_ONDOWNLOAD) new_config['Notifo']['notifo_username'] = NOTIFO_USERNAME new_config['Notifo']['notifo_apisecret'] = NOTIFO_APISECRET new_config['Boxcar'] = {} new_config['Boxcar']['use_boxcar'] = int(USE_BOXCAR) new_config['Boxcar']['boxcar_notify_onsnatch'] = int( BOXCAR_NOTIFY_ONSNATCH) new_config['Boxcar']['boxcar_notify_ondownload'] = int( BOXCAR_NOTIFY_ONDOWNLOAD) new_config['Boxcar']['boxcar_username'] = BOXCAR_USERNAME new_config['Pushover'] = {} new_config['Pushover']['use_pushover'] = int(USE_PUSHOVER) new_config['Pushover']['pushover_notify_onsnatch'] = int( PUSHOVER_NOTIFY_ONSNATCH) new_config['Pushover']['pushover_notify_ondownload'] = int( PUSHOVER_NOTIFY_ONDOWNLOAD) new_config['Pushover']['pushover_userkey'] = PUSHOVER_USERKEY new_config['Libnotify'] = {} new_config['Libnotify']['use_libnotify'] = int(USE_LIBNOTIFY) new_config['Libnotify']['libnotify_notify_onsnatch'] = int( LIBNOTIFY_NOTIFY_ONSNATCH) new_config['Libnotify']['libnotify_notify_ondownload'] = int( LIBNOTIFY_NOTIFY_ONDOWNLOAD) new_config['NMJ'] = {} new_config['NMJ']['use_nmj'] = int(USE_NMJ) new_config['NMJ']['nmj_host'] = NMJ_HOST new_config['NMJ']['nmj_database'] = NMJ_DATABASE new_config['NMJ']['nmj_mount'] = NMJ_MOUNT new_config['Synology'] = {} new_config['Synology']['use_synoindex'] = int(USE_SYNOINDEX) new_config['Trakt'] = {} new_config['Trakt']['use_trakt'] = int(USE_TRAKT) new_config['Trakt']['trakt_username'] = TRAKT_USERNAME new_config['Trakt']['trakt_password'] = TRAKT_PASSWORD new_config['Trakt']['trakt_api'] = TRAKT_API new_config['pyTivo'] = {} new_config['pyTivo']['use_pytivo'] = int(USE_PYTIVO) new_config['pyTivo']['pytivo_notify_onsnatch'] = int( PYTIVO_NOTIFY_ONSNATCH) new_config['pyTivo']['pytivo_notify_ondownload'] = int( PYTIVO_NOTIFY_ONDOWNLOAD) new_config['pyTivo']['pyTivo_update_library'] = int(PYTIVO_UPDATE_LIBRARY) new_config['pyTivo']['pytivo_host'] = PYTIVO_HOST new_config['pyTivo']['pytivo_share_name'] = PYTIVO_SHARE_NAME new_config['pyTivo']['pytivo_tivo_name'] = PYTIVO_TIVO_NAME new_config['NMA'] = {} new_config['NMA']['use_nma'] = int(USE_NMA) new_config['NMA']['nma_notify_onsnatch'] = int(NMA_NOTIFY_ONSNATCH) new_config['NMA']['nma_notify_ondownload'] = int(NMA_NOTIFY_ONDOWNLOAD) new_config['NMA']['nma_api'] = NMA_API new_config['NMA']['nma_priority'] = NMA_PRIORITY new_config['Newznab'] = {} new_config['Newznab']['newznab_data'] = '!!!'.join( [x.configStr() for x in newznabProviderList]) new_config['GUI'] = {} new_config['GUI']['coming_eps_layout'] = COMING_EPS_LAYOUT new_config['GUI']['coming_eps_display_paused'] = int( COMING_EPS_DISPLAY_PAUSED) new_config['GUI']['coming_eps_sort'] = COMING_EPS_SORT new_config['General']['config_version'] = CONFIG_VERSION new_config.write()