def set_params(self, directory, filename=None, method=None, force=False, is_priority=None, delete=False, failed=False, mode="auto"): """ Adjust settings for a task that is already in the queue :param directory: directory to process :param filename: release/nzb name if available :param method: processing method, copy/move/symlink/link :param force: force overwriting of existing files regardless of quality :param is_priority: whether to replace the file even if it exists at higher quality :param delete: delete files and folders after they are processed (always happens with move and auto combination) :param failed: mark downloads as failed if they fail to process :param mode: processing type: auto/manual :return: None """ self.directory = directory self.filename = filename self.method = method self.force = config.checkbox_to_value(force) self.is_priority = config.checkbox_to_value(is_priority) self.delete = config.checkbox_to_value(delete) self.failed = config.checkbox_to_value(failed) self.mode = mode
def __init__(self, directory, filename=None, method=None, force=False, is_priority=None, delete=False, failed=False, mode="auto"): """ :param directory: directory to process :param filename: release/nzb name if available :param method: processing method, copy/move/symlink/link :param force: force overwriting of existing files regardless of quality :param is_priority: whether to replace the file even if it exists at higher quality :param delete: delete files and folders after they are processed (always happens with move and auto combination) :param failed: mark downloads as failed if they fail to process :param mode: processing type: auto/manual :return: None """ super(PostProcessorTask, self).__init__('{mode}'.format(mode=mode.title()), (MANUAL_POST_PROCESS, AUTO_POST_PROCESS)[mode == "auto"]) self.directory = directory self.filename = filename self.method = method self.force = config.checkbox_to_value(force) self.is_priority = config.checkbox_to_value(is_priority) self.delete = config.checkbox_to_value(delete) self.failed = config.checkbox_to_value(failed) self.mode = mode self.priority = (generic_queue.QueuePriorities.HIGH, generic_queue.QueuePriorities.NORMAL)[mode == 'auto'] self.last_result = None
def saveAddShowDefaults(defaultStatus, anyQualities, bestQualities, defaultSeasonFolders, subtitles=False, anime=False, scene=False, defaultStatusAfter=WANTED): if anyQualities: anyQualities = anyQualities.split(',') else: anyQualities = [] if bestQualities: bestQualities = bestQualities.split(',') else: bestQualities = [] newQuality = Quality.combineQualities([int(quality) for quality in anyQualities], [int(quality) for quality in bestQualities]) sickbeard.STATUS_DEFAULT = int(defaultStatus) sickbeard.STATUS_DEFAULT_AFTER = int(defaultStatusAfter) sickbeard.QUALITY_DEFAULT = int(newQuality) sickbeard.SEASON_FOLDERS_DEFAULT = config.checkbox_to_value(defaultSeasonFolders) sickbeard.SUBTITLES_DEFAULT = config.checkbox_to_value(subtitles) sickbeard.ANIME_DEFAULT = config.checkbox_to_value(anime) sickbeard.SCENE_DEFAULT = config.checkbox_to_value(scene) sickbeard.save_config() ui.notifications.message(_('Saved Defaults'), _('Your "add show" defaults have been set to your current selections.'))
def test_checkbox_to_value(self): """ Test checkbox_to_value """ self.assertTrue(config.checkbox_to_value(1)) self.assertTrue(config.checkbox_to_value(['option', 'True'])) self.assertEqual(config.checkbox_to_value('0', 'yes', 'no'), 'no')
def __init__(self, directory, filename=None, method=None, force=False, is_priority=None, delete=False, failed=False, mode="auto"): """ :param directory: directory to process :param filename: release/nzb name if available :param method: processing method, copy/move/symlink/link :param force: force overwriting of existing files regardless of quality :param is_priority: whether to replace the file even if it exists at higher quality :param delete: delete files and folders after they are processed (always happens with move and auto combination) :param failed: mark downloads as failed if they fail to process :param mode: processing type: auto/manual :return: None """ super(PostProcessorTask, self).__init__(u'{mode}'.format(mode=mode.title()), (MANUAL_POST_PROCESS, AUTO_POST_PROCESS)[mode == "auto"]) self.directory = directory self.filename = filename self.method = method self.force = config.checkbox_to_value(force) self.is_priority = config.checkbox_to_value(is_priority) self.delete = config.checkbox_to_value(delete) self.failed = config.checkbox_to_value(failed) self.mode = mode self.priority = (generic_queue.QueuePriorities.HIGH, generic_queue.QueuePriorities.NORMAL)[mode == 'auto'] self.last_result = None
def saveAnime(self, use_anidb=None, anidb_username=None, anidb_password=None, anidb_use_mylist=None, split_home=None): """ Save anime related settings """ results = [] sickbeard.USE_ANIDB = config.checkbox_to_value(use_anidb) sickbeard.ANIDB_USERNAME = anidb_username sickbeard.ANIDB_PASSWORD = anidb_password sickbeard.ANIDB_USE_MYLIST = config.checkbox_to_value(anidb_use_mylist) sickbeard.ANIME_SPLIT_HOME = config.checkbox_to_value(split_home) sickbeard.save_config() if results: for x in results: logger.log(x, logger.ERROR) ui.notifications.error('Error(s) Saving Configuration', '<br>\n'.join(results)) else: ui.notifications.message('Configuration Saved', ek(os.path.join, sickbeard.CONFIG_FILE)) return self.redirect('/config/anime/')
def saveAnime(self, use_anidb=None, anidb_username=None, anidb_password=None, anidb_use_mylist=None, split_home=None, split_home_in_tabs=None): sickbeard.USE_ANIDB = config.checkbox_to_value(use_anidb) sickbeard.ANIDB_USERNAME = anidb_username sickbeard.ANIDB_PASSWORD = filters.unhide(sickbeard.ANIDB_PASSWORD, anidb_password) sickbeard.ANIDB_USE_MYLIST = config.checkbox_to_value(anidb_use_mylist) sickbeard.ANIME_SPLIT_HOME = config.checkbox_to_value(split_home) sickbeard.ANIME_SPLIT_HOME_IN_TABS = config.checkbox_to_value(split_home_in_tabs) sickbeard.save_config() ui.notifications.message(_('Configuration Saved'), ek(os.path.join, sickbeard.CONFIG_FILE)) return self.redirect("/config/anime/")
def saveSubtitles(self, use_subtitles=None, subtitles_plugins=None, subtitles_languages=None, subtitles_dir=None, subtitles_perfect_match=None, service_order=None, subtitles_history=None, subtitles_finder_frequency=None, subtitles_multi=None, embedded_subtitles_all=None, subtitles_extra_scripts=None, subtitles_pre_scripts=None, subtitles_hearing_impaired=None, addic7ed_user=None, addic7ed_pass=None, itasa_user=None, itasa_pass=None, legendastv_user=None, legendastv_pass=None, opensubtitles_user=None, opensubtitles_pass=None, subtitles_download_in_pp=None, subtitles_keep_only_wanted=None): """ Save Subtitle Search related settings """ results = [] config.change_SUBTITLES_FINDER_FREQUENCY(subtitles_finder_frequency) config.change_USE_SUBTITLES(use_subtitles) sickbeard.SUBTITLES_LANGUAGES = [code.strip() for code in subtitles_languages.split(',') if code.strip() in subtitles.subtitle_code_filter()] if subtitles_languages else [] sickbeard.SUBTITLES_DIR = subtitles_dir sickbeard.SUBTITLES_PERFECT_MATCH = config.checkbox_to_value(subtitles_perfect_match) sickbeard.SUBTITLES_HISTORY = config.checkbox_to_value(subtitles_history) sickbeard.EMBEDDED_SUBTITLES_ALL = config.checkbox_to_value(embedded_subtitles_all) sickbeard.SUBTITLES_HEARING_IMPAIRED = config.checkbox_to_value(subtitles_hearing_impaired) sickbeard.SUBTITLES_MULTI = 1 if len(sickbeard.SUBTITLES_LANGUAGES) > 1 else config.checkbox_to_value(subtitles_multi) sickbeard.SUBTITLES_DOWNLOAD_IN_PP = config.checkbox_to_value(subtitles_download_in_pp) sickbeard.SUBTITLES_KEEP_ONLY_WANTED = config.checkbox_to_value(subtitles_keep_only_wanted) sickbeard.SUBTITLES_EXTRA_SCRIPTS = [x.strip() for x in subtitles_extra_scripts.split('|') if x.strip()] sickbeard.SUBTITLES_PRE_SCRIPTS = [x.strip() for x in subtitles_pre_scripts.split('|') if x.strip()] # Subtitles services services_str_list = service_order.split() subtitles_services_list = [] subtitles_services_enabled = [] for curServiceStr in services_str_list: cur_service, cur_enabled = curServiceStr.split(':') subtitles_services_list.append(cur_service) subtitles_services_enabled.append(int(cur_enabled)) sickbeard.SUBTITLES_SERVICES_LIST = subtitles_services_list sickbeard.SUBTITLES_SERVICES_ENABLED = subtitles_services_enabled sickbeard.ADDIC7ED_USER = addic7ed_user or '' sickbeard.ADDIC7ED_PASS = addic7ed_pass or '' sickbeard.ITASA_USER = itasa_user or '' sickbeard.ITASA_PASS = itasa_pass or '' sickbeard.LEGENDASTV_USER = legendastv_user or '' sickbeard.LEGENDASTV_PASS = legendastv_pass or '' sickbeard.OPENSUBTITLES_USER = opensubtitles_user or '' sickbeard.OPENSUBTITLES_PASS = opensubtitles_pass or '' sickbeard.save_config() # Reset provider pool so next time we use the newest settings subtitles.get_provider_pool.invalidate() if results: for x in results: logger.log(x, logger.ERROR) ui.notifications.error('Error(s) Saving Configuration', '<br>\n'.join(results)) else: ui.notifications.message('Configuration Saved', ek(os.path.join, sickbeard.CONFIG_FILE)) return self.redirect('/config/subtitles/')
def saveAddShowDefaults(defaultStatus, anyQualities, bestQualities, defaultFlattenFolders, subtitles=False, anime=False, scene=False, defaultStatusAfter=WANTED): allowed_qualities = anyQualities.split(',') if anyQualities else [] preferred_qualities = bestQualities.split(',') if bestQualities else [] new_quality = Quality.combineQualities([int(quality) for quality in allowed_qualities], [int(quality) for quality in preferred_qualities]) sickbeard.STATUS_DEFAULT = int(defaultStatus) sickbeard.STATUS_DEFAULT_AFTER = int(defaultStatusAfter) sickbeard.QUALITY_DEFAULT = int(new_quality) sickbeard.FLATTEN_FOLDERS_DEFAULT = config.checkbox_to_value(defaultFlattenFolders) sickbeard.SUBTITLES_DEFAULT = config.checkbox_to_value(subtitles) sickbeard.ANIME_DEFAULT = config.checkbox_to_value(anime) sickbeard.SCENE_DEFAULT = config.checkbox_to_value(scene) sickbeard.save_config()
def post(self, next_=None): notifiers.notify_login(self.request.remote_ip) if self.get_body_argument('username', None) == sickbeard.WEB_USERNAME and self.get_body_argument('password', None) == sickbeard.WEB_PASSWORD: remember_me = config.checkbox_to_value(self.get_body_argument('remember_me', 0)) self.set_secure_cookie('sickchill_user', sickbeard.API_KEY, expires_days=(None, 30)[remember_me]) logger.log('User logged into the SickChill web interface', logger.INFO) else: logger.log('User attempted a failed login to the SickChill web interface from IP: ' + self.request.remote_ip, logger.WARNING) next_ = self.get_query_argument('next', next_) self.redirect(next_ or '/' + sickbeard.DEFAULT_PAGE + '/')
def processEpisode(self, proc_dir=None, nzbName=None, quiet=None, process_method=None, force=None, is_priority=None, delete_on="0", failed="0", proc_type="manual", force_next=False, *args_, **kwargs): mode = kwargs.get('type', proc_type) process_path = ss( xhtml_unescape(kwargs.get('dir', proc_dir or '') or '')) if not process_path: return self.redirect("/home/postprocess/") release_name = ss(xhtml_unescape(nzbName)) if nzbName else nzbName result = sickbeard.postProcessorTaskScheduler.action.add_item( process_path, release_name, method=process_method, force=force, is_priority=is_priority, delete=delete_on, failed=failed, mode=mode, force_next=force_next) if config.checkbox_to_value(quiet): return result if result: result = result.replace("\n", "<br>\n") return self._genericMessage("Postprocessing results", result)
def saveProviders(self, newznab_string='', torrentrss_string='', provider_order=None, **kwargs): newznabProviderDict = dict( zip((x.get_id() for x in sickbeard.newznabProviderList), sickbeard.newznabProviderList)) finished_names = [] # add all the newznab info we got into our list # if not newznab_string: # logger.log('No newznab_string passed to saveProviders', logger.DEBUG) for curNewznabProviderStr in newznab_string.split('!!!'): if not curNewznabProviderStr: continue cur_name, cur_url, cur_key, cur_cat = curNewznabProviderStr.split('|') cur_url = config.clean_url(cur_url) cur_id = GenericProvider.make_id(cur_name) # if it does not already exist then add it if cur_id not in newznabProviderDict: new_provider = newznab.NewznabProvider(cur_name, cur_url, key=cur_key, catIDs=cur_cat) sickbeard.newznabProviderList.append(new_provider) newznabProviderDict[cur_id] = new_provider # set all params newznabProviderDict[cur_id].name = cur_name newznabProviderDict[cur_id].url = cur_url newznabProviderDict[cur_id].key = cur_key newznabProviderDict[cur_id].catIDs = cur_cat # a 0 in the key spot indicates that no key is needed newznabProviderDict[cur_id].needs_auth = cur_key and cur_key != '0' newznabProviderDict[cur_id].search_mode = str(kwargs.get(cur_id + '_search_mode', 'eponly')).strip() newznabProviderDict[cur_id].search_fallback = config.checkbox_to_value(kwargs.get(cur_id + 'search_fallback', 0), value_on=1, value_off=0) newznabProviderDict[cur_id].enable_daily = config.checkbox_to_value(kwargs.get(cur_id + 'enable_daily', 0), value_on=1, value_off=0) newznabProviderDict[cur_id].enable_backlog = config.checkbox_to_value(kwargs.get(cur_id + 'enable_backlog', 0), value_on=1, value_off=0) # mark it finished finished_names.append(cur_id) # delete anything that is in the list that was not processed just now if newznab_string: for curProvider in sickbeard.newznabProviderList: if curProvider.get_id() not in finished_names: sickbeard.newznabProviderList.remove(curProvider) del newznabProviderDict[curProvider.get_id()] # if not torrentrss_string: # logger.log('No torrentrss_string passed to saveProviders', logger.DEBUG) torrentRssProviderDict = dict( zip((x.get_id() for x in sickbeard.torrentRssProviderList), sickbeard.torrentRssProviderList)) finished_names = [] if torrentrss_string: for curTorrentRssProviderStr in torrentrss_string.split('!!!'): if not curTorrentRssProviderStr: continue cur_name, cur_url, cur_cookies, cur_title_tag = curTorrentRssProviderStr.split('|') cur_url = config.clean_url(cur_url) cur_id = GenericProvider.make_id(cur_name) # if it does not already exist then create it if cur_id not in torrentRssProviderDict: new_provider = rsstorrent.TorrentRssProvider(cur_name, cur_url, cur_cookies, cur_title_tag) sickbeard.torrentRssProviderList.append(new_provider) torrentRssProviderDict[cur_id] = new_provider # update values torrentRssProviderDict[cur_id].name = cur_name torrentRssProviderDict[cur_id].url = cur_url torrentRssProviderDict[cur_id].cookies = cur_cookies torrentRssProviderDict[cur_id].cur_title_tag = cur_title_tag # mark it finished finished_names.append(cur_id) # delete anything that is in the list that was not processed just now if torrentrss_string: for curProvider in sickbeard.torrentRssProviderList: if curProvider.get_id() not in finished_names: sickbeard.torrentRssProviderList.remove(curProvider) del torrentRssProviderDict[curProvider.get_id()] # do the enable/disable enabled_provider_list = [] disabled_provider_list = [] for cur_id, cur_enabled in (cur_provider_str.split(':') for cur_provider_str in provider_order.split()): cur_enabled = bool(try_int(cur_enabled)) cur_provider_obj = [x for x in sickbeard.providers.sortedProviderList() if x.get_id() == cur_id and hasattr(x, 'enabled')] if cur_provider_obj: cur_provider_obj[0].enabled = cur_enabled if cur_enabled: enabled_provider_list.append(cur_id) else: disabled_provider_list.append(cur_id) if cur_id in newznabProviderDict: newznabProviderDict[cur_id].enabled = cur_enabled elif cur_id in torrentRssProviderDict: torrentRssProviderDict[cur_id].enabled = cur_enabled # dynamically load provider settings for curProvider in sickbeard.providers.sortedProviderList(): if hasattr(curProvider, 'custom_url'): curProvider.custom_url = str(kwargs.get(curProvider.get_id('_custom_url'), '')).strip() if hasattr(curProvider, 'minseed'): curProvider.minseed = int(str(kwargs.get(curProvider.get_id('_minseed'), 0)).strip()) if hasattr(curProvider, 'minleech'): curProvider.minleech = int(str(kwargs.get(curProvider.get_id('_minleech'), 0)).strip()) if hasattr(curProvider, 'ratio'): if curProvider.get_id('_ratio') in kwargs: ratio = str(kwargs.get(curProvider.get_id('_ratio'))).strip() print (ratio) if ratio in ('None', None, ''): curProvider.ratio = None else: curProvider.ratio = max(float(ratio), -1) else: curProvider.ratio = None if hasattr(curProvider, 'digest'): curProvider.digest = str(kwargs.get(curProvider.get_id('_digest'), '')).strip() or None if hasattr(curProvider, 'hash'): curProvider.hash = str(kwargs.get(curProvider.get_id('_hash'), '')).strip() or None if hasattr(curProvider, 'api_key'): curProvider.api_key = str(kwargs.get(curProvider.get_id('_api_key'), '')).strip() or None if hasattr(curProvider, 'username'): curProvider.username = str(kwargs.get(curProvider.get_id('_username'), '')).strip() or None if hasattr(curProvider, 'password'): curProvider.password = filters.unhide(curProvider.password, str(kwargs.get(curProvider.get_id('_password'), '')).strip()) if hasattr(curProvider, 'passkey'): curProvider.passkey = filters.unhide(curProvider.passkey, str(kwargs.get(curProvider.get_id('_passkey'), '')).strip()) if hasattr(curProvider, 'pin'): curProvider.pin = filters.unhide(curProvider.pin, str(kwargs.get(curProvider.get_id('_pin'), '')).strip()) if hasattr(curProvider, 'confirmed'): curProvider.confirmed = config.checkbox_to_value(kwargs.get(curProvider.get_id('_confirmed'))) if hasattr(curProvider, 'ranked'): curProvider.ranked = config.checkbox_to_value(kwargs.get(curProvider.get_id('_ranked'))) if hasattr(curProvider, 'engrelease'): curProvider.engrelease = config.checkbox_to_value(kwargs.get(curProvider.get_id('_engrelease'))) if hasattr(curProvider, 'onlyspasearch'): curProvider.onlyspasearch = config.checkbox_to_value(kwargs.get(curProvider.get_id('_onlyspasearch'))) if hasattr(curProvider, 'sorting'): curProvider.sorting = str(kwargs.get(curProvider.get_id('_sorting'), 'seeders')).strip() if hasattr(curProvider, 'freeleech'): curProvider.freeleech = config.checkbox_to_value(kwargs.get(curProvider.get_id('_freeleech'))) if hasattr(curProvider, 'search_mode'): curProvider.search_mode = str(kwargs.get(curProvider.get_id('_search_mode'), 'eponly')).strip() if hasattr(curProvider, 'search_fallback'): curProvider.search_fallback = config.checkbox_to_value(kwargs.get(curProvider.get_id('_search_fallback'))) if hasattr(curProvider, 'enable_daily'): curProvider.enable_daily = curProvider.can_daily and config.checkbox_to_value(kwargs.get(curProvider.get_id('_enable_daily'))) if hasattr(curProvider, 'enable_backlog'): curProvider.enable_backlog = curProvider.can_backlog and config.checkbox_to_value(kwargs.get(curProvider.get_id('_enable_backlog'))) if hasattr(curProvider, 'cat'): curProvider.cat = int(str(kwargs.get(curProvider.get_id('_cat'), 0)).strip()) if hasattr(curProvider, 'subtitle'): curProvider.subtitle = config.checkbox_to_value(kwargs.get(curProvider.get_id('_subtitle'))) if curProvider.enable_cookies: curProvider.cookies = str(kwargs.get(curProvider.get_id('_cookies'))).strip() sickbeard.NEWZNAB_DATA = '!!!'.join([x.configStr() for x in sickbeard.newznabProviderList]) sickbeard.PROVIDER_ORDER = enabled_provider_list + disabled_provider_list sickbeard.save_config() # Add a site_message if no providers are enabled for daily and/or backlog sickbeard.providers.check_enabled_providers() ui.notifications.message(_('Configuration Saved'), ek(os.path.join, sickbeard.CONFIG_FILE)) return self.redirect("/config/providers/")
def addShowByID(self, indexer_id, show_name, indexer='TVDB', which_series=None, indexer_lang=None, root_dir=None, default_status=None, quality_preset=None, any_qualities=None, best_qualities=None, flatten_folders=None, subtitles=None, full_show_path=None, other_shows=None, skip_show=None, provided_indexer=None, anime=None, scene=None, blacklist=None, whitelist=None, default_status_after=None, default_flatten_folders=None, configure_show_options=None): if indexer != 'TVDB': tvdb_id = helpers.getTVDBFromID(indexer_id, indexer.upper()) if not tvdb_id: logger.log(u'Unable to to find tvdb ID to add %s' % show_name) ui.notifications.error( 'Unable to add %s' % show_name, 'Could not add %s. We were unable to locate the tvdb id at this time.' % show_name ) return indexer_id = try_int(tvdb_id, None) if Show.find(sickbeard.showList, int(indexer_id)): return # Sanitize the paramater anyQualities and bestQualities. As these would normally be passed as lists if any_qualities: any_qualities = any_qualities.split(',') else: any_qualities = [] if best_qualities: best_qualities = best_qualities.split(',') else: best_qualities = [] # If configure_show_options is enabled let's use the provided settings configure_show_options = config.checkbox_to_value(configure_show_options) if configure_show_options: # prepare the inputs for passing along scene = config.checkbox_to_value(scene) anime = config.checkbox_to_value(anime) flatten_folders = config.checkbox_to_value(flatten_folders) subtitles = config.checkbox_to_value(subtitles) if whitelist: whitelist = short_group_names(whitelist) if blacklist: blacklist = short_group_names(blacklist) if not any_qualities: any_qualities = [] if not best_qualities or try_int(quality_preset, None): best_qualities = [] if not isinstance(any_qualities, list): any_qualities = [any_qualities] if not isinstance(best_qualities, list): best_qualities = [best_qualities] quality = Quality.combineQualities([int(q) for q in any_qualities], [int(q) for q in best_qualities]) location = root_dir else: default_status = sickbeard.STATUS_DEFAULT quality = sickbeard.QUALITY_DEFAULT flatten_folders = sickbeard.FLATTEN_FOLDERS_DEFAULT subtitles = sickbeard.SUBTITLES_DEFAULT anime = sickbeard.ANIME_DEFAULT scene = sickbeard.SCENE_DEFAULT default_status_after = sickbeard.STATUS_DEFAULT_AFTER if sickbeard.ROOT_DIRS: root_dirs = sickbeard.ROOT_DIRS.split('|') location = root_dirs[int(root_dirs[0]) + 1] else: location = None if not location: logger.log(u'There was an error creating the show, ' u'no root directory setting found', logger.WARNING) return 'No root directories setup, please go back and add one.' show_name = get_showname_from_indexer(1, indexer_id) show_dir = None # add the show sickbeard.showQueueScheduler.action.addShow(1, int(indexer_id), show_dir, int(default_status), quality, flatten_folders, indexer_lang, subtitles, anime, scene, None, blacklist, whitelist, int(default_status_after), root_dir=location) ui.notifications.message('Show added', 'Adding the specified show {0}'.format(show_name)) # done adding show return self.redirect('/home/')
def addNewShow(self, whichSeries=None, indexerLang=None, rootDir=None, defaultStatus=None, quality_preset=None, anyQualities=None, bestQualities=None, flatten_folders=None, subtitles=None, fullShowPath=None, other_shows=None, skipShow=None, providedIndexer=None, anime=None, scene=None, blacklist=None, whitelist=None, defaultStatusAfter=None): """ Receive tvdb id, dir, and other options and create a show from them. If extra show dirs are provided then it forwards back to newShow, if not it goes to /home. """ provided_indexer = providedIndexer allowed_qualities = anyQualities preferred_qualities = bestQualities indexer_lang = sickbeard.INDEXER_DEFAULT_LANGUAGE if not indexerLang else indexerLang # grab our list of other dirs if given if not other_shows: other_shows = [] elif not isinstance(other_shows, list): other_shows = [other_shows] def finishAddShow(): # if there are no extra shows then go home if not other_shows: return self.redirect('/home/') # peel off the next one next_show_dir = other_shows[0] rest_of_show_dirs = other_shows[1:] # go to add the next show return self.newShow(next_show_dir, rest_of_show_dirs) # if we're skipping then behave accordingly if skipShow: return finishAddShow() # sanity check on our inputs if (not rootDir and not fullShowPath) or not whichSeries: return 'Missing params, no Indexer ID or folder:{series!r} and {root!r}/{path!r}'.format( series=whichSeries, root=rootDir, path=fullShowPath) # figure out what show we're adding and where series_pieces = whichSeries.split('|') if (whichSeries and rootDir) or (whichSeries and fullShowPath and len(series_pieces) > 1): if len(series_pieces) < 6: logger.log(u'Unable to add show due to show selection. Not anough arguments: %s' % (repr(series_pieces)), logger.ERROR) ui.notifications.error('Unknown error. Unable to add show due to problem with show selection.') return self.redirect('/addShows/existingShows/') indexer = int(series_pieces[1]) indexer_id = int(series_pieces[3]) # Show name was sent in UTF-8 in the form show_name = series_pieces[4].decode('utf-8') else: # if no indexer was provided use the default indexer set in General settings if not provided_indexer: provided_indexer = sickbeard.INDEXER_DEFAULT indexer = int(provided_indexer) indexer_id = int(whichSeries) show_name = ek(os.path.basename, ek(os.path.normpath, fullShowPath)) # use the whole path if it's given, or else append the show name to the root dir to get the full show path if fullShowPath: show_dir = ek(os.path.normpath, fullShowPath) else: show_dir = ek(os.path.join, rootDir, sanitize_filename(show_name)) # blanket policy - if the dir exists you should have used 'add existing show' numbnuts if ek(os.path.isdir, show_dir) and not fullShowPath: ui.notifications.error('Unable to add show', 'Folder {path} exists already'.format(path=show_dir)) return self.redirect('/addShows/existingShows/') # don't create show dir if config says not to if sickbeard.ADD_SHOWS_WO_DIR: logger.log(u'Skipping initial creation of {path} due to config.ini setting'.format (path=show_dir)) else: dir_exists = helpers.makeDir(show_dir) if not dir_exists: logger.log(u'Unable to create the folder {path}, can\'t add the show'.format (path=show_dir), logger.ERROR) ui.notifications.error('Unable to add show', 'Unable to create the folder {path}, can\'t add the show'.format(path=show_dir)) # Don't redirect to default page because user wants to see the new show return self.redirect('/home/') else: helpers.chmodAsParent(show_dir) # prepare the inputs for passing along scene = config.checkbox_to_value(scene) anime = config.checkbox_to_value(anime) flatten_folders = config.checkbox_to_value(flatten_folders) subtitles = config.checkbox_to_value(subtitles) if whitelist: whitelist = short_group_names(whitelist) if blacklist: blacklist = short_group_names(blacklist) if not allowed_qualities: allowed_qualities = [] if not preferred_qualities or try_int(quality_preset, None): preferred_qualities = [] if not isinstance(allowed_qualities, list): allowed_qualities = [allowed_qualities] if not isinstance(preferred_qualities, list): preferred_qualities = [preferred_qualities] new_quality = Quality.combineQualities([int(q) for q in allowed_qualities], [int(q) for q in preferred_qualities]) # add the show sickbeard.showQueueScheduler.action.addShow(indexer, indexer_id, show_dir, int(defaultStatus), new_quality, flatten_folders, indexer_lang, subtitles, anime, scene, None, blacklist, whitelist, int(defaultStatusAfter)) ui.notifications.message('Show added', 'Adding the specified show into {path}'.format(path=show_dir)) return finishAddShow()
def saveSearch(self, use_nzbs=None, use_torrents=None, nzb_dir=None, sab_username=None, sab_password=None, sab_apikey=None, sab_category=None, sab_category_anime=None, sab_category_backlog=None, sab_category_anime_backlog=None, sab_host=None, nzbget_username=None, nzbget_password=None, nzbget_category=None, nzbget_category_backlog=None, nzbget_category_anime=None, nzbget_category_anime_backlog=None, nzbget_priority=None, nzbget_host=None, nzbget_use_https=None, backlog_days=None, backlog_frequency=None, dailysearch_frequency=None, nzb_method=None, torrent_method=None, usenet_retention=None, download_propers=None, check_propers_interval=None, allow_high_priority=None, sab_forced=None, randomize_providers=None, use_failed_downloads=None, delete_failed=None, backlog_missing_only=None, torrent_dir=None, torrent_username=None, torrent_password=None, torrent_host=None, torrent_label=None, torrent_label_anime=None, torrent_path=None, torrent_download_dir_deluge=None, torrent_complete_dir_deluge=None, torrent_verify_cert=None, torrent_seed_time=None, torrent_paused=None, torrent_high_bandwidth=None, torrent_rpcurl=None, torrent_auth_type=None, ignore_words=None, trackers_list=None, require_words=None, ignored_subs_list=None, syno_dsm_host=None, syno_dsm_user=None, syno_dsm_pass=None, syno_dsm_path=None, quality_allow_hevc=False, prefer_words=None): results = [] if not config.change_nzb_dir(nzb_dir): results += [ "Unable to create directory " + ek(os.path.normpath, nzb_dir) + ", dir not changed." ] if not config.change_torrent_dir(torrent_dir): results += [ "Unable to create directory " + ek(os.path.normpath, torrent_dir) + ", dir not changed." ] config.change_daily_search_frequency(dailysearch_frequency) config.change_backlog_frequency(backlog_frequency) sickbeard.BACKLOG_DAYS = try_int(backlog_days, 7) sickbeard.USE_NZBS = config.checkbox_to_value(use_nzbs) sickbeard.USE_TORRENTS = config.checkbox_to_value(use_torrents) sickbeard.NZB_METHOD = nzb_method sickbeard.TORRENT_METHOD = torrent_method sickbeard.USENET_RETENTION = try_int(usenet_retention, 500) sickbeard.IGNORE_WORDS = ignore_words if ignore_words else "" sickbeard.TRACKERS_LIST = trackers_list if trackers_list else "" sickbeard.REQUIRE_WORDS = require_words if require_words else "" sickbeard.PREFER_WORDS = prefer_words if prefer_words else "" sickbeard.IGNORED_SUBS_LIST = ignored_subs_list if ignored_subs_list else "" sickbeard.RANDOMIZE_PROVIDERS = config.checkbox_to_value( randomize_providers) config.change_download_propers(download_propers) sickbeard.CHECK_PROPERS_INTERVAL = check_propers_interval sickbeard.ALLOW_HIGH_PRIORITY = config.checkbox_to_value( allow_high_priority) sickbeard.QUALITY_ALLOW_HEVC = config.checkbox_to_value( quality_allow_hevc) sickbeard.USE_FAILED_DOWNLOADS = config.checkbox_to_value( use_failed_downloads) sickbeard.DELETE_FAILED = config.checkbox_to_value(delete_failed) sickbeard.BACKLOG_MISSING_ONLY = config.checkbox_to_value( backlog_missing_only) sickbeard.SAB_USERNAME = sab_username sickbeard.SAB_PASSWORD = filters.unhide(sickbeard.SAB_PASSWORD, sab_password) sickbeard.SAB_APIKEY = filters.unhide(sickbeard.SAB_APIKEY, sab_apikey.strip()) sickbeard.SAB_CATEGORY = sab_category sickbeard.SAB_CATEGORY_BACKLOG = sab_category_backlog sickbeard.SAB_CATEGORY_ANIME = sab_category_anime sickbeard.SAB_CATEGORY_ANIME_BACKLOG = sab_category_anime_backlog sickbeard.SAB_HOST = config.clean_url(sab_host) sickbeard.SAB_FORCED = config.checkbox_to_value(sab_forced) sickbeard.NZBGET_USERNAME = nzbget_username sickbeard.NZBGET_PASSWORD = filters.unhide(sickbeard.NZBGET_PASSWORD, nzbget_password) sickbeard.NZBGET_CATEGORY = nzbget_category sickbeard.NZBGET_CATEGORY_BACKLOG = nzbget_category_backlog sickbeard.NZBGET_CATEGORY_ANIME = nzbget_category_anime sickbeard.NZBGET_CATEGORY_ANIME_BACKLOG = nzbget_category_anime_backlog sickbeard.NZBGET_HOST = config.clean_host(nzbget_host) sickbeard.NZBGET_USE_HTTPS = config.checkbox_to_value(nzbget_use_https) sickbeard.NZBGET_PRIORITY = try_int(nzbget_priority, 100) sickbeard.TORRENT_USERNAME = torrent_username sickbeard.TORRENT_PASSWORD = filters.unhide(sickbeard.TORRENT_PASSWORD, torrent_password) sickbeard.TORRENT_LABEL = torrent_label sickbeard.TORRENT_LABEL_ANIME = torrent_label_anime sickbeard.TORRENT_VERIFY_CERT = config.checkbox_to_value( torrent_verify_cert) sickbeard.TORRENT_PATH = torrent_path.rstrip('/\\') sickbeard.TORRENT_DELUGE_DOWNLOAD_DIR = torrent_download_dir_deluge.rstrip( '/\\') sickbeard.TORRENT_DELUGE_COMPLETE_DIR = torrent_complete_dir_deluge.rstrip( '/\\') sickbeard.TORRENT_SEED_TIME = torrent_seed_time sickbeard.TORRENT_PAUSED = config.checkbox_to_value(torrent_paused) sickbeard.TORRENT_HIGH_BANDWIDTH = config.checkbox_to_value( torrent_high_bandwidth) sickbeard.TORRENT_HOST = config.clean_url(torrent_host) sickbeard.TORRENT_RPCURL = torrent_rpcurl sickbeard.TORRENT_AUTH_TYPE = torrent_auth_type sickbeard.SYNOLOGY_DSM_HOST = config.clean_url(syno_dsm_host) sickbeard.SYNOLOGY_DSM_USERNAME = syno_dsm_user sickbeard.SYNOLOGY_DSM_PASSWORD = filters.unhide( sickbeard.SYNOLOGY_DSM_PASSWORD, syno_dsm_pass) sickbeard.SYNOLOGY_DSM_PATH = syno_dsm_path.rstrip('/\\') # This is a PITA, but lets merge the settings if they only set DSM up in one section to save them some time if sickbeard.TORRENT_METHOD == 'download_station': if not sickbeard.SYNOLOGY_DSM_HOST: sickbeard.SYNOLOGY_DSM_HOST = sickbeard.TORRENT_HOST if not sickbeard.SYNOLOGY_DSM_USERNAME: sickbeard.SYNOLOGY_DSM_USERNAME = sickbeard.TORRENT_USERNAME if not sickbeard.SYNOLOGY_DSM_PASSWORD: sickbeard.SYNOLOGY_DSM_PASSWORD = sickbeard.TORRENT_PASSWORD if not sickbeard.SYNOLOGY_DSM_PATH: sickbeard.SYNOLOGY_DSM_PATH = sickbeard.TORRENT_PATH if sickbeard.NZB_METHOD == 'download_station': if not sickbeard.TORRENT_HOST: sickbeard.TORRENT_HOST = sickbeard.SYNOLOGY_DSM_HOST if not sickbeard.TORRENT_USERNAME: sickbeard.TORRENT_USERNAME = sickbeard.SYNOLOGY_DSM_USERNAME if not sickbeard.TORRENT_PASSWORD: sickbeard.TORRENT_PASSWORD = sickbeard.SYNOLOGY_DSM_PASSWORD if not sickbeard.TORRENT_PATH: sickbeard.TORRENT_PATH = sickbeard.SYNOLOGY_DSM_PATH helpers.manage_torrents_url(reset=True) sickbeard.save_config() if len(results) > 0: for x in results: logger.log(x, logger.ERROR) ui.notifications.error(_('Error(s) Saving Configuration'), '<br>\n'.join(results)) else: ui.notifications.message(_('Configuration Saved'), ek(os.path.join, sickbeard.CONFIG_FILE)) return self.redirect("/config/search/")
def addExistingShows(self, shows_to_add, promptForSettings, **kwargs): """ Receives a dir list and add them. Adds the ones with given TVDB IDs first, then forwards along to the newShow page. """ # grab a list of other shows to add, if provided if not shows_to_add: shows_to_add = [] elif not isinstance(shows_to_add, list): shows_to_add = [shows_to_add] shows_to_add = [unquote_plus(xhtml_unescape(x)) for x in shows_to_add] indexer_id_given = [] dirs_only = [] # separate all the ones with Indexer IDs for cur_dir in shows_to_add: if '|' in cur_dir: split_vals = cur_dir.split('|') if len(split_vals) < 3: dirs_only.append(cur_dir) if '|' not in cur_dir: dirs_only.append(cur_dir) else: indexer, show_dir, indexer_id, show_name = self.split_extra_show( cur_dir) if not show_dir or not indexer_id or not show_name: continue indexer_id_given.append( (int(indexer), show_dir, int(indexer_id), show_name)) # if they want me to prompt for settings then I will just carry on to the newShow page if shows_to_add and config.checkbox_to_value(promptForSettings): return self.newShow(shows_to_add[0], shows_to_add[1:]) # if they don't want me to prompt for settings then I can just add all the nfo shows now num_added = 0 for cur_show in indexer_id_given: indexer, show_dir, indexer_id, show_name = cur_show if indexer is not None and indexer_id is not None: # add the show sickbeard.showQueueScheduler.action.add_show( indexer, indexer_id, show_dir, default_status=sickbeard.STATUS_DEFAULT, quality=sickbeard.QUALITY_DEFAULT, season_folders=sickbeard.SEASON_FOLDERS_DEFAULT, subtitles=sickbeard.SUBTITLES_DEFAULT, anime=sickbeard.ANIME_DEFAULT, scene=sickbeard.SCENE_DEFAULT, default_status_after=sickbeard.STATUS_DEFAULT_AFTER) num_added += 1 if num_added: ui.notifications.message( _("Shows Added"), _("Automatically added {num_shows} from their existing metadata files" ).format(num_shows=str(num_added))) # if we're done then go home if not dirs_only: return self.redirect('/home/') # for the remaining shows we need to prompt for each one, so forward this on to the newShow page return self.newShow(dirs_only[0], dirs_only[1:])
def addShowByID(self, indexer_id, show_name, indexer="TVDB", which_series=None, indexer_lang=None, root_dir=None, default_status=None, quality_preset=None, any_qualities=None, best_qualities=None, season_folders=None, subtitles=None, full_show_path=None, other_shows=None, skip_show=None, provided_indexer=None, anime=None, scene=None, blacklist=None, whitelist=None, default_status_after=None, default_season_folders=None, configure_show_options=None): if indexer != "TVDB": indexer_id = helpers.tvdbid_from_remote_id(indexer_id, indexer.upper()) if not indexer_id: logger.log( "Unable to to find tvdb ID to add {0}".format(show_name)) ui.notifications.error( "Unable to add {0}".format(show_name), "Could not add {0}. We were unable to locate the tvdb id at this time." .format(show_name)) return indexer_id = try_int(indexer_id) if indexer_id <= 0 or Show.find(sickbeard.showList, indexer_id): return # Sanitize the parameter anyQualities and bestQualities. As these would normally be passed as lists any_qualities = any_qualities.split(',') if any_qualities else [] best_qualities = best_qualities.split(',') if best_qualities else [] # If configure_show_options is enabled let's use the provided settings if config.checkbox_to_value(configure_show_options): # prepare the inputs for passing along scene = config.checkbox_to_value(scene) anime = config.checkbox_to_value(anime) season_folders = config.checkbox_to_value(season_folders) subtitles = config.checkbox_to_value(subtitles) if whitelist: whitelist = short_group_names(whitelist) if blacklist: blacklist = short_group_names(blacklist) if not any_qualities: any_qualities = [] if not best_qualities or try_int(quality_preset, None): best_qualities = [] if not isinstance(any_qualities, list): any_qualities = [any_qualities] if not isinstance(best_qualities, list): best_qualities = [best_qualities] quality = Quality.combineQualities( [int(q) for q in any_qualities], [int(q) for q in best_qualities]) location = root_dir else: default_status = sickbeard.STATUS_DEFAULT quality = sickbeard.QUALITY_DEFAULT season_folders = sickbeard.SEASON_FOLDERS_DEFAULT subtitles = sickbeard.SUBTITLES_DEFAULT anime = sickbeard.ANIME_DEFAULT scene = sickbeard.SCENE_DEFAULT default_status_after = sickbeard.STATUS_DEFAULT_AFTER if sickbeard.ROOT_DIRS: root_dirs = sickbeard.ROOT_DIRS.split('|') location = root_dirs[int(root_dirs[0]) + 1] else: location = None if not location: logger.log( "There was an error creating the show, no root directory setting found" ) return _("No root directories setup, please go back and add one.") show_name = sickchill.indexer[1].get_series_by_id( indexer_id, indexer_lang).seriesName show_dir = None if not show_name: ui.notifications.error(_('Unable to add show')) return self.redirect('/home/') # add the show sickbeard.showQueueScheduler.action.add_show( indexer=1, indexer_id=indexer_id, showDir=show_dir, default_status=default_status, quality=quality, season_folders=season_folders, lang=indexer_lang, subtitles=subtitles, subtitles_sr_metadata=None, anime=anime, scene=scene, paused=None, blacklist=blacklist, whitelist=whitelist, default_status_after=default_status_after, root_dir=location) ui.notifications.message( _('Show added'), _('Adding the specified show {show_name}').format( show_name=show_name)) # done adding show return self.redirect('/home/')
def saveGeneral( self, log_nr=5, log_size=1, web_port=None, notify_on_login=None, web_log=None, encryption_version=None, web_ipv6=None, trash_remove_show=None, trash_rotate_logs=None, update_frequency=None, skip_removed_files=None, indexerDefaultLang='en', ep_default_deleted_status=None, launch_browser=None, showupdate_hour=3, web_username=None, api_key=None, indexer_default=None, timezone_display=None, cpu_preset='NORMAL', web_password=None, version_notify=None, enable_https=None, https_cert=None, https_key=None, handle_reverse_proxy=None, sort_article=None, auto_update=None, notify_on_update=None, proxy_setting=None, proxy_indexers=None, anon_redirect=None, git_path=None, git_remote=None, calendar_unprotected=None, calendar_icons=None, debug=None, ssl_verify=None, no_restart=None, coming_eps_missed_range=None, fuzzy_dating=None, trim_zero=None, date_preset=None, date_preset_na=None, time_preset=None, indexer_timeout=None, download_url=None, rootDir=None, theme_name=None, default_page=None, fanart_background=None, fanart_background_opacity=None, sickchill_background=None, sickchill_background_path=None, custom_css=None, custom_css_path=None, git_reset=None, git_username=None, git_token=None, display_all_seasons=None, gui_language=None, ignore_broken_symlinks=None, ended_shows_update_interval=None): results = [] if gui_language != sickbeard.GUI_LANG: if gui_language: # Selected language gettext.translation('messages', sickbeard.LOCALE_DIR, languages=[gui_language], codeset='UTF-8').install(unicode=1, names=["ngettext"]) else: # System default language gettext.install('messages', sickbeard.LOCALE_DIR, unicode=1, codeset='UTF-8', names=["ngettext"]) sickbeard.GUI_LANG = gui_language # Misc sickbeard.DOWNLOAD_URL = download_url sickbeard.INDEXER_DEFAULT_LANGUAGE = indexerDefaultLang sickbeard.EP_DEFAULT_DELETED_STATUS = ep_default_deleted_status sickbeard.SKIP_REMOVED_FILES = config.checkbox_to_value(skip_removed_files) sickbeard.LAUNCH_BROWSER = config.checkbox_to_value(launch_browser) config.change_showupdate_hour(showupdate_hour) config.change_version_notify(version_notify) sickbeard.AUTO_UPDATE = config.checkbox_to_value(auto_update) sickbeard.NOTIFY_ON_UPDATE = config.checkbox_to_value(notify_on_update) sickbeard.LOG_NR = log_nr sickbeard.LOG_SIZE = float(log_size) sickbeard.WEB_LOG = config.checkbox_to_value(web_log) sickbeard.TRASH_REMOVE_SHOW = config.checkbox_to_value(trash_remove_show) sickbeard.TRASH_ROTATE_LOGS = config.checkbox_to_value(trash_rotate_logs) sickbeard.IGNORE_BROKEN_SYMLINKS = config.checkbox_to_value(ignore_broken_symlinks) config.change_update_frequency(update_frequency) sickbeard.LAUNCH_BROWSER = config.checkbox_to_value(launch_browser) sickbeard.SORT_ARTICLE = config.checkbox_to_value(sort_article) sickbeard.CPU_PRESET = cpu_preset sickbeard.ANON_REDIRECT = anon_redirect sickbeard.PROXY_SETTING = proxy_setting sickbeard.PROXY_INDEXERS = config.checkbox_to_value(proxy_indexers) sickbeard.GIT_USERNAME = git_username tmp_git_token = filters.unhide(sickbeard.GIT_TOKEN, git_token) if sickbeard.GIT_TOKEN != tmp_git_token: # Re-Initializes sickbeard.gh, so a restart isn't necessary sickbeard.GIT_TOKEN = tmp_git_token setup_github() # sickbeard.GIT_RESET = config.checkbox_to_value(git_reset) # Force GIT_RESET sickbeard.GIT_RESET = 1 sickbeard.GIT_PATH = git_path sickbeard.GIT_REMOTE = git_remote sickbeard.CALENDAR_UNPROTECTED = config.checkbox_to_value(calendar_unprotected) sickbeard.CALENDAR_ICONS = config.checkbox_to_value(calendar_icons) sickbeard.NO_RESTART = config.checkbox_to_value(no_restart) sickbeard.DEBUG = config.checkbox_to_value(debug) logger.set_level() sickbeard.SSL_VERIFY = config.checkbox_to_value(ssl_verify) sickbeard.COMING_EPS_MISSED_RANGE = config.min_max(coming_eps_missed_range, 7, 0, 42810) sickbeard.DISPLAY_ALL_SEASONS = config.checkbox_to_value(display_all_seasons) sickbeard.NOTIFY_ON_LOGIN = config.checkbox_to_value(notify_on_login) sickbeard.WEB_PORT = try_int(web_port) sickbeard.WEB_IPV6 = config.checkbox_to_value(web_ipv6) sickbeard.ENCRYPTION_VERSION = config.checkbox_to_value(encryption_version, value_on=2, value_off=0) sickbeard.WEB_USERNAME = web_username sickbeard.WEB_PASSWORD = filters.unhide(sickbeard.WEB_PASSWORD, web_password) sickbeard.FUZZY_DATING = config.checkbox_to_value(fuzzy_dating) sickbeard.TRIM_ZERO = config.checkbox_to_value(trim_zero) if date_preset: sickbeard.DATE_PRESET = date_preset if indexer_default: sickbeard.INDEXER_DEFAULT = try_int(indexer_default) if indexer_timeout: sickbeard.INDEXER_TIMEOUT = try_int(indexer_timeout) if time_preset: sickbeard.TIME_PRESET_W_SECONDS = time_preset sickbeard.TIME_PRESET = time_preset.replace(":%S", "") sickbeard.TIMEZONE_DISPLAY = timezone_display sickbeard.API_KEY = api_key sickbeard.ENABLE_HTTPS = config.checkbox_to_value(enable_https) if not config.change_https_cert(https_cert): results += [ _("Unable to create directory {directory}, https cert directory not changed.").format(directory=ek(os.path.normpath, https_cert))] if not config.change_https_key(https_key): results += [ _("Unable to create directory {directory}, https key directory not changed.").format(directory=ek(os.path.normpath, https_key))] sickbeard.HANDLE_REVERSE_PROXY = config.checkbox_to_value(handle_reverse_proxy) sickbeard.THEME_NAME = theme_name sickbeard.SICKCHILL_BACKGROUND = config.checkbox_to_value(sickchill_background) config.change_sickchill_background(sickchill_background_path) sickbeard.FANART_BACKGROUND = config.checkbox_to_value(fanart_background) sickbeard.FANART_BACKGROUND_OPACITY = fanart_background_opacity sickbeard.CUSTOM_CSS = config.checkbox_to_value(custom_css) config.change_custom_css(custom_css_path) sickbeard.ENDED_SHOWS_UPDATE_INTERVAL = int(ended_shows_update_interval) sickbeard.DEFAULT_PAGE = default_page sickbeard.save_config() if len(results) > 0: for x in results: logger.log(x, logger.ERROR) ui.notifications.error(_('Error(s) Saving Configuration'), '<br>\n'.join(results)) else: ui.notifications.message(_('Configuration Saved'), ek(os.path.join, sickbeard.CONFIG_FILE)) return self.redirect("/config/general/")
def addExistingShows(self, shows_to_add=None, promptForSettings=None): """ Receives a dir list and add them. Adds the ones with given TVDB IDs first, then forwards along to the newShow page. """ prompt_for_settings = promptForSettings # grab a list of other shows to add, if provided if not shows_to_add: shows_to_add = [] elif not isinstance(shows_to_add, list): shows_to_add = [shows_to_add] shows_to_add = [unquote_plus(x) for x in shows_to_add] prompt_for_settings = config.checkbox_to_value(prompt_for_settings) indexer_id_given = [] dirs_only = [] # separate all the ones with Indexer IDs for cur_dir in shows_to_add: if '|' in cur_dir: split_vals = cur_dir.split('|') if len(split_vals) < 3: dirs_only.append(cur_dir) if '|' not in cur_dir: dirs_only.append(cur_dir) else: indexer, show_dir, indexer_id, show_name = self.split_extra_show(cur_dir) if not show_dir or not indexer_id or not show_name: continue indexer_id_given.append((int(indexer), show_dir, int(indexer_id), show_name)) # if they want me to prompt for settings then I will just carry on to the newShow page if prompt_for_settings and shows_to_add: return self.newShow(shows_to_add[0], shows_to_add[1:]) # if they don't want me to prompt for settings then I can just add all the nfo shows now num_added = 0 for cur_show in indexer_id_given: indexer, show_dir, indexer_id, show_name = cur_show if indexer is not None and indexer_id is not None: # add the show sickbeard.showQueueScheduler.action.addShow( indexer, indexer_id, show_dir, default_status=sickbeard.STATUS_DEFAULT, quality=sickbeard.QUALITY_DEFAULT, flatten_folders=sickbeard.FLATTEN_FOLDERS_DEFAULT, subtitles=sickbeard.SUBTITLES_DEFAULT, anime=sickbeard.ANIME_DEFAULT, scene=sickbeard.SCENE_DEFAULT, default_status_after=sickbeard.STATUS_DEFAULT_AFTER ) num_added += 1 if num_added: ui.notifications.message('Shows Added', 'Automatically added {quantity} from their existing metadata files'.format(quantity=num_added)) # if we're done then go home if not dirs_only: return self.redirect('/home/') # for the remaining shows we need to prompt for each one, so forward this on to the newShow page return self.newShow(dirs_only[0], dirs_only[1:])
def savePostProcessing(self, kodi_data=None, kodi_12plus_data=None, mediabrowser_data=None, sony_ps3_data=None, wdtv_data=None, tivo_data=None, mede8er_data=None, keep_processed_dir=None, process_method=None, del_rar_contents=None, process_automatically=None, no_delete=None, rename_episodes=None, airdate_episodes=None, file_timestamp_timezone=None, unpack=None, move_associated_files=None, sync_files=None, postpone_if_sync_files=None, postpone_if_no_subs=None, allowed_extensions=None, tv_download_dir=None, create_missing_show_dirs=None, add_shows_wo_dir=None, extra_scripts=None, nfo_rename=None, naming_pattern=None, naming_multi_ep=None, naming_custom_abd=None, naming_anime=None, naming_abd_pattern=None, naming_strip_year=None, naming_custom_sports=None, naming_sports_pattern=None, naming_custom_anime=None, naming_anime_pattern=None, naming_anime_multi_ep=None, autopostprocessor_frequency=None): results = [] if not config.change_TV_DOWNLOAD_DIR(tv_download_dir): results += ['Unable to create directory {dir}, ' 'dir not changed.'.format(dir=ek(os.path.normpath, tv_download_dir))] config.change_AUTOPOSTPROCESSOR_FREQUENCY(autopostprocessor_frequency) config.change_PROCESS_AUTOMATICALLY(process_automatically) if unpack: if self.isRarSupported() != 'not supported': sickbeard.UNPACK = config.checkbox_to_value(unpack) else: sickbeard.UNPACK = 0 results.append('Unpacking Not Supported, disabling unpack setting') else: sickbeard.UNPACK = config.checkbox_to_value(unpack) sickbeard.NO_DELETE = config.checkbox_to_value(no_delete) sickbeard.KEEP_PROCESSED_DIR = config.checkbox_to_value(keep_processed_dir) sickbeard.CREATE_MISSING_SHOW_DIRS = config.checkbox_to_value(create_missing_show_dirs) sickbeard.ADD_SHOWS_WO_DIR = config.checkbox_to_value(add_shows_wo_dir) sickbeard.PROCESS_METHOD = process_method sickbeard.DELRARCONTENTS = config.checkbox_to_value(del_rar_contents) sickbeard.EXTRA_SCRIPTS = [x.strip() for x in extra_scripts.split('|') if x.strip()] sickbeard.RENAME_EPISODES = config.checkbox_to_value(rename_episodes) sickbeard.AIRDATE_EPISODES = config.checkbox_to_value(airdate_episodes) sickbeard.FILE_TIMESTAMP_TIMEZONE = file_timestamp_timezone sickbeard.MOVE_ASSOCIATED_FILES = config.checkbox_to_value(move_associated_files) sickbeard.SYNC_FILES = sync_files sickbeard.POSTPONE_IF_SYNC_FILES = config.checkbox_to_value(postpone_if_sync_files) sickbeard.POSTPONE_IF_NO_SUBS = config.checkbox_to_value(postpone_if_no_subs) # If 'postpone if no subs' is enabled, we must have SRT in allowed extensions list if sickbeard.POSTPONE_IF_NO_SUBS: allowed_extensions += ',srt' # # Auto PP must be disabled because FINDSUBTITLE thread that calls manual PP (like nzbtomedia) # sickbeard.PROCESS_AUTOMATICALLY = 0 sickbeard.ALLOWED_EXTENSIONS = ','.join({x.strip() for x in allowed_extensions.split(',') if x.strip()}) sickbeard.NAMING_CUSTOM_ABD = config.checkbox_to_value(naming_custom_abd) sickbeard.NAMING_CUSTOM_SPORTS = config.checkbox_to_value(naming_custom_sports) sickbeard.NAMING_CUSTOM_ANIME = config.checkbox_to_value(naming_custom_anime) sickbeard.NAMING_STRIP_YEAR = config.checkbox_to_value(naming_strip_year) sickbeard.NFO_RENAME = config.checkbox_to_value(nfo_rename) sickbeard.METADATA_KODI = kodi_data sickbeard.METADATA_KODI_12PLUS = kodi_12plus_data sickbeard.METADATA_MEDIABROWSER = mediabrowser_data sickbeard.METADATA_PS3 = sony_ps3_data sickbeard.METADATA_WDTV = wdtv_data sickbeard.METADATA_TIVO = tivo_data sickbeard.METADATA_MEDE8ER = mede8er_data sickbeard.metadata_provider_dict['KODI'].set_config(sickbeard.METADATA_KODI) sickbeard.metadata_provider_dict['KODI 12+'].set_config(sickbeard.METADATA_KODI_12PLUS) sickbeard.metadata_provider_dict['MediaBrowser'].set_config(sickbeard.METADATA_MEDIABROWSER) sickbeard.metadata_provider_dict['Sony PS3'].set_config(sickbeard.METADATA_PS3) sickbeard.metadata_provider_dict['WDTV'].set_config(sickbeard.METADATA_WDTV) sickbeard.metadata_provider_dict['TIVO'].set_config(sickbeard.METADATA_TIVO) sickbeard.metadata_provider_dict['Mede8er'].set_config(sickbeard.METADATA_MEDE8ER) if self.isNamingValid(naming_pattern, naming_multi_ep, anime_type=naming_anime) != 'invalid': sickbeard.NAMING_PATTERN = naming_pattern sickbeard.NAMING_MULTI_EP = int(naming_multi_ep) sickbeard.NAMING_ANIME = int(naming_anime) sickbeard.NAMING_FORCE_FOLDERS = naming.check_force_season_folders() else: if int(naming_anime) in [1, 2]: results.append('You tried saving an invalid anime naming config, not saving your naming settings') else: results.append('You tried saving an invalid naming config, not saving your naming settings') if self.isNamingValid(naming_anime_pattern, naming_anime_multi_ep, anime_type=naming_anime) != 'invalid': sickbeard.NAMING_ANIME_PATTERN = naming_anime_pattern sickbeard.NAMING_ANIME_MULTI_EP = int(naming_anime_multi_ep) sickbeard.NAMING_ANIME = int(naming_anime) sickbeard.NAMING_FORCE_FOLDERS = naming.check_force_season_folders() else: if int(naming_anime) in [1, 2]: results.append('You tried saving an invalid anime naming config, not saving your naming settings') else: results.append('You tried saving an invalid naming config, not saving your naming settings') if self.isNamingValid(naming_abd_pattern, None, abd=True) != 'invalid': sickbeard.NAMING_ABD_PATTERN = naming_abd_pattern else: results.append( 'You tried saving an invalid air-by-date naming config, not saving your air-by-date settings') if self.isNamingValid(naming_sports_pattern, None, sports=True) != 'invalid': sickbeard.NAMING_SPORTS_PATTERN = naming_sports_pattern else: results.append( 'You tried saving an invalid sports naming config, not saving your sports settings') sickbeard.save_config() if results: for x in results: logger.log(x, logger.WARNING) ui.notifications.error('Error(s) Saving Configuration', '<br>\n'.join(results)) else: ui.notifications.message('Configuration Saved', ek(os.path.join, sickbeard.CONFIG_FILE)) return self.redirect('/config/postProcessing/')
def saveGeneral(self, log_dir=None, log_nr=5, log_size=1, web_port=None, notify_on_login=None, web_log=None, encryption_version=None, web_ipv6=None, trash_remove_show=None, trash_rotate_logs=None, update_frequency=None, skip_removed_files=None, indexerDefaultLang='en', ep_default_deleted_status=None, launch_browser=None, showupdate_hour=3, web_username=None, api_key=None, indexer_default=None, timezone_display=None, cpu_preset='NORMAL', web_password=None, version_notify=None, enable_https=None, https_cert=None, https_key=None, handle_reverse_proxy=None, sort_article=None, auto_update=None, notify_on_update=None, proxy_setting=None, proxy_indexers=None, anon_redirect=None, git_path=None, git_remote=None, calendar_unprotected=None, calendar_icons=None, debug=None, ssl_verify=None, no_restart=None, coming_eps_missed_range=None, fuzzy_dating=None, trim_zero=None, date_preset=None, date_preset_na=None, time_preset=None, indexer_timeout=None, download_url=None, rootDir=None, theme_name=None, default_page=None, git_reset=None, git_username=None, git_password=None, display_all_seasons=None, subliminal_log=None, privacy_level='normal'): results = [] # Misc sickbeard.DOWNLOAD_URL = download_url sickbeard.INDEXER_DEFAULT_LANGUAGE = indexerDefaultLang sickbeard.EP_DEFAULT_DELETED_STATUS = ep_default_deleted_status sickbeard.SKIP_REMOVED_FILES = config.checkbox_to_value(skip_removed_files) sickbeard.LAUNCH_BROWSER = config.checkbox_to_value(launch_browser) config.change_SHOWUPDATE_HOUR(showupdate_hour) config.change_VERSION_NOTIFY(config.checkbox_to_value(version_notify)) sickbeard.AUTO_UPDATE = config.checkbox_to_value(auto_update) sickbeard.NOTIFY_ON_UPDATE = config.checkbox_to_value(notify_on_update) # sickbeard.LOG_DIR is set in config.change_LOG_DIR() sickbeard.LOG_NR = log_nr sickbeard.LOG_SIZE = float(log_size) sickbeard.TRASH_REMOVE_SHOW = config.checkbox_to_value(trash_remove_show) sickbeard.TRASH_ROTATE_LOGS = config.checkbox_to_value(trash_rotate_logs) config.change_UPDATE_FREQUENCY(update_frequency) sickbeard.LAUNCH_BROWSER = config.checkbox_to_value(launch_browser) sickbeard.SORT_ARTICLE = config.checkbox_to_value(sort_article) sickbeard.CPU_PRESET = cpu_preset sickbeard.ANON_REDIRECT = anon_redirect sickbeard.PROXY_SETTING = proxy_setting sickbeard.PROXY_INDEXERS = config.checkbox_to_value(proxy_indexers) sickbeard.GIT_USERNAME = git_username sickbeard.GIT_PASSWORD = git_password # sickbeard.GIT_RESET = config.checkbox_to_value(git_reset) # Force GIT_RESET sickbeard.GIT_RESET = 1 sickbeard.GIT_PATH = git_path sickbeard.GIT_REMOTE = git_remote sickbeard.CALENDAR_UNPROTECTED = config.checkbox_to_value(calendar_unprotected) sickbeard.CALENDAR_ICONS = config.checkbox_to_value(calendar_icons) sickbeard.NO_RESTART = config.checkbox_to_value(no_restart) sickbeard.DEBUG = config.checkbox_to_value(debug) sickbeard.SSL_VERIFY = config.checkbox_to_value(ssl_verify) # sickbeard.LOG_DIR is set in config.change_LOG_DIR() sickbeard.COMING_EPS_MISSED_RANGE = try_int(coming_eps_missed_range, 7) sickbeard.DISPLAY_ALL_SEASONS = config.checkbox_to_value(display_all_seasons) sickbeard.NOTIFY_ON_LOGIN = config.checkbox_to_value(notify_on_login) sickbeard.WEB_PORT = try_int(web_port) sickbeard.WEB_IPV6 = config.checkbox_to_value(web_ipv6) # sickbeard.WEB_LOG is set in config.change_LOG_DIR() if config.checkbox_to_value(encryption_version) == 1: sickbeard.ENCRYPTION_VERSION = 2 else: sickbeard.ENCRYPTION_VERSION = 0 sickbeard.WEB_USERNAME = web_username sickbeard.WEB_PASSWORD = web_password # Reconfigure the logger only if subliminal setting changed if sickbeard.SUBLIMINAL_LOG != config.checkbox_to_value(subliminal_log): logger.reconfigure_levels() sickbeard.SUBLIMINAL_LOG = config.checkbox_to_value(subliminal_log) sickbeard.PRIVACY_LEVEL = privacy_level.lower() sickbeard.FUZZY_DATING = config.checkbox_to_value(fuzzy_dating) sickbeard.TRIM_ZERO = config.checkbox_to_value(trim_zero) if date_preset: sickbeard.DATE_PRESET = date_preset if indexer_default: sickbeard.INDEXER_DEFAULT = try_int(indexer_default) if indexer_timeout: sickbeard.INDEXER_TIMEOUT = try_int(indexer_timeout) if time_preset: sickbeard.TIME_PRESET_W_SECONDS = time_preset sickbeard.TIME_PRESET = sickbeard.TIME_PRESET_W_SECONDS.replace(u':%S', u'') sickbeard.TIMEZONE_DISPLAY = timezone_display if not config.change_LOG_DIR(log_dir, web_log): results += ['Unable to create directory {dir}, ' 'log directory not changed.'.format(dir=ek(os.path.normpath, log_dir))] sickbeard.API_KEY = api_key sickbeard.ENABLE_HTTPS = config.checkbox_to_value(enable_https) if not config.change_HTTPS_CERT(https_cert): results += ['Unable to create directory {dir}, ' 'https cert directory not changed.'.format(dir=ek(os.path.normpath, https_cert))] if not config.change_HTTPS_KEY(https_key): results += ['Unable to create directory {dir}, ' 'https key directory not changed.'.format(dir=ek(os.path.normpath, https_key))] sickbeard.HANDLE_REVERSE_PROXY = config.checkbox_to_value(handle_reverse_proxy) sickbeard.THEME_NAME = theme_name sickbeard.DEFAULT_PAGE = default_page sickbeard.save_config() if results: for x in results: logger.log(x, logger.ERROR) ui.notifications.error('Error(s) Saving Configuration', '<br>\n'.join(results)) else: ui.notifications.message('Configuration Saved', ek(os.path.join, sickbeard.CONFIG_FILE)) return self.redirect('/config/general/')
def saveProviders(self, newznab_string='', torrentrss_string='', provider_order=None, **kwargs): """ Save Provider related settings """ results = [] provider_str_list = provider_order.split() provider_list = [] newznab_provider_dict = dict( zip([x.get_id() for x in sickbeard.newznabProviderList], sickbeard.newznabProviderList)) finished_names = [] # add all the newznab info we got into our list if newznab_string: for curNewznabProviderStr in newznab_string.split('!!!'): if not curNewznabProviderStr: continue cur_name, cur_url, cur_key, cur_cat = curNewznabProviderStr.split('|') cur_url = config.clean_url(cur_url) new_provider = newznab.NewznabProvider(cur_name, cur_url, key=cur_key, catIDs=cur_cat) cur_id = new_provider.get_id() # if it already exists then update it if cur_id in newznab_provider_dict: newznab_provider_dict[cur_id].name = cur_name newznab_provider_dict[cur_id].url = cur_url newznab_provider_dict[cur_id].key = cur_key newznab_provider_dict[cur_id].catIDs = cur_cat # a 0 in the key spot indicates that no key is needed if cur_key == '0': newznab_provider_dict[cur_id].needs_auth = False else: newznab_provider_dict[cur_id].needs_auth = True try: newznab_provider_dict[cur_id].search_mode = str(kwargs['{id}_search_mode'.format(id=cur_id)]).strip() except (AttributeError, KeyError): pass # these exceptions are actually catching unselected checkboxes try: newznab_provider_dict[cur_id].search_fallback = config.checkbox_to_value( kwargs['{id}_search_fallback'.format(id=cur_id)]) except (AttributeError, KeyError): newznab_provider_dict[cur_id].search_fallback = 0 # these exceptions are actually catching unselected checkboxes try: newznab_provider_dict[cur_id].enable_daily = config.checkbox_to_value( kwargs['{id}_enable_daily'.format(id=cur_id)]) except (AttributeError, KeyError): newznab_provider_dict[cur_id].enable_daily = 0 # these exceptions are actually catching unselected checkboxes try: newznab_provider_dict[cur_id].enable_manualsearch = config.checkbox_to_value( kwargs['{id}_enable_manualsearch'.format(id=cur_id)]) except (AttributeError, KeyError): newznab_provider_dict[cur_id].enable_manualsearch = 0 # these exceptions are actually catching unselected checkboxes try: newznab_provider_dict[cur_id].enable_backlog = config.checkbox_to_value( kwargs['{id}_enable_backlog'.format(id=cur_id)]) except (AttributeError, KeyError): newznab_provider_dict[cur_id].enable_backlog = 0 # these exceptions are actually catching unselected checkboxes else: sickbeard.newznabProviderList.append(new_provider) finished_names.append(cur_id) # delete anything that is missing for cur_provider in sickbeard.newznabProviderList: if cur_provider.get_id() not in finished_names: sickbeard.newznabProviderList.remove(cur_provider) torrent_rss_provider_dict = dict( zip([x.get_id() for x in sickbeard.torrentRssProviderList], sickbeard.torrentRssProviderList)) finished_names = [] if torrentrss_string: for curTorrentRssProviderStr in torrentrss_string.split('!!!'): if not curTorrentRssProviderStr: continue cur_name, cur_url, cur_cookies, cur_title_tag = curTorrentRssProviderStr.split('|') cur_url = config.clean_url(cur_url) new_provider = rsstorrent.TorrentRssProvider(cur_name, cur_url, cur_cookies, cur_title_tag) cur_id = new_provider.get_id() # if it already exists then update it if cur_id in torrent_rss_provider_dict: torrent_rss_provider_dict[cur_id].name = cur_name torrent_rss_provider_dict[cur_id].url = cur_url torrent_rss_provider_dict[cur_id].cookies = cur_cookies torrent_rss_provider_dict[cur_id].curTitleTAG = cur_title_tag else: sickbeard.torrentRssProviderList.append(new_provider) finished_names.append(cur_id) # delete anything that is missing for cur_provider in sickbeard.torrentRssProviderList: if cur_provider.get_id() not in finished_names: sickbeard.torrentRssProviderList.remove(cur_provider) disabled_list = [] # do the enable/disable for cur_providerStr in provider_str_list: cur_provider, cur_enabled = cur_providerStr.split(':') cur_enabled = try_int(cur_enabled) cur_prov_obj = [x for x in sickbeard.providers.sortedProviderList() if x.get_id() == cur_provider and hasattr(x, 'enabled')] if cur_prov_obj: cur_prov_obj[0].enabled = bool(cur_enabled) if cur_enabled: provider_list.append(cur_provider) else: disabled_list.append(cur_provider) if cur_provider in newznab_provider_dict: newznab_provider_dict[cur_provider].enabled = bool(cur_enabled) elif cur_provider in torrent_rss_provider_dict: torrent_rss_provider_dict[cur_provider].enabled = bool(cur_enabled) provider_list.extend(disabled_list) # dynamically load provider settings for curTorrentProvider in [prov for prov in sickbeard.providers.sortedProviderList() if prov.provider_type == GenericProvider.TORRENT]: if hasattr(curTorrentProvider, 'custom_url'): try: curTorrentProvider.custom_url = str(kwargs['{id}_custom_url'.format(id=curTorrentProvider.get_id())]).strip() except (AttributeError, KeyError): curTorrentProvider.custom_url = None # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'minseed'): try: curTorrentProvider.minseed = int(str(kwargs['{id}_minseed'.format(id=curTorrentProvider.get_id())]).strip()) except (AttributeError, KeyError): curTorrentProvider.minseed = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'minleech'): try: curTorrentProvider.minleech = int(str(kwargs['{id}_minleech'.format(id=curTorrentProvider.get_id())]).strip()) except (AttributeError, KeyError): curTorrentProvider.minleech = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'ratio'): try: ratio = float(str(kwargs['{id}_ratio'.format(id=curTorrentProvider.get_id())]).strip()) curTorrentProvider.ratio = (ratio, -1)[ratio < 0] except (AttributeError, KeyError, ValueError): curTorrentProvider.ratio = None # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'digest'): try: curTorrentProvider.digest = str(kwargs['{id}_digest'.format(id=curTorrentProvider.get_id())]).strip() except (AttributeError, KeyError): curTorrentProvider.digest = None # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'hash'): try: curTorrentProvider.hash = str(kwargs['{id}_hash'.format(id=curTorrentProvider.get_id())]).strip() except (AttributeError, KeyError): curTorrentProvider.hash = None # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'api_key'): try: curTorrentProvider.api_key = str(kwargs['{id}_api_key'.format(id=curTorrentProvider.get_id())]).strip() except (AttributeError, KeyError): curTorrentProvider.api_key = None # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'username'): try: curTorrentProvider.username = str(kwargs['{id}_username'.format(id=curTorrentProvider.get_id())]).strip() except (AttributeError, KeyError): curTorrentProvider.username = None # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'password'): try: curTorrentProvider.password = str(kwargs['{id}_password'.format(id=curTorrentProvider.get_id())]).strip() except (AttributeError, KeyError): curTorrentProvider.password = None # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'passkey'): try: curTorrentProvider.passkey = str(kwargs['{id}_passkey'.format(id=curTorrentProvider.get_id())]).strip() except (AttributeError, KeyError): curTorrentProvider.passkey = None # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'pin'): try: curTorrentProvider.pin = str(kwargs['{id}_pin'.format(id=curTorrentProvider.get_id())]).strip() except (AttributeError, KeyError): curTorrentProvider.pin = None # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'confirmed'): try: curTorrentProvider.confirmed = config.checkbox_to_value( kwargs['{id}_confirmed'.format(id=curTorrentProvider.get_id())]) except (AttributeError, KeyError): curTorrentProvider.confirmed = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'ranked'): try: curTorrentProvider.ranked = config.checkbox_to_value( kwargs['{id}_ranked'.format(id=curTorrentProvider.get_id())]) except (AttributeError, KeyError): curTorrentProvider.ranked = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'engrelease'): try: curTorrentProvider.engrelease = config.checkbox_to_value( kwargs['{id}_engrelease'.format(id=curTorrentProvider.get_id())]) except (AttributeError, KeyError): curTorrentProvider.engrelease = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'onlyspasearch'): try: curTorrentProvider.onlyspasearch = config.checkbox_to_value( kwargs['{id}_onlyspasearch'.format(id=curTorrentProvider.get_id())]) except (AttributeError, KeyError): curTorrentProvider.onlyspasearch = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'sorting'): try: curTorrentProvider.sorting = str(kwargs['{id}_sorting'.format(id=curTorrentProvider.get_id())]).strip() except (AttributeError, KeyError): curTorrentProvider.sorting = 'seeders' # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'freeleech'): try: curTorrentProvider.freeleech = config.checkbox_to_value( kwargs['{id}_freeleech'.format(id=curTorrentProvider.get_id())]) except (AttributeError, KeyError): curTorrentProvider.freeleech = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'search_mode'): try: curTorrentProvider.search_mode = str(kwargs['{id}_search_mode'.format(id=curTorrentProvider.get_id())]).strip() except (AttributeError, KeyError): curTorrentProvider.search_mode = 'eponly' # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'search_fallback'): try: curTorrentProvider.search_fallback = config.checkbox_to_value( kwargs['{id}_search_fallback'.format(id=curTorrentProvider.get_id())]) except (AttributeError, KeyError): curTorrentProvider.search_fallback = 0 # these exceptions are catching unselected checkboxes if hasattr(curTorrentProvider, 'enable_daily'): try: curTorrentProvider.enable_daily = config.checkbox_to_value( kwargs['{id}_enable_daily'.format(id=curTorrentProvider.get_id())]) except (AttributeError, KeyError): curTorrentProvider.enable_daily = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'enable_manualsearch'): try: curTorrentProvider.enable_manualsearch = config.checkbox_to_value( kwargs['{id}_enable_manualsearch'.format(id=curTorrentProvider.get_id())]) except (AttributeError, KeyError): curTorrentProvider.enable_manualsearch = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'enable_backlog'): try: curTorrentProvider.enable_backlog = config.checkbox_to_value( kwargs['{id}_enable_backlog'.format(id=curTorrentProvider.get_id())]) except (AttributeError, KeyError): curTorrentProvider.enable_backlog = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'cat'): try: curTorrentProvider.cat = int(str(kwargs['{id}_cat'.format(id=curTorrentProvider.get_id())]).strip()) except (AttributeError, KeyError): curTorrentProvider.cat = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curTorrentProvider, 'subtitle'): try: curTorrentProvider.subtitle = config.checkbox_to_value( kwargs['{id}_subtitle'.format(id=curTorrentProvider.get_id())]) except (AttributeError, KeyError): curTorrentProvider.subtitle = 0 # these exceptions are actually catching unselected checkboxes for curNzbProvider in [prov for prov in sickbeard.providers.sortedProviderList() if prov.provider_type == GenericProvider.NZB]: if hasattr(curNzbProvider, 'api_key'): try: curNzbProvider.api_key = str(kwargs['{id}_api_key'.format(id=curNzbProvider.get_id())]).strip() except (AttributeError, KeyError): curNzbProvider.api_key = None # these exceptions are actually catching unselected checkboxes if hasattr(curNzbProvider, 'username'): try: curNzbProvider.username = str(kwargs['{id}_username'.format(id=curNzbProvider.get_id())]).strip() except (AttributeError, KeyError): curNzbProvider.username = None # these exceptions are actually catching unselected checkboxes if hasattr(curNzbProvider, 'search_mode'): try: curNzbProvider.search_mode = str(kwargs['{id}_search_mode'.format(id=curNzbProvider.get_id())]).strip() except (AttributeError, KeyError): curNzbProvider.search_mode = 'eponly' # these exceptions are actually catching unselected checkboxes if hasattr(curNzbProvider, 'search_fallback'): try: curNzbProvider.search_fallback = config.checkbox_to_value( kwargs['{id}_search_fallback'.format(id=curNzbProvider.get_id())]) except (AttributeError, KeyError): curNzbProvider.search_fallback = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curNzbProvider, 'enable_daily'): try: curNzbProvider.enable_daily = config.checkbox_to_value( kwargs['{id}_enable_daily'.format(id=curNzbProvider.get_id())]) except (AttributeError, KeyError): curNzbProvider.enable_daily = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curNzbProvider, 'enable_manualsearch'): try: curNzbProvider.enable_manualsearch = config.checkbox_to_value( kwargs['{id}_enable_manualsearch'.format(id=curNzbProvider.get_id())]) except (AttributeError, KeyError): curNzbProvider.enable_manualsearch = 0 # these exceptions are actually catching unselected checkboxes if hasattr(curNzbProvider, 'enable_backlog'): try: curNzbProvider.enable_backlog = config.checkbox_to_value( kwargs['{id}_enable_backlog'.format(id=curNzbProvider.get_id())]) except (AttributeError, KeyError): curNzbProvider.enable_backlog = 0 # these exceptions are actually catching unselected checkboxes sickbeard.NEWZNAB_DATA = '!!!'.join([x.configStr() for x in sickbeard.newznabProviderList]) sickbeard.PROVIDER_ORDER = provider_list sickbeard.save_config() if results: for x in results: logger.log(x, logger.ERROR) ui.notifications.error('Error(s) Saving Configuration', '<br>\n'.join(results)) else: ui.notifications.message('Configuration Saved', ek(os.path.join, sickbeard.CONFIG_FILE)) return self.redirect('/config/providers/')
def addNewShow(self, whichSeries=None, indexerLang=None, rootDir=None, defaultStatus=None, quality_preset=None, anyQualities=None, bestQualities=None, season_folders=None, subtitles=None, subtitles_sr_metadata=None, fullShowPath=None, other_shows=None, skipShow=None, providedIndexer=None, anime=None, scene=None, blacklist=None, whitelist=None, defaultStatusAfter=None): """ Receive tvdb id, dir, and other options and create a show from them. If extra show dirs are provided then it forwards back to newShow, if not it goes to /home. """ if not indexerLang: indexerLang = sickbeard.INDEXER_DEFAULT_LANGUAGE # grab our list of other dirs if given if not other_shows: other_shows = [] elif not isinstance(other_shows, list): other_shows = [other_shows] def finishAddShow(): # if there are no extra shows then go home if not other_shows: return self.redirect('/home/') # peel off the next one next_show_dir = other_shows[0] rest_of_show_dirs = other_shows[1:] # go to add the next show return self.newShow(next_show_dir, rest_of_show_dirs) # if we're skipping then behave accordingly if skipShow: return finishAddShow() # sanity check on our inputs if (not rootDir and not fullShowPath) or not whichSeries: return _( "Missing params, no Indexer ID or folder: {show_to_add} and {root_dir}/{show_path}" ).format(show_to_add=whichSeries, root_dir=rootDir, show_path=fullShowPath) # figure out what show we're adding and where series_pieces = whichSeries.split('|') if (whichSeries and rootDir) or (whichSeries and fullShowPath and len(series_pieces) > 1): if len(series_pieces) < 6: logger.log( "Unable to add show due to show selection. Not enough arguments: {0}" .format((repr(series_pieces))), logger.ERROR) ui.notifications.error( _("Unknown error. Unable to add show due to problem with show selection." )) return self.redirect('/addShows/existingShows/') indexer = int(series_pieces[1]) indexer_id = int(series_pieces[3]) # Show name was sent in UTF-8 in the form show_name = xhtml_unescape(series_pieces[4]).decode('utf-8') else: # if no indexer was provided use the default indexer set in General settings if not providedIndexer: providedIndexer = sickbeard.INDEXER_DEFAULT indexer = int(providedIndexer) indexer_id = int(whichSeries) show_name = ek(os.path.basename, ek(os.path.normpath, xhtml_unescape(fullShowPath))) # use the whole path if it's given, or else append the show name to the root dir to get the full show path if fullShowPath: show_dir = ek(os.path.normpath, xhtml_unescape(fullShowPath)) extra_check_dir = show_dir else: folder_name = show_name s = sickchill.indexer.series_by_id(indexerid=indexer_id, indexer=indexer, language=indexerLang) if sickbeard.ADD_SHOWS_WITH_YEAR and s.firstAired: try: year = '({0})'.format( dateutil.parser.parse(s.firstAired).year) if year not in folder_name: folder_name = '{0} {1}'.format(s.seriesName, year) except (TypeError, ValueError): logger.log( _('Could not append the show year folder for the show: {0}' ).format(folder_name)) show_dir = ek(os.path.join, rootDir, sanitize_filename(xhtml_unescape(folder_name))) extra_check_dir = ek(os.path.join, rootDir, sanitize_filename(xhtml_unescape(show_name))) # blanket policy - if the dir exists you should have used "add existing show" numbnuts if ek(os.path.isdir, show_dir) or ek( os.path.isdir, extra_check_dir) and not fullShowPath: ui.notifications.error( _("Unable to add show"), _("Folder {show_dir} exists already").format( show_dir=show_dir)) return self.redirect('/addShows/existingShows/') # don't create show dir if config says not to if sickbeard.ADD_SHOWS_WO_DIR: logger.log("Skipping initial creation of " + show_dir + " due to config.ini setting") else: dir_exists = helpers.makeDir(show_dir) if not dir_exists: logger.log( "Unable to create the folder " + show_dir + ", can't add the show", logger.ERROR) ui.notifications.error( _("Unable to add show"), _("Unable to create the folder {show_dir}, can't add the show" ).format(show_dir=show_dir)) # Don't redirect to default page because user wants to see the new show return self.redirect("/home/") else: helpers.chmodAsParent(show_dir) # prepare the inputs for passing along scene = config.checkbox_to_value(scene) anime = config.checkbox_to_value(anime) season_folders = config.checkbox_to_value(season_folders) subtitles = config.checkbox_to_value(subtitles) subtitles_sr_metadata = config.checkbox_to_value(subtitles_sr_metadata) if whitelist: whitelist = short_group_names(whitelist) if blacklist: blacklist = short_group_names(blacklist) if not anyQualities: anyQualities = [] if not bestQualities or try_int(quality_preset, None): bestQualities = [] if not isinstance(anyQualities, list): anyQualities = [anyQualities] if not isinstance(bestQualities, list): bestQualities = [bestQualities] newQuality = Quality.combineQualities([int(q) for q in anyQualities], [int(q) for q in bestQualities]) # add the show sickbeard.showQueueScheduler.action.add_show( indexer, indexer_id, showDir=show_dir, default_status=int(defaultStatus), quality=newQuality, season_folders=season_folders, lang=indexerLang, subtitles=subtitles, subtitles_sr_metadata=subtitles_sr_metadata, anime=anime, scene=scene, paused=None, blacklist=blacklist, whitelist=whitelist, default_status_after=int(defaultStatusAfter), root_dir=rootDir) ui.notifications.message( _('Show added'), _('Adding the specified show into {show_dir}').format( show_dir=show_dir)) return finishAddShow()
def saveNotifications(self, use_kodi=None, kodi_always_on=None, kodi_notify_onsnatch=None, kodi_notify_ondownload=None, kodi_notify_onsubtitledownload=None, kodi_update_onlyfirst=None, kodi_update_library=None, kodi_update_full=None, kodi_host=None, kodi_username=None, kodi_password=None, use_plex_server=None, plex_notify_onsnatch=None, plex_notify_ondownload=None, plex_notify_onsubtitledownload=None, plex_update_library=None, plex_server_host=None, plex_server_token=None, plex_client_host=None, plex_server_username=None, plex_server_password=None, use_plex_client=None, plex_client_username=None, plex_client_password=None, plex_server_https=None, use_emby=None, emby_host=None, emby_apikey=None, use_growl=None, growl_notify_onsnatch=None, growl_notify_ondownload=None, growl_notify_onsubtitledownload=None, growl_host=None, growl_password=None, use_freemobile=None, freemobile_notify_onsnatch=None, freemobile_notify_ondownload=None, freemobile_notify_onsubtitledownload=None, freemobile_id=None, freemobile_apikey=None, use_telegram=None, telegram_notify_onsnatch=None, telegram_notify_ondownload=None, telegram_notify_onsubtitledownload=None, telegram_id=None, telegram_apikey=None, use_join=None, join_notify_onsnatch=None, join_notify_ondownload=None, join_notify_onsubtitledownload=None, join_id=None, join_apikey=None, use_prowl=None, prowl_notify_onsnatch=None, prowl_notify_ondownload=None, prowl_notify_onsubtitledownload=None, prowl_api=None, prowl_priority=0, prowl_show_list=None, prowl_show=None, prowl_message_title=None, use_twitter=None, twitter_notify_onsnatch=None, twitter_notify_ondownload=None, twitter_notify_onsubtitledownload=None, twitter_usedm=None, twitter_dmto=None, use_twilio=None, twilio_notify_onsnatch=None, twilio_notify_ondownload=None, twilio_notify_onsubtitledownload=None, twilio_phone_sid=None, twilio_account_sid=None, twilio_auth_token=None, twilio_to_number=None, use_boxcar2=None, boxcar2_notify_onsnatch=None, boxcar2_notify_ondownload=None, boxcar2_notify_onsubtitledownload=None, boxcar2_accesstoken=None, use_pushover=None, pushover_notify_onsnatch=None, pushover_notify_ondownload=None, pushover_notify_onsubtitledownload=None, pushover_userkey=None, pushover_apikey=None, pushover_device=None, pushover_sound=None, pushover_priority=0, use_libnotify=None, libnotify_notify_onsnatch=None, libnotify_notify_ondownload=None, libnotify_notify_onsubtitledownload=None, use_nmj=None, nmj_host=None, nmj_database=None, nmj_mount=None, use_synoindex=None, use_nmjv2=None, nmjv2_host=None, nmjv2_dbloc=None, nmjv2_database=None, use_trakt=None, trakt_username=None, trakt_pin=None, trakt_remove_watchlist=None, trakt_sync_watchlist=None, trakt_remove_show_from_sickchill=None, trakt_method_add=None, trakt_start_paused=None, trakt_use_recommended=None, trakt_sync=None, trakt_sync_remove=None, trakt_default_indexer=None, trakt_remove_serieslist=None, trakt_timeout=None, trakt_blacklist_name=None, use_synologynotifier=None, synologynotifier_notify_onsnatch=None, synologynotifier_notify_ondownload=None, synologynotifier_notify_onsubtitledownload=None, use_pytivo=None, pytivo_notify_onsnatch=None, pytivo_notify_ondownload=None, pytivo_notify_onsubtitledownload=None, pytivo_update_library=None, pytivo_host=None, pytivo_share_name=None, pytivo_tivo_name=None, use_pushalot=None, pushalot_notify_onsnatch=None, pushalot_notify_ondownload=None, pushalot_notify_onsubtitledownload=None, pushalot_authorizationtoken=None, use_pushbullet=None, pushbullet_notify_onsnatch=None, pushbullet_notify_ondownload=None, pushbullet_notify_onsubtitledownload=None, pushbullet_api=None, pushbullet_device=None, pushbullet_device_list=None, pushbullet_channel_list=None, pushbullet_channel=None, use_email=None, email_notify_onsnatch=None, email_notify_ondownload=None, email_notify_onpostprocess=None, email_notify_onsubtitledownload=None, email_host=None, email_port=25, email_from=None, email_tls=None, email_user=None, email_password=None, email_list=None, email_subject=None, email_show_list=None, email_show=None, use_slack=False, slack_notify_snatch=None, slack_notify_download=None, slack_notify_subtitledownload=None, slack_webhook=None, slack_icon_emoji=None, use_matrix=False, matrix_notify_snatch=None, matrix_notify_download=None, matrix_notify_subtitledownload=None, matrix_api_token=None, matrix_server=None, matrix_room=None, use_discord=False, discord_notify_snatch=None, discord_notify_download=None, discord_webhook=None, discord_name=None, discord_avatar_url=None, discord_tts=False): results = [] sickbeard.USE_KODI = config.checkbox_to_value(use_kodi) sickbeard.KODI_ALWAYS_ON = config.checkbox_to_value(kodi_always_on) sickbeard.KODI_NOTIFY_ONSNATCH = config.checkbox_to_value( kodi_notify_onsnatch) sickbeard.KODI_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( kodi_notify_ondownload) sickbeard.KODI_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( kodi_notify_onsubtitledownload) sickbeard.KODI_UPDATE_LIBRARY = config.checkbox_to_value( kodi_update_library) sickbeard.KODI_UPDATE_FULL = config.checkbox_to_value(kodi_update_full) sickbeard.KODI_UPDATE_ONLYFIRST = config.checkbox_to_value( kodi_update_onlyfirst) sickbeard.KODI_HOST = config.clean_hosts(kodi_host) sickbeard.KODI_USERNAME = kodi_username sickbeard.KODI_PASSWORD = filters.unhide(sickbeard.KODI_PASSWORD, kodi_password) sickbeard.USE_PLEX_SERVER = config.checkbox_to_value(use_plex_server) sickbeard.PLEX_NOTIFY_ONSNATCH = config.checkbox_to_value( plex_notify_onsnatch) sickbeard.PLEX_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( plex_notify_ondownload) sickbeard.PLEX_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( plex_notify_onsubtitledownload) sickbeard.PLEX_UPDATE_LIBRARY = config.checkbox_to_value( plex_update_library) sickbeard.PLEX_CLIENT_HOST = config.clean_hosts(plex_client_host) sickbeard.PLEX_SERVER_HOST = config.clean_hosts(plex_server_host) sickbeard.PLEX_SERVER_TOKEN = config.clean_host(plex_server_token) sickbeard.PLEX_SERVER_USERNAME = plex_server_username sickbeard.PLEX_SERVER_PASSWORD = filters.unhide( sickbeard.PLEX_SERVER_PASSWORD, plex_server_password) sickbeard.USE_PLEX_CLIENT = config.checkbox_to_value(use_plex_client) sickbeard.PLEX_CLIENT_USERNAME = plex_client_username sickbeard.PLEX_CLIENT_PASSWORD = filters.unhide( sickbeard.PLEX_CLIENT_PASSWORD, plex_client_password) sickbeard.PLEX_SERVER_HTTPS = config.checkbox_to_value( plex_server_https) sickbeard.USE_EMBY = config.checkbox_to_value(use_emby) sickbeard.EMBY_HOST = config.clean_url(emby_host) sickbeard.EMBY_APIKEY = filters.unhide(sickbeard.EMBY_APIKEY, emby_apikey) sickbeard.USE_GROWL = config.checkbox_to_value(use_growl) sickbeard.GROWL_NOTIFY_ONSNATCH = config.checkbox_to_value( growl_notify_onsnatch) sickbeard.GROWL_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( growl_notify_ondownload) sickbeard.GROWL_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( growl_notify_onsubtitledownload) sickbeard.GROWL_HOST = config.clean_host(growl_host, default_port=23053) sickbeard.GROWL_PASSWORD = filters.unhide(sickbeard.GROWL_PASSWORD, growl_password) sickbeard.USE_FREEMOBILE = config.checkbox_to_value(use_freemobile) sickbeard.FREEMOBILE_NOTIFY_ONSNATCH = config.checkbox_to_value( freemobile_notify_onsnatch) sickbeard.FREEMOBILE_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( freemobile_notify_ondownload) sickbeard.FREEMOBILE_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( freemobile_notify_onsubtitledownload) sickbeard.FREEMOBILE_ID = freemobile_id sickbeard.FREEMOBILE_APIKEY = filters.unhide( sickbeard.FREEMOBILE_APIKEY, freemobile_apikey) sickbeard.USE_TELEGRAM = config.checkbox_to_value(use_telegram) sickbeard.TELEGRAM_NOTIFY_ONSNATCH = config.checkbox_to_value( telegram_notify_onsnatch) sickbeard.TELEGRAM_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( telegram_notify_ondownload) sickbeard.TELEGRAM_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( telegram_notify_onsubtitledownload) sickbeard.TELEGRAM_ID = telegram_id sickbeard.TELEGRAM_APIKEY = filters.unhide(sickbeard.TELEGRAM_APIKEY, telegram_apikey) sickbeard.USE_JOIN = config.checkbox_to_value(use_join) sickbeard.JOIN_NOTIFY_ONSNATCH = config.checkbox_to_value( join_notify_onsnatch) sickbeard.JOIN_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( join_notify_ondownload) sickbeard.JOIN_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( join_notify_onsubtitledownload) sickbeard.JOIN_ID = join_id sickbeard.JOIN_APIKEY = filters.unhide(sickbeard.JOIN_APIKEY, join_apikey) sickbeard.USE_PROWL = config.checkbox_to_value(use_prowl) sickbeard.PROWL_NOTIFY_ONSNATCH = config.checkbox_to_value( prowl_notify_onsnatch) sickbeard.PROWL_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( prowl_notify_ondownload) sickbeard.PROWL_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( prowl_notify_onsubtitledownload) sickbeard.PROWL_API = prowl_api sickbeard.PROWL_PRIORITY = prowl_priority sickbeard.PROWL_MESSAGE_TITLE = prowl_message_title sickbeard.USE_TWITTER = config.checkbox_to_value(use_twitter) sickbeard.TWITTER_NOTIFY_ONSNATCH = config.checkbox_to_value( twitter_notify_onsnatch) sickbeard.TWITTER_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( twitter_notify_ondownload) sickbeard.TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( twitter_notify_onsubtitledownload) sickbeard.TWITTER_USEDM = config.checkbox_to_value(twitter_usedm) sickbeard.TWITTER_DMTO = twitter_dmto sickbeard.USE_TWILIO = config.checkbox_to_value(use_twilio) sickbeard.TWILIO_NOTIFY_ONSNATCH = config.checkbox_to_value( twilio_notify_onsnatch) sickbeard.TWILIO_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( twilio_notify_ondownload) sickbeard.TWILIO_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( twilio_notify_onsubtitledownload) sickbeard.TWILIO_PHONE_SID = twilio_phone_sid sickbeard.TWILIO_ACCOUNT_SID = twilio_account_sid sickbeard.TWILIO_AUTH_TOKEN = twilio_auth_token sickbeard.TWILIO_TO_NUMBER = twilio_to_number sickbeard.USE_SLACK = config.checkbox_to_value(use_slack) sickbeard.SLACK_NOTIFY_SNATCH = config.checkbox_to_value( slack_notify_snatch) sickbeard.SLACK_NOTIFY_DOWNLOAD = config.checkbox_to_value( slack_notify_download) sickbeard.SLACK_NOTIFY_SUBTITLEDOWNLOAD = config.checkbox_to_value( slack_notify_subtitledownload) sickbeard.SLACK_WEBHOOK = slack_webhook sickbeard.SLACK_ICON_EMOJI = slack_icon_emoji sickbeard.USE_MATRIX = config.checkbox_to_value(use_matrix) sickbeard.MATRIX_NOTIFY_SNATCH = config.checkbox_to_value( matrix_notify_snatch) sickbeard.MATRIX_NOTIFY_DOWNLOAD = config.checkbox_to_value( matrix_notify_download) sickbeard.MATRIX_NOTIFY_SUBTITLEDOWNLOAD = config.checkbox_to_value( matrix_notify_subtitledownload) sickbeard.MATRIX_API_TOKEN = matrix_api_token sickbeard.MATRIX_SERVER = matrix_server sickbeard.MATRIX_ROOM = matrix_room sickbeard.USE_DISCORD = config.checkbox_to_value(use_discord) sickbeard.DISCORD_NOTIFY_SNATCH = config.checkbox_to_value( discord_notify_snatch) sickbeard.DISCORD_NOTIFY_DOWNLOAD = config.checkbox_to_value( discord_notify_download) sickbeard.DISCORD_WEBHOOK = discord_webhook sickbeard.DISCORD_NAME = discord_name sickbeard.DISCORD_AVATAR_URL = discord_avatar_url sickbeard.DISCORD_TTS = discord_tts sickbeard.USE_BOXCAR2 = config.checkbox_to_value(use_boxcar2) sickbeard.BOXCAR2_NOTIFY_ONSNATCH = config.checkbox_to_value( boxcar2_notify_onsnatch) sickbeard.BOXCAR2_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( boxcar2_notify_ondownload) sickbeard.BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( boxcar2_notify_onsubtitledownload) sickbeard.BOXCAR2_ACCESSTOKEN = boxcar2_accesstoken sickbeard.USE_PUSHOVER = config.checkbox_to_value(use_pushover) sickbeard.PUSHOVER_NOTIFY_ONSNATCH = config.checkbox_to_value( pushover_notify_onsnatch) sickbeard.PUSHOVER_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( pushover_notify_ondownload) sickbeard.PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( pushover_notify_onsubtitledownload) sickbeard.PUSHOVER_USERKEY = pushover_userkey sickbeard.PUSHOVER_APIKEY = filters.unhide(sickbeard.PUSHOVER_APIKEY, pushover_apikey) sickbeard.PUSHOVER_DEVICE = pushover_device sickbeard.PUSHOVER_SOUND = pushover_sound sickbeard.PUSHOVER_PRIORITY = pushover_priority sickbeard.USE_LIBNOTIFY = config.checkbox_to_value(use_libnotify) sickbeard.LIBNOTIFY_NOTIFY_ONSNATCH = config.checkbox_to_value( libnotify_notify_onsnatch) sickbeard.LIBNOTIFY_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( libnotify_notify_ondownload) sickbeard.LIBNOTIFY_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( libnotify_notify_onsubtitledownload) sickbeard.USE_NMJ = config.checkbox_to_value(use_nmj) sickbeard.NMJ_HOST = config.clean_host(nmj_host) sickbeard.NMJ_DATABASE = nmj_database sickbeard.NMJ_MOUNT = nmj_mount sickbeard.USE_NMJv2 = config.checkbox_to_value(use_nmjv2) sickbeard.NMJv2_HOST = config.clean_host(nmjv2_host) sickbeard.NMJv2_DATABASE = nmjv2_database sickbeard.NMJv2_DBLOC = nmjv2_dbloc sickbeard.USE_SYNOINDEX = config.checkbox_to_value(use_synoindex) sickbeard.USE_SYNOLOGYNOTIFIER = config.checkbox_to_value( use_synologynotifier) sickbeard.SYNOLOGYNOTIFIER_NOTIFY_ONSNATCH = config.checkbox_to_value( synologynotifier_notify_onsnatch) sickbeard.SYNOLOGYNOTIFIER_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( synologynotifier_notify_ondownload) sickbeard.SYNOLOGYNOTIFIER_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( synologynotifier_notify_onsubtitledownload) config.change_use_trakt(use_trakt) sickbeard.TRAKT_USERNAME = trakt_username sickbeard.TRAKT_REMOVE_WATCHLIST = config.checkbox_to_value( trakt_remove_watchlist) sickbeard.TRAKT_REMOVE_SERIESLIST = config.checkbox_to_value( trakt_remove_serieslist) sickbeard.TRAKT_REMOVE_SHOW_FROM_SICKCHILL = config.checkbox_to_value( trakt_remove_show_from_sickchill) sickbeard.TRAKT_SYNC_WATCHLIST = config.checkbox_to_value( trakt_sync_watchlist) sickbeard.TRAKT_METHOD_ADD = int(trakt_method_add) sickbeard.TRAKT_START_PAUSED = config.checkbox_to_value( trakt_start_paused) sickbeard.TRAKT_USE_RECOMMENDED = config.checkbox_to_value( trakt_use_recommended) sickbeard.TRAKT_SYNC = config.checkbox_to_value(trakt_sync) sickbeard.TRAKT_SYNC_REMOVE = config.checkbox_to_value( trakt_sync_remove) sickbeard.TRAKT_DEFAULT_INDEXER = int(trakt_default_indexer) sickbeard.TRAKT_TIMEOUT = int(trakt_timeout) sickbeard.TRAKT_BLACKLIST_NAME = trakt_blacklist_name sickbeard.USE_EMAIL = config.checkbox_to_value(use_email) sickbeard.EMAIL_NOTIFY_ONSNATCH = config.checkbox_to_value( email_notify_onsnatch) sickbeard.EMAIL_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( email_notify_ondownload) sickbeard.EMAIL_NOTIFY_ONPOSTPROCESS = config.checkbox_to_value( email_notify_onpostprocess) sickbeard.EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( email_notify_onsubtitledownload) sickbeard.EMAIL_HOST = config.clean_host(email_host) sickbeard.EMAIL_PORT = try_int(email_port, 25) sickbeard.EMAIL_FROM = email_from sickbeard.EMAIL_TLS = config.checkbox_to_value(email_tls) sickbeard.EMAIL_USER = email_user sickbeard.EMAIL_PASSWORD = filters.unhide(sickbeard.EMAIL_PASSWORD, email_password) sickbeard.EMAIL_LIST = email_list sickbeard.EMAIL_SUBJECT = email_subject sickbeard.USE_PYTIVO = config.checkbox_to_value(use_pytivo) sickbeard.PYTIVO_NOTIFY_ONSNATCH = config.checkbox_to_value( pytivo_notify_onsnatch) sickbeard.PYTIVO_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( pytivo_notify_ondownload) sickbeard.PYTIVO_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( pytivo_notify_onsubtitledownload) sickbeard.PYTIVO_UPDATE_LIBRARY = config.checkbox_to_value( pytivo_update_library) sickbeard.PYTIVO_HOST = config.clean_host(pytivo_host) sickbeard.PYTIVO_SHARE_NAME = pytivo_share_name sickbeard.PYTIVO_TIVO_NAME = pytivo_tivo_name sickbeard.USE_PUSHALOT = config.checkbox_to_value(use_pushalot) sickbeard.PUSHALOT_NOTIFY_ONSNATCH = config.checkbox_to_value( pushalot_notify_onsnatch) sickbeard.PUSHALOT_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( pushalot_notify_ondownload) sickbeard.PUSHALOT_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( pushalot_notify_onsubtitledownload) sickbeard.PUSHALOT_AUTHORIZATIONTOKEN = pushalot_authorizationtoken sickbeard.USE_PUSHBULLET = config.checkbox_to_value(use_pushbullet) sickbeard.PUSHBULLET_NOTIFY_ONSNATCH = config.checkbox_to_value( pushbullet_notify_onsnatch) sickbeard.PUSHBULLET_NOTIFY_ONDOWNLOAD = config.checkbox_to_value( pushbullet_notify_ondownload) sickbeard.PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( pushbullet_notify_onsubtitledownload) sickbeard.PUSHBULLET_API = pushbullet_api sickbeard.PUSHBULLET_DEVICE = pushbullet_device_list sickbeard.PUSHBULLET_CHANNEL = pushbullet_channel_list or "" sickbeard.save_config() if len(results) > 0: for x in results: logger.log(x, logger.ERROR) ui.notifications.error(_('Error(s) Saving Configuration'), '<br>\n'.join(results)) else: ui.notifications.message(_('Configuration Saved'), ek(os.path.join, sickbeard.CONFIG_FILE)) return self.redirect("/config/notifications/")
def saveSubtitles(self, use_subtitles=None, subtitles_include_specials=None, subtitles_plugins=None, subtitles_languages=None, subtitles_dir=None, subtitles_perfect_match=None, service_order=None, subtitles_history=None, subtitles_finder_frequency=None, subtitles_multi=None, embedded_subtitles_all=None, subtitles_extra_scripts=None, subtitles_hearing_impaired=None, addic7ed_user=None, addic7ed_pass=None, itasa_user=None, itasa_pass=None, legendastv_user=None, legendastv_pass=None, opensubtitles_user=None, opensubtitles_pass=None, subscenter_user=None, subscenter_pass=None, subtitles_download_in_pp=None, subtitles_keep_only_wanted=None): config.change_subtitle_finder_frequency(subtitles_finder_frequency) config.change_use_subtitles(use_subtitles) sickbeard.SUBTITLES_INCLUDE_SPECIALS = config.checkbox_to_value( subtitles_include_specials) sickbeard.SUBTITLES_LANGUAGES = [ code.strip() for code in subtitles_languages.split(',') if code.strip() in subtitle_module.subtitle_code_filter() ] if subtitles_languages else [] sickbeard.SUBTITLES_DIR = subtitles_dir sickbeard.SUBTITLES_PERFECT_MATCH = config.checkbox_to_value( subtitles_perfect_match) sickbeard.SUBTITLES_HISTORY = config.checkbox_to_value( subtitles_history) sickbeard.EMBEDDED_SUBTITLES_ALL = config.checkbox_to_value( embedded_subtitles_all) sickbeard.SUBTITLES_HEARING_IMPAIRED = config.checkbox_to_value( subtitles_hearing_impaired) sickbeard.SUBTITLES_MULTI = config.checkbox_to_value(subtitles_multi) sickbeard.SUBTITLES_DOWNLOAD_IN_PP = config.checkbox_to_value( subtitles_download_in_pp) sickbeard.SUBTITLES_KEEP_ONLY_WANTED = config.checkbox_to_value( subtitles_keep_only_wanted) sickbeard.SUBTITLES_EXTRA_SCRIPTS = [ x.strip() for x in subtitles_extra_scripts.split('|') if x.strip() ] # Subtitles services services_str_list = service_order.split() subtitles_services_list = [] subtitles_services_enabled = [] for curServiceStr in services_str_list: curService, curEnabled = curServiceStr.split(':') subtitles_services_list.append(curService) subtitles_services_enabled.append(int(curEnabled)) sickbeard.SUBTITLES_SERVICES_LIST = subtitles_services_list sickbeard.SUBTITLES_SERVICES_ENABLED = subtitles_services_enabled sickbeard.ADDIC7ED_USER = addic7ed_user or '' sickbeard.ADDIC7ED_PASS = filters.unhide(sickbeard.ADDIC7ED_PASS, addic7ed_pass) or '' sickbeard.ITASA_USER = itasa_user or '' sickbeard.ITASA_PASS = filters.unhide(sickbeard.ITASA_PASS, itasa_pass) or '' sickbeard.LEGENDASTV_USER = legendastv_user or '' sickbeard.LEGENDASTV_PASS = filters.unhide(sickbeard.LEGENDASTV_PASS, legendastv_pass) or '' sickbeard.OPENSUBTITLES_USER = opensubtitles_user or '' sickbeard.OPENSUBTITLES_PASS = filters.unhide( sickbeard.OPENSUBTITLES_PASS, opensubtitles_pass) or '' sickbeard.SUBSCENTER_USER = subscenter_user or '' sickbeard.SUBSCENTER_PASS = filters.unhide(sickbeard.SUBSCENTER_PASS, subscenter_pass) or '' sickbeard.save_config() # Reset provider pool so next time we use the newest settings subtitle_module.SubtitleProviderPool().reset() ui.notifications.message(_('Configuration Saved'), ek(os.path.join, sickbeard.CONFIG_FILE)) return self.redirect("/config/subtitles/")
def savePostProcessing(self, kodi_data=None, kodi_12plus_data=None, mediabrowser_data=None, sony_ps3_data=None, wdtv_data=None, tivo_data=None, mede8er_data=None, keep_processed_dir=None, process_method=None, processor_follow_symlinks=None, del_rar_contents=None, process_automatically=None, no_delete=None, rename_episodes=None, airdate_episodes=None, file_timestamp_timezone=None, unpack=None, unpack_dir=None, unrar_tool=None, alt_unrar_tool=None, move_associated_files=None, delete_non_associated_files=None, sync_files=None, postpone_if_sync_files=None, allowed_extensions=None, tv_download_dir=None, create_missing_show_dirs=None, add_shows_wo_dir=None, extra_scripts=None, nfo_rename=None, naming_pattern=None, naming_multi_ep=None, naming_custom_abd=None, naming_anime=None, naming_abd_pattern=None, naming_strip_year=None, naming_custom_sports=None, naming_sports_pattern=None, naming_custom_anime=None, naming_anime_pattern=None, naming_anime_multi_ep=None, autopostprocessor_frequency=None, use_icacls=None): results = [] if not config.change_tv_download_dir(tv_download_dir): results += [ "Unable to create directory " + ek(os.path.normpath, tv_download_dir) + ", dir not changed." ] config.change_postprocessor_frequency(autopostprocessor_frequency) config.change_process_automatically(process_automatically) sickbeard.USE_ICACLS = config.checkbox_to_value(use_icacls) config.change_unrar_tool(unrar_tool, alt_unrar_tool) unpack = try_int(unpack) if unpack == sickbeard.UNPACK_PROCESS_CONTENTS: sickbeard.UNPACK = int(self.isRarSupported() != 'not supported') if sickbeard.UNPACK != sickbeard.UNPACK_PROCESS_CONTENTS: results.append( _("Unpacking Not Supported, disabling unpack setting")) elif unpack in sickbeard.unpackStrings: sickbeard.UNPACK = unpack if not config.change_unpack_dir(unpack_dir): results += [ "Unable to change unpack directory to " + ek(os.path.normpath, unpack_dir) + ", check the logs." ] sickbeard.NO_DELETE = config.checkbox_to_value(no_delete) sickbeard.KEEP_PROCESSED_DIR = config.checkbox_to_value( keep_processed_dir) sickbeard.CREATE_MISSING_SHOW_DIRS = config.checkbox_to_value( create_missing_show_dirs) sickbeard.ADD_SHOWS_WO_DIR = config.checkbox_to_value(add_shows_wo_dir) sickbeard.PROCESS_METHOD = process_method sickbeard.PROCESSOR_FOLLOW_SYMLINKS = config.checkbox_to_value( processor_follow_symlinks) sickbeard.DELRARCONTENTS = config.checkbox_to_value(del_rar_contents) sickbeard.EXTRA_SCRIPTS = [ x.strip() for x in extra_scripts.split('|') if x.strip() ] sickbeard.RENAME_EPISODES = config.checkbox_to_value(rename_episodes) sickbeard.AIRDATE_EPISODES = config.checkbox_to_value(airdate_episodes) sickbeard.FILE_TIMESTAMP_TIMEZONE = file_timestamp_timezone sickbeard.MOVE_ASSOCIATED_FILES = config.checkbox_to_value( move_associated_files) sickbeard.DELETE_NON_ASSOCIATED_FILES = config.checkbox_to_value( delete_non_associated_files) sickbeard.SYNC_FILES = sync_files sickbeard.POSTPONE_IF_SYNC_FILES = config.checkbox_to_value( postpone_if_sync_files) sickbeard.ALLOWED_EXTENSIONS = ','.join( {x.strip() for x in allowed_extensions.split(',') if x.strip()}) sickbeard.NAMING_CUSTOM_ABD = config.checkbox_to_value( naming_custom_abd) sickbeard.NAMING_CUSTOM_SPORTS = config.checkbox_to_value( naming_custom_sports) sickbeard.NAMING_CUSTOM_ANIME = config.checkbox_to_value( naming_custom_anime) sickbeard.NAMING_STRIP_YEAR = config.checkbox_to_value( naming_strip_year) sickbeard.NFO_RENAME = config.checkbox_to_value(nfo_rename) sickbeard.METADATA_KODI = kodi_data sickbeard.METADATA_KODI_12PLUS = kodi_12plus_data sickbeard.METADATA_MEDIABROWSER = mediabrowser_data sickbeard.METADATA_PS3 = sony_ps3_data sickbeard.METADATA_WDTV = wdtv_data sickbeard.METADATA_TIVO = tivo_data sickbeard.METADATA_MEDE8ER = mede8er_data sickbeard.metadata_provider_dict['KODI'].set_config( sickbeard.METADATA_KODI) sickbeard.metadata_provider_dict['KODI 12+'].set_config( sickbeard.METADATA_KODI_12PLUS) sickbeard.metadata_provider_dict['MediaBrowser'].set_config( sickbeard.METADATA_MEDIABROWSER) sickbeard.metadata_provider_dict['Sony PS3'].set_config( sickbeard.METADATA_PS3) sickbeard.metadata_provider_dict['WDTV'].set_config( sickbeard.METADATA_WDTV) sickbeard.metadata_provider_dict['TIVO'].set_config( sickbeard.METADATA_TIVO) sickbeard.metadata_provider_dict['Mede8er'].set_config( sickbeard.METADATA_MEDE8ER) if self.isNamingValid(naming_pattern, naming_multi_ep, anime_type=naming_anime) != "invalid": sickbeard.NAMING_PATTERN = naming_pattern sickbeard.NAMING_MULTI_EP = try_int( naming_multi_ep, NAMING_LIMITED_EXTEND_E_PREFIXED) sickbeard.NAMING_FORCE_FOLDERS = naming.check_force_season_folders( ) else: results.append( _("You tried saving an invalid normal naming config, not saving your naming settings" )) if self.isNamingValid(naming_anime_pattern, naming_anime_multi_ep, anime_type=naming_anime) != "invalid": sickbeard.NAMING_ANIME_PATTERN = naming_anime_pattern sickbeard.NAMING_ANIME_MULTI_EP = try_int( naming_anime_multi_ep, NAMING_LIMITED_EXTEND_E_PREFIXED) sickbeard.NAMING_ANIME = try_int(naming_anime, 3) sickbeard.NAMING_FORCE_FOLDERS = naming.check_force_season_folders( ) else: results.append( _("You tried saving an invalid anime naming config, not saving your naming settings" )) if self.isNamingValid(naming_abd_pattern, None, abd=True) != "invalid": sickbeard.NAMING_ABD_PATTERN = naming_abd_pattern else: results.append( "You tried saving an invalid air-by-date naming config, not saving your air-by-date settings" ) if self.isNamingValid(naming_sports_pattern, None, sports=True) != "invalid": sickbeard.NAMING_SPORTS_PATTERN = naming_sports_pattern else: results.append( "You tried saving an invalid sports naming config, not saving your sports settings" ) sickbeard.save_config() if results: for x in results: logger.log(x, logger.WARNING) ui.notifications.error(_('Error(s) Saving Configuration'), '<br>\n'.join(results)) else: ui.notifications.message(_('Configuration Saved'), ek(os.path.join, sickbeard.CONFIG_FILE)) return self.redirect("/config/postProcessing/")
def saveNotifications(self, use_kodi=None, kodi_always_on=None, kodi_notify_onsnatch=None, kodi_notify_ondownload=None, kodi_notify_onsubtitledownload=None, kodi_update_onlyfirst=None, kodi_update_library=None, kodi_update_full=None, kodi_host=None, kodi_username=None, kodi_password=None, use_plex_server=None, plex_notify_onsnatch=None, plex_notify_ondownload=None, plex_notify_onsubtitledownload=None, plex_update_library=None, plex_server_host=None, plex_server_token=None, plex_client_host=None, plex_server_username=None, plex_server_password=None, use_plex_client=None, plex_client_username=None, plex_client_password=None, plex_server_https=None, use_emby=None, emby_host=None, emby_apikey=None, use_growl=None, growl_notify_onsnatch=None, growl_notify_ondownload=None, growl_notify_onsubtitledownload=None, growl_host=None, growl_password=None, use_freemobile=None, freemobile_notify_onsnatch=None, freemobile_notify_ondownload=None, freemobile_notify_onsubtitledownload=None, freemobile_id=None, freemobile_apikey=None, use_telegram=None, telegram_notify_onsnatch=None, telegram_notify_ondownload=None, telegram_notify_onsubtitledownload=None, telegram_id=None, telegram_apikey=None, use_prowl=None, prowl_notify_onsnatch=None, prowl_notify_ondownload=None, prowl_notify_onsubtitledownload=None, prowl_api=None, prowl_priority=0, prowl_show_list=None, prowl_show=None, prowl_message_title=None, use_twitter=None, twitter_notify_onsnatch=None, twitter_notify_ondownload=None, twitter_notify_onsubtitledownload=None, twitter_usedm=None, twitter_dmto=None, use_boxcar2=None, boxcar2_notify_onsnatch=None, boxcar2_notify_ondownload=None, boxcar2_notify_onsubtitledownload=None, boxcar2_accesstoken=None, use_pushover=None, pushover_notify_onsnatch=None, pushover_notify_ondownload=None, pushover_notify_onsubtitledownload=None, pushover_userkey=None, pushover_apikey=None, pushover_device=None, pushover_sound=None, use_libnotify=None, libnotify_notify_onsnatch=None, libnotify_notify_ondownload=None, libnotify_notify_onsubtitledownload=None, use_nmj=None, nmj_host=None, nmj_database=None, nmj_mount=None, use_synoindex=None, use_nmjv2=None, nmjv2_host=None, nmjv2_dbloc=None, nmjv2_database=None, use_trakt=None, trakt_username=None, trakt_pin=None, trakt_remove_watchlist=None, trakt_sync_watchlist=None, trakt_remove_show_from_sickrage=None, trakt_method_add=None, trakt_start_paused=None, trakt_use_recommended=None, trakt_sync=None, trakt_sync_remove=None, trakt_default_indexer=None, trakt_remove_serieslist=None, trakt_timeout=None, trakt_blacklist_name=None, use_synologynotifier=None, synologynotifier_notify_onsnatch=None, synologynotifier_notify_ondownload=None, synologynotifier_notify_onsubtitledownload=None, use_pytivo=None, pytivo_notify_onsnatch=None, pytivo_notify_ondownload=None, pytivo_notify_onsubtitledownload=None, pytivo_update_library=None, pytivo_host=None, pytivo_share_name=None, pytivo_tivo_name=None, use_nma=None, nma_notify_onsnatch=None, nma_notify_ondownload=None, nma_notify_onsubtitledownload=None, nma_api=None, nma_priority=0, use_pushalot=None, pushalot_notify_onsnatch=None, pushalot_notify_ondownload=None, pushalot_notify_onsubtitledownload=None, pushalot_authorizationtoken=None, use_pushbullet=None, pushbullet_notify_onsnatch=None, pushbullet_notify_ondownload=None, pushbullet_notify_onsubtitledownload=None, pushbullet_api=None, pushbullet_device=None, pushbullet_device_list=None, use_email=None, email_notify_onsnatch=None, email_notify_ondownload=None, email_notify_onsubtitledownload=None, email_host=None, email_port=25, email_from=None, email_tls=None, email_user=None, email_password=None, email_list=None, email_subject=None, email_show_list=None, email_show=None): """ Save notification related settings """ results = [] sickbeard.USE_KODI = config.checkbox_to_value(use_kodi) sickbeard.KODI_ALWAYS_ON = config.checkbox_to_value(kodi_always_on) sickbeard.KODI_NOTIFY_ONSNATCH = config.checkbox_to_value(kodi_notify_onsnatch) sickbeard.KODI_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(kodi_notify_ondownload) sickbeard.KODI_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(kodi_notify_onsubtitledownload) sickbeard.KODI_UPDATE_LIBRARY = config.checkbox_to_value(kodi_update_library) sickbeard.KODI_UPDATE_FULL = config.checkbox_to_value(kodi_update_full) sickbeard.KODI_UPDATE_ONLYFIRST = config.checkbox_to_value(kodi_update_onlyfirst) sickbeard.KODI_HOST = config.clean_hosts(kodi_host) sickbeard.KODI_USERNAME = kodi_username sickbeard.KODI_PASSWORD = kodi_password sickbeard.USE_PLEX_SERVER = config.checkbox_to_value(use_plex_server) sickbeard.PLEX_NOTIFY_ONSNATCH = config.checkbox_to_value(plex_notify_onsnatch) sickbeard.PLEX_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(plex_notify_ondownload) sickbeard.PLEX_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(plex_notify_onsubtitledownload) sickbeard.PLEX_UPDATE_LIBRARY = config.checkbox_to_value(plex_update_library) sickbeard.PLEX_CLIENT_HOST = config.clean_hosts(plex_client_host) sickbeard.PLEX_SERVER_HOST = config.clean_hosts(plex_server_host) sickbeard.PLEX_SERVER_TOKEN = config.clean_host(plex_server_token) sickbeard.PLEX_SERVER_USERNAME = plex_server_username if plex_server_password != '*' * len(sickbeard.PLEX_SERVER_PASSWORD): sickbeard.PLEX_SERVER_PASSWORD = plex_server_password sickbeard.USE_PLEX_CLIENT = config.checkbox_to_value(use_plex_client) sickbeard.PLEX_CLIENT_USERNAME = plex_client_username if plex_client_password != '*' * len(sickbeard.PLEX_CLIENT_PASSWORD): sickbeard.PLEX_CLIENT_PASSWORD = plex_client_password sickbeard.PLEX_SERVER_HTTPS = config.checkbox_to_value(plex_server_https) sickbeard.USE_EMBY = config.checkbox_to_value(use_emby) sickbeard.EMBY_HOST = config.clean_host(emby_host) sickbeard.EMBY_APIKEY = emby_apikey sickbeard.USE_GROWL = config.checkbox_to_value(use_growl) sickbeard.GROWL_NOTIFY_ONSNATCH = config.checkbox_to_value(growl_notify_onsnatch) sickbeard.GROWL_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(growl_notify_ondownload) sickbeard.GROWL_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(growl_notify_onsubtitledownload) sickbeard.GROWL_HOST = config.clean_host(growl_host, default_port=23053) sickbeard.GROWL_PASSWORD = growl_password sickbeard.USE_FREEMOBILE = config.checkbox_to_value(use_freemobile) sickbeard.FREEMOBILE_NOTIFY_ONSNATCH = config.checkbox_to_value(freemobile_notify_onsnatch) sickbeard.FREEMOBILE_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(freemobile_notify_ondownload) sickbeard.FREEMOBILE_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(freemobile_notify_onsubtitledownload) sickbeard.FREEMOBILE_ID = freemobile_id sickbeard.FREEMOBILE_APIKEY = freemobile_apikey sickbeard.USE_TELEGRAM = config.checkbox_to_value(use_telegram) sickbeard.TELEGRAM_NOTIFY_ONSNATCH = config.checkbox_to_value(telegram_notify_onsnatch) sickbeard.TELEGRAM_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(telegram_notify_ondownload) sickbeard.TELEGRAM_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(telegram_notify_onsubtitledownload) sickbeard.TELEGRAM_ID = telegram_id sickbeard.TELEGRAM_APIKEY = telegram_apikey sickbeard.USE_PROWL = config.checkbox_to_value(use_prowl) sickbeard.PROWL_NOTIFY_ONSNATCH = config.checkbox_to_value(prowl_notify_onsnatch) sickbeard.PROWL_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(prowl_notify_ondownload) sickbeard.PROWL_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(prowl_notify_onsubtitledownload) sickbeard.PROWL_API = prowl_api sickbeard.PROWL_PRIORITY = prowl_priority sickbeard.PROWL_MESSAGE_TITLE = prowl_message_title sickbeard.USE_TWITTER = config.checkbox_to_value(use_twitter) sickbeard.TWITTER_NOTIFY_ONSNATCH = config.checkbox_to_value(twitter_notify_onsnatch) sickbeard.TWITTER_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(twitter_notify_ondownload) sickbeard.TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(twitter_notify_onsubtitledownload) sickbeard.TWITTER_USEDM = config.checkbox_to_value(twitter_usedm) sickbeard.TWITTER_DMTO = twitter_dmto sickbeard.USE_BOXCAR2 = config.checkbox_to_value(use_boxcar2) sickbeard.BOXCAR2_NOTIFY_ONSNATCH = config.checkbox_to_value(boxcar2_notify_onsnatch) sickbeard.BOXCAR2_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(boxcar2_notify_ondownload) sickbeard.BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(boxcar2_notify_onsubtitledownload) sickbeard.BOXCAR2_ACCESSTOKEN = boxcar2_accesstoken sickbeard.USE_PUSHOVER = config.checkbox_to_value(use_pushover) sickbeard.PUSHOVER_NOTIFY_ONSNATCH = config.checkbox_to_value(pushover_notify_onsnatch) sickbeard.PUSHOVER_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(pushover_notify_ondownload) sickbeard.PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(pushover_notify_onsubtitledownload) sickbeard.PUSHOVER_USERKEY = pushover_userkey sickbeard.PUSHOVER_APIKEY = pushover_apikey sickbeard.PUSHOVER_DEVICE = pushover_device sickbeard.PUSHOVER_SOUND = pushover_sound sickbeard.USE_LIBNOTIFY = config.checkbox_to_value(use_libnotify) sickbeard.LIBNOTIFY_NOTIFY_ONSNATCH = config.checkbox_to_value(libnotify_notify_onsnatch) sickbeard.LIBNOTIFY_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(libnotify_notify_ondownload) sickbeard.LIBNOTIFY_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(libnotify_notify_onsubtitledownload) sickbeard.USE_NMJ = config.checkbox_to_value(use_nmj) sickbeard.NMJ_HOST = config.clean_host(nmj_host) sickbeard.NMJ_DATABASE = nmj_database sickbeard.NMJ_MOUNT = nmj_mount sickbeard.USE_NMJv2 = config.checkbox_to_value(use_nmjv2) sickbeard.NMJv2_HOST = config.clean_host(nmjv2_host) sickbeard.NMJv2_DATABASE = nmjv2_database sickbeard.NMJv2_DBLOC = nmjv2_dbloc sickbeard.USE_SYNOINDEX = config.checkbox_to_value(use_synoindex) sickbeard.USE_SYNOLOGYNOTIFIER = config.checkbox_to_value(use_synologynotifier) sickbeard.SYNOLOGYNOTIFIER_NOTIFY_ONSNATCH = config.checkbox_to_value(synologynotifier_notify_onsnatch) sickbeard.SYNOLOGYNOTIFIER_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(synologynotifier_notify_ondownload) sickbeard.SYNOLOGYNOTIFIER_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value( synologynotifier_notify_onsubtitledownload) config.change_USE_TRAKT(use_trakt) sickbeard.TRAKT_USERNAME = trakt_username sickbeard.TRAKT_REMOVE_WATCHLIST = config.checkbox_to_value(trakt_remove_watchlist) sickbeard.TRAKT_REMOVE_SERIESLIST = config.checkbox_to_value(trakt_remove_serieslist) sickbeard.TRAKT_REMOVE_SHOW_FROM_SICKRAGE = config.checkbox_to_value(trakt_remove_show_from_sickrage) sickbeard.TRAKT_SYNC_WATCHLIST = config.checkbox_to_value(trakt_sync_watchlist) sickbeard.TRAKT_METHOD_ADD = int(trakt_method_add) sickbeard.TRAKT_START_PAUSED = config.checkbox_to_value(trakt_start_paused) sickbeard.TRAKT_USE_RECOMMENDED = config.checkbox_to_value(trakt_use_recommended) sickbeard.TRAKT_SYNC = config.checkbox_to_value(trakt_sync) sickbeard.TRAKT_SYNC_REMOVE = config.checkbox_to_value(trakt_sync_remove) sickbeard.TRAKT_DEFAULT_INDEXER = int(trakt_default_indexer) sickbeard.TRAKT_TIMEOUT = int(trakt_timeout) sickbeard.TRAKT_BLACKLIST_NAME = trakt_blacklist_name sickbeard.USE_EMAIL = config.checkbox_to_value(use_email) sickbeard.EMAIL_NOTIFY_ONSNATCH = config.checkbox_to_value(email_notify_onsnatch) sickbeard.EMAIL_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(email_notify_ondownload) sickbeard.EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(email_notify_onsubtitledownload) sickbeard.EMAIL_HOST = config.clean_host(email_host) sickbeard.EMAIL_PORT = try_int(email_port, 25) sickbeard.EMAIL_FROM = email_from sickbeard.EMAIL_TLS = config.checkbox_to_value(email_tls) sickbeard.EMAIL_USER = email_user sickbeard.EMAIL_PASSWORD = email_password sickbeard.EMAIL_LIST = email_list sickbeard.EMAIL_SUBJECT = email_subject sickbeard.USE_PYTIVO = config.checkbox_to_value(use_pytivo) sickbeard.PYTIVO_NOTIFY_ONSNATCH = config.checkbox_to_value(pytivo_notify_onsnatch) sickbeard.PYTIVO_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(pytivo_notify_ondownload) sickbeard.PYTIVO_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(pytivo_notify_onsubtitledownload) sickbeard.PYTIVO_UPDATE_LIBRARY = config.checkbox_to_value(pytivo_update_library) sickbeard.PYTIVO_HOST = config.clean_host(pytivo_host) sickbeard.PYTIVO_SHARE_NAME = pytivo_share_name sickbeard.PYTIVO_TIVO_NAME = pytivo_tivo_name sickbeard.USE_NMA = config.checkbox_to_value(use_nma) sickbeard.NMA_NOTIFY_ONSNATCH = config.checkbox_to_value(nma_notify_onsnatch) sickbeard.NMA_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(nma_notify_ondownload) sickbeard.NMA_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(nma_notify_onsubtitledownload) sickbeard.NMA_API = nma_api sickbeard.NMA_PRIORITY = nma_priority sickbeard.USE_PUSHALOT = config.checkbox_to_value(use_pushalot) sickbeard.PUSHALOT_NOTIFY_ONSNATCH = config.checkbox_to_value(pushalot_notify_onsnatch) sickbeard.PUSHALOT_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(pushalot_notify_ondownload) sickbeard.PUSHALOT_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(pushalot_notify_onsubtitledownload) sickbeard.PUSHALOT_AUTHORIZATIONTOKEN = pushalot_authorizationtoken sickbeard.USE_PUSHBULLET = config.checkbox_to_value(use_pushbullet) sickbeard.PUSHBULLET_NOTIFY_ONSNATCH = config.checkbox_to_value(pushbullet_notify_onsnatch) sickbeard.PUSHBULLET_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(pushbullet_notify_ondownload) sickbeard.PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(pushbullet_notify_onsubtitledownload) sickbeard.PUSHBULLET_API = pushbullet_api sickbeard.PUSHBULLET_DEVICE = pushbullet_device_list sickbeard.save_config() if results: for x in results: logger.log(x, logger.ERROR) ui.notifications.error('Error(s) Saving Configuration', '<br>\n'.join(results)) else: ui.notifications.message('Configuration Saved', ek(os.path.join, sickbeard.CONFIG_FILE)) return self.redirect('/config/notifications/')