Ejemplo n.º 1
0
    def _save_rsstorrent_providers(providers_settings):
        providers = []
        settings = providers_settings.split('!!!')
        providers_dict = dict(
            list(zip([x.get_id() for x in app.torrentRssProviderList], app.torrentRssProviderList)))

        for provider_settings in settings:
            if not provider_settings:
                continue

            name, url, cookies, title_tag = provider_settings.split('|')
            url = config.clean_url(url)

            new_provider = TorrentRssProvider(name, url=url, cookies=cookies, title_tag=title_tag)
            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].cookies = cookies
                providers_dict[provider_id].title_tag = title_tag
            else:
                app.torrentRssProviderList.append(new_provider)

            providers.append(provider_id)

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

        # Update the torrentrss provider list
        app.TORRENTRSS_PROVIDERS = [provider.name for provider in app.torrentRssProviderList]
Ejemplo n.º 2
0
    def _save_rsstorrent_providers(providers_settings):
        providers = []
        settings = providers_settings.split('!!!')
        providers_dict = dict(
            list(zip([x.get_id() for x in app.torrentRssProviderList], app.torrentRssProviderList)))

        for provider_settings in settings:
            if not provider_settings:
                continue

            name, url, cookies, title_tag = provider_settings.split('|')
            url = config.clean_url(url)

            new_provider = TorrentRssProvider(name, url=url, cookies=cookies, title_tag=title_tag)
            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].cookies = cookies
                providers_dict[provider_id].title_tag = title_tag
            else:
                app.torrentRssProviderList.append(new_provider)

            providers.append(provider_id)

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

        # Update the torrentrss provider list
        app.TORRENTRSS_PROVIDERS = [provider.name for provider in app.torrentRssProviderList]
Ejemplo n.º 3
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()
Ejemplo n.º 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
        ]
Ejemplo n.º 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()
Ejemplo n.º 6
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]