예제 #1
0
        public bool Equals(LazyLibrarianIndexer other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            return(other.Host == Host &&
                   other.Apikey == Apikey &&
                   other.Name == Name &&
                   other.Categories == Categories &&
                   other.Enabled == Enabled &&
                   other.Altername == Altername);
        }
예제 #2
0
        public LazyLibrarianIndexer AddIndexer(LazyLibrarianIndexer indexer, LazyLibrarianSettings settings)
        {
            var parameters = new Dictionary <string, string>
            {
                { "name", indexer.Name },
                { "providertype", indexer.Type.ToString().ToLower() },
                { "host", indexer.Host },
                { "prov_apikey", indexer.Apikey },
                { "enabled", indexer.Enabled.ToString().ToLower() },
                { "categories", indexer.Categories }
            };

            var request = BuildRequest(settings, "/api", "addProvider", HttpMethod.Get, parameters);

            CheckForError(Execute <LazyLibrarianStatus>(request));
            return(indexer);
        }
예제 #3
0
        private LazyLibrarianIndexer BuildLazyLibrarianIndexer(IndexerDefinition indexer, DownloadProtocol protocol, string originalName = null)
        {
            var schema = protocol == DownloadProtocol.Usenet ? LazyLibrarianProviderType.Newznab : LazyLibrarianProviderType.Torznab;

            var lazyLibrarianIndexer = new LazyLibrarianIndexer
            {
                Name       = originalName ?? $"{indexer.Name} (Prowlarr)",
                Altername  = $"{indexer.Name} (Prowlarr)",
                Host       = $"{Settings.ProwlarrUrl.TrimEnd('/')}/{indexer.Id}/api",
                Apikey     = _configFileProvider.ApiKey,
                Categories = string.Join(",", indexer.Capabilities.Categories.SupportedCategories(Settings.SyncCategories.ToArray())),
                Enabled    = indexer.Enable,
                Type       = schema,
            };

            return(lazyLibrarianIndexer);
        }