Beispiel #1
0
    def _make_provider(provider_config):
        """
        Create providers using a !!! separated string of providers.

        This is only still used for migration old configs prior to v10.
        """
        if not provider_config:
            return None

        try:
            values = provider_config.split('|')
            # Pad values with None for each missing value
            values.extend([None for _ in range(len(values), 10)])

            (name, url, api_key, category_ids, enabled,
             search_mode, search_fallback,
             enable_daily, enable_backlog, enable_manualsearch
             ) = values

        except ValueError:
            log.error('Skipping Newznab provider string: {config!r}, incorrect format',
                      {'config': provider_config})
            return None

        new_provider = NewznabProvider(
            name, url, api_key=api_key, cat_ids=split_and_strip(category_ids),
            search_mode=search_mode or 'eponly',
            search_fallback=bool(int(search_fallback)),
            enable_daily=bool(int(enable_daily)),
            enable_backlog=bool(int(enable_backlog)),
            enable_manualsearch=bool(int(enable_manualsearch)))
        new_provider.enabled = bool(int(enabled))

        return new_provider
Beispiel #2
0
    def _make_provider(provider_config):
        """
        Create providers using a !!! separated string of providers.

        This is only still used for migration old configs prior to v10.
        """
        if not provider_config:
            return None

        try:
            values = provider_config.split('|')
            # Pad values with None for each missing value
            values.extend([None for _ in range(len(values), 10)])

            (name, url, api_key, category_ids, enabled,
             search_mode, search_fallback,
             enable_daily, enable_backlog, enable_manualsearch
             ) = values

        except ValueError:
            log.error('Skipping Newznab provider string: {config!r}, incorrect format',
                      {'config': provider_config})
            return None

        new_provider = NewznabProvider(
            name, url, api_key=api_key, cat_ids=split_and_strip(category_ids),
            search_mode=search_mode or 'eponly',
            search_fallback=bool(int(search_fallback)),
            enable_daily=bool(int(enable_daily)),
            enable_backlog=bool(int(enable_backlog)),
            enable_manualsearch=bool(int(enable_manualsearch)))
        new_provider.enabled = bool(int(enabled))

        return new_provider
Beispiel #3
0
    def _save_torznab_providers(providers_settings):
        providers = []
        settings = providers_settings.split('!!!')
        providers_dict = dict(
            list(
                zip([x.get_id() for x in app.torznab_providers_list],
                    app.torznab_providers_list)))

        for provider_settings in settings:
            if not provider_settings:
                continue

            name, url, api_key, categories, caps = provider_settings.split('|')
            url = config.clean_url(url)
            categories = split_and_strip(categories)
            caps = split_and_strip(caps)

            new_provider = TorznabProvider(name,
                                           url=url,
                                           api_key=api_key,
                                           cat_ids=categories,
                                           cap_tv_search=caps)
            provider_id = new_provider.get_id()

            # if it already exists then update it
            if provider_id in providers_dict:
                providers_dict[provider_id].name = name
                providers_dict[provider_id].url = url
                providers_dict[provider_id].api_key = api_key
                providers_dict[provider_id].cat_ids = categories
                providers_dict[provider_id].cap_tv_search = caps
            else:
                app.torznab_providers_list.append(new_provider)

            providers.append(provider_id)

        # delete anything that is missing
        for provider in app.torznab_providers_list:
            if provider.get_id() not in providers:
                app.torznab_providers_list.remove(provider)

        app.TORZNAB_PROVIDERS = [
            provider.name for provider in app.torznab_providers_list
        ]
Beispiel #4
0
    def _save_torznab_providers(providers_settings):
        providers = []
        settings = providers_settings.split('!!!')
        providers_dict = dict(
            list(zip([x.get_id() for x in app.torznab_providers_list], app.torznab_providers_list)))

        for provider_settings in settings:
            if not provider_settings:
                continue

            name, url, api_key, categories, caps = provider_settings.split('|')
            url = config.clean_url(url)
            categories = split_and_strip(categories)
            caps = split_and_strip(caps)

            new_provider = TorznabProvider(name, url=url, api_key=api_key, cat_ids=categories,
                                           cap_tv_search=caps)
            provider_id = new_provider.get_id()

            # if it already exists then update it
            if provider_id in providers_dict:
                providers_dict[provider_id].name = name
                providers_dict[provider_id].url = url
                providers_dict[provider_id].api_key = api_key
                providers_dict[provider_id].cat_ids = categories
                providers_dict[provider_id].cap_tv_search = caps
            else:
                app.torznab_providers_list.append(new_provider)

            providers.append(provider_id)

        # delete anything that is missing
        for provider in app.torznab_providers_list:
            if provider.get_id() not in providers:
                app.torznab_providers_list.remove(provider)

        app.TORZNAB_PROVIDERS = [provider.name for provider in app.torznab_providers_list]
Beispiel #5
0
    def _save_newznab_providers(providers_settings):
        providers = []
        settings = providers_settings.split('!!!')
        providers_dict = dict(
            list(
                zip([x.get_id() for x in app.newznabProviderList],
                    app.newznabProviderList)))

        for provider_settings in settings:
            if not provider_settings:
                continue

            name, url, api_key, categories = provider_settings.split('|')
            url = config.clean_url(url)
            categories = split_and_strip(categories)

            new_provider = NewznabProvider(name,
                                           url=url,
                                           api_key=api_key,
                                           cat_ids=categories)
            provider_id = new_provider.get_id()

            # if it already exists then update it
            if provider_id in providers_dict:
                providers_dict[provider_id].name = name
                providers_dict[provider_id].url = url
                providers_dict[provider_id].api_key = api_key
                providers_dict[provider_id].cat_ids = categories
                # a 0 in the key spot indicates that no key is needed
                if api_key == '0':
                    providers_dict[provider_id].needs_auth = False
                else:
                    providers_dict[provider_id].needs_auth = True
            else:
                app.newznabProviderList.append(new_provider)

            providers.append(provider_id)

        # delete anything that is missing
        for provider in app.newznabProviderList:
            if provider.get_id() not in providers:
                app.newznabProviderList.remove(provider)

        # Update the custom newznab provider list
        NewznabProvider.save_newznab_providers()
Beispiel #6
0
def check_setting_list(config, cfg_name, item_name, default=None, silent=True, censor_log=False, transform=None,
                       transform_default=0, split_value=False):
    """Check a setting, using the settings section and item name. Expect to return a list."""
    default = default or []

    if not censor_log:
        censor_level = common.privacy_levels['stupid']
    else:
        censor_level = common.privacy_levels[censor_log]
    privacy_level = common.privacy_levels[app.PRIVACY_LEVEL]

    try:
        my_val = config[cfg_name][item_name]
    except Exception:
        my_val = default
        try:
            config[cfg_name][item_name] = my_val
        except Exception:
            config[cfg_name] = {}
            config[cfg_name][item_name] = my_val

    if privacy_level >= censor_level or (cfg_name, item_name) in iteritems(logger.censored_items):
        if not item_name.endswith('custom_url'):
            logger.censored_items[cfg_name, item_name] = my_val

    if split_value:
        if isinstance(my_val, string_types):
            my_val = split_and_strip(my_val, split_value)

    # Make an attempt to cast the lists values.
    if isinstance(my_val, list) and transform:
        for index, value in enumerate(my_val):
            try:
                my_val[index] = transform(value)
            except ValueError:
                my_val[index] = transform_default

    if not silent:
        log.debug(u'{item} -> {value!r}', {u'item': item_name, u'value': my_val})

    return my_val
Beispiel #7
0
    def _save_newznab_providers(providers_settings):
        providers = []
        settings = providers_settings.split('!!!')
        providers_dict = dict(
            list(zip([x.get_id() for x in app.newznabProviderList], app.newznabProviderList)))

        for provider_settings in settings:
            if not provider_settings:
                continue

            name, url, api_key, categories = provider_settings.split('|')
            url = config.clean_url(url)
            categories = split_and_strip(categories)

            new_provider = NewznabProvider(name, url=url, api_key=api_key, cat_ids=categories)
            provider_id = new_provider.get_id()

            # if it already exists then update it
            if provider_id in providers_dict:
                providers_dict[provider_id].name = name
                providers_dict[provider_id].url = url
                providers_dict[provider_id].api_key = api_key
                providers_dict[provider_id].cat_ids = categories
                # a 0 in the key spot indicates that no key is needed
                if api_key == '0':
                    providers_dict[provider_id].needs_auth = False
                else:
                    providers_dict[provider_id].needs_auth = True
            else:
                app.newznabProviderList.append(new_provider)

            providers.append(provider_id)

        # delete anything that is missing
        for provider in app.newznabProviderList:
            if provider.get_id() not in providers:
                app.newznabProviderList.remove(provider)

        # Update the custom newznab provider list
        NewznabProvider.save_newznab_providers()
Beispiel #8
0
    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 app.newznabProviderList],
                app.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 = NewznabProvider(cur_name,
                                               cur_url,
                                               api_key=cur_key,
                                               cat_ids=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].api_key = cur_key
                    newznab_provider_dict[cur_id].cat_ids = split_and_strip(
                        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:
                    app.newznabProviderList.append(new_provider)

                finished_names.append(cur_id)

        # delete anything that is missing
        for cur_provider in app.newznabProviderList:
            if cur_provider.get_id() not in finished_names:
                app.newznabProviderList.remove(cur_provider)

        # Update the custom newznab provider list
        NewznabProvider.save_newnab_providers()

        torrent_rss_provider_dict = dict(
            zip([x.get_id() for x in app.torrentRssProviderList],
                app.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 = 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:
                    app.torrentRssProviderList.append(new_provider)

                finished_names.append(cur_id)

        # delete anything that is missing
        for cur_provider in app.torrentRssProviderList:
            if cur_provider.get_id() not in finished_names:
                app.torrentRssProviderList.remove(cur_provider)

        # Update the torrentrss provider list
        app.TORRENTRSS_PROVIDERS = [
            provider.name for provider in app.torrentRssProviderList
        ]

        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 providers.sorted_provider_list()
                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 cur_torrent_provider in [
                prov for prov in providers.sorted_provider_list()
                if prov.provider_type == GenericProvider.TORRENT
        ]:

            if hasattr(cur_torrent_provider, 'custom_url'):
                try:
                    cur_torrent_provider.custom_url = str(
                        kwargs['{id}_custom_url'.format(
                            id=cur_torrent_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    cur_torrent_provider.custom_url = None  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'minseed'):
                try:
                    cur_torrent_provider.minseed = int(
                        str(kwargs['{id}_minseed'.format(
                            id=cur_torrent_provider.get_id())]).strip())
                except (AttributeError, KeyError):
                    cur_torrent_provider.minseed = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'minleech'):
                try:
                    cur_torrent_provider.minleech = int(
                        str(kwargs['{id}_minleech'.format(
                            id=cur_torrent_provider.get_id())]).strip())
                except (AttributeError, KeyError):
                    cur_torrent_provider.minleech = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'ratio'):
                try:
                    ratio = float(
                        str(kwargs['{id}_ratio'.format(
                            id=cur_torrent_provider.get_id())]).strip())
                    cur_torrent_provider.ratio = (ratio, -1)[ratio < 0]
                except (AttributeError, KeyError, ValueError):
                    cur_torrent_provider.ratio = None  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'digest'):
                try:
                    cur_torrent_provider.digest = str(
                        kwargs['{id}_digest'.format(
                            id=cur_torrent_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    cur_torrent_provider.digest = None  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'hash'):
                try:
                    cur_torrent_provider.hash = str(kwargs['{id}_hash'.format(
                        id=cur_torrent_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    cur_torrent_provider.hash = None  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'api_key'):
                try:
                    cur_torrent_provider.api_key = str(
                        kwargs['{id}_api_key'.format(
                            id=cur_torrent_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    cur_torrent_provider.api_key = None  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'username'):
                try:
                    cur_torrent_provider.username = str(
                        kwargs['{id}_username'.format(
                            id=cur_torrent_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    cur_torrent_provider.username = None  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'password'):
                try:
                    cur_torrent_provider.password = str(
                        kwargs['{id}_password'.format(
                            id=cur_torrent_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    cur_torrent_provider.password = None  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'passkey'):
                try:
                    cur_torrent_provider.passkey = str(
                        kwargs['{id}_passkey'.format(
                            id=cur_torrent_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    cur_torrent_provider.passkey = None  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'pin'):
                try:
                    cur_torrent_provider.pin = str(kwargs['{id}_pin'.format(
                        id=cur_torrent_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    cur_torrent_provider.pin = None  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'confirmed'):
                try:
                    cur_torrent_provider.confirmed = config.checkbox_to_value(
                        kwargs['{id}_confirmed'.format(
                            id=cur_torrent_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_torrent_provider.confirmed = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'ranked'):
                try:
                    cur_torrent_provider.ranked = config.checkbox_to_value(
                        kwargs['{id}_ranked'.format(
                            id=cur_torrent_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_torrent_provider.ranked = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'engrelease'):
                try:
                    cur_torrent_provider.engrelease = config.checkbox_to_value(
                        kwargs['{id}_engrelease'.format(
                            id=cur_torrent_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_torrent_provider.engrelease = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'onlyspasearch'):
                try:
                    cur_torrent_provider.onlyspasearch = config.checkbox_to_value(
                        kwargs['{id}_onlyspasearch'.format(
                            id=cur_torrent_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_torrent_provider.onlyspasearch = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'sorting'):
                try:
                    cur_torrent_provider.sorting = str(
                        kwargs['{id}_sorting'.format(
                            id=cur_torrent_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    cur_torrent_provider.sorting = 'seeders'  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'freeleech'):
                try:
                    cur_torrent_provider.freeleech = config.checkbox_to_value(
                        kwargs['{id}_freeleech'.format(
                            id=cur_torrent_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_torrent_provider.freeleech = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'search_mode'):
                try:
                    cur_torrent_provider.search_mode = str(
                        kwargs['{id}_search_mode'.format(
                            id=cur_torrent_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    cur_torrent_provider.search_mode = 'eponly'  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'search_fallback'):
                try:
                    cur_torrent_provider.search_fallback = config.checkbox_to_value(
                        kwargs['{id}_search_fallback'.format(
                            id=cur_torrent_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_torrent_provider.search_fallback = 0  # these exceptions are catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'enable_daily'):
                try:
                    cur_torrent_provider.enable_daily = config.checkbox_to_value(
                        kwargs['{id}_enable_daily'.format(
                            id=cur_torrent_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_torrent_provider.enable_daily = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'enable_manualsearch'):
                try:
                    cur_torrent_provider.enable_manualsearch = config.checkbox_to_value(
                        kwargs['{id}_enable_manualsearch'.format(
                            id=cur_torrent_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_torrent_provider.enable_manualsearch = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'enable_backlog'):
                try:
                    cur_torrent_provider.enable_backlog = config.checkbox_to_value(
                        kwargs['{id}_enable_backlog'.format(
                            id=cur_torrent_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_torrent_provider.enable_backlog = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'cat'):
                try:
                    cur_torrent_provider.cat = int(
                        str(kwargs['{id}_cat'.format(
                            id=cur_torrent_provider.get_id())]).strip())
                except (AttributeError, KeyError):
                    cur_torrent_provider.cat = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_torrent_provider, 'subtitle'):
                try:
                    cur_torrent_provider.subtitle = config.checkbox_to_value(
                        kwargs['{id}_subtitle'.format(
                            id=cur_torrent_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_torrent_provider.subtitle = 0  # these exceptions are actually catching unselected checkboxes

            if cur_torrent_provider.enable_cookies:
                try:
                    cur_torrent_provider.cookies = str(
                        kwargs['{id}_cookies'.format(
                            id=cur_torrent_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    pass  # I don't want to configure a default value here, as it can also be configured intially as a custom rss torrent provider

        for cur_nzb_provider in [
                prov for prov in providers.sorted_provider_list()
                if prov.provider_type == GenericProvider.NZB
        ]:

            # We don't want to overwrite the api key, as that's not available in the second tab for newznab providers.
            if hasattr(cur_nzb_provider, 'api_key') and not isinstance(
                    cur_nzb_provider, NewznabProvider):
                try:
                    cur_nzb_provider.api_key = str(
                        kwargs['{id}_api_key'.format(
                            id=cur_nzb_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    cur_nzb_provider.api_key = None  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_nzb_provider, 'username'):
                try:
                    cur_nzb_provider.username = str(
                        kwargs['{id}_username'.format(
                            id=cur_nzb_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    cur_nzb_provider.username = None  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_nzb_provider, 'search_mode'):
                try:
                    cur_nzb_provider.search_mode = str(
                        kwargs['{id}_search_mode'.format(
                            id=cur_nzb_provider.get_id())]).strip()
                except (AttributeError, KeyError):
                    cur_nzb_provider.search_mode = 'eponly'  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_nzb_provider, 'search_fallback'):
                try:
                    cur_nzb_provider.search_fallback = config.checkbox_to_value(
                        kwargs['{id}_search_fallback'.format(
                            id=cur_nzb_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_nzb_provider.search_fallback = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_nzb_provider, 'enable_daily'):
                try:
                    cur_nzb_provider.enable_daily = config.checkbox_to_value(
                        kwargs['{id}_enable_daily'.format(
                            id=cur_nzb_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_nzb_provider.enable_daily = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_nzb_provider, 'enable_manualsearch'):
                try:
                    cur_nzb_provider.enable_manualsearch = config.checkbox_to_value(
                        kwargs['{id}_enable_manualsearch'.format(
                            id=cur_nzb_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_nzb_provider.enable_manualsearch = 0  # these exceptions are actually catching unselected checkboxes

            if hasattr(cur_nzb_provider, 'enable_backlog'):
                try:
                    cur_nzb_provider.enable_backlog = config.checkbox_to_value(
                        kwargs['{id}_enable_backlog'.format(
                            id=cur_nzb_provider.get_id())])
                except (AttributeError, KeyError):
                    cur_nzb_provider.enable_backlog = 0  # these exceptions are actually catching unselected checkboxes

        # app.NEWZNAB_DATA = '!!!'.join([x.config_string() for x in app.newznabProviderList])
        app.PROVIDER_ORDER = provider_list

        app.instance.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',
                                     os.path.join(app.CONFIG_FILE))

        return self.redirect('/config/providers/')