コード例 #1
0
ファイル: NewzNabManager.cs プロジェクト: kctec/MylarSideCar
        public static List <NewzNabSearchResult> SearchForIssue(Issue issue, Comic comic, string host, string apiKey, string name)
        {
            var query = new NewzNabQuery {
                RequestedFunction = Functions.Search
            };

            query.Groups.Add("alt.binaries.ebook");
            query.Groups.Add("alt.binaries.comics");
            query.Groups.Add("alt.binaries.comics.dcp");
            query.Groups.Add("alt.binaries.comics.repost");
            query.Groups.Add("alt.binaries.pictures.comics");
            query.Groups.Add("alt.binaries.pictures.comics.dcp");
            query.Groups.Add("alt.binaries.pictures.comics.repost");
            query.Groups.Add(" alt.binaries.pictures.comics.reposts");
            query.Groups.Add("alt.binaries.manga");
            query.Groups.Add("alt.binaries.mangas");
            query.Groups.Add("alt.binaries.pictures.comics.complete");
            query.Query = Regex.Replace(comic.ComicName, "[^a-zA-Z0-9_]+", " ");

            var rawData = GetSource(host, apiKey).Search(query);

            var parsedResults = new List <NewzNabSearchResult>();

            foreach (var result in rawData)
            {
                if (!result.Category.ToLower().Contains("comic") &&
                    !result.Category.ToLower().Contains("book"))
                {
                    continue;
                }
                if (!TitleParsingManager.TitleMatch(result.Title, issue, comic))
                {
                    continue;
                }

                result.Provider = name;
                parsedResults.Add(result);
            }

            return(parsedResults);
        }
コード例 #2
0
        public static List <TorzNabResult> SearchIssue(Issue issue, Comic comic, string host, string apiKey)
        {
            if (!ConfigManager.HasValue <MylarConfig>())
            {
                return(null);
            }
            var request = new RestRequest("/", Method.GET);

            request.AddParameter("apikey", apiKey);
            request.AddParameter("cat", "100094,8020,100061,10020");
            string query = Regex.Replace(comic.ComicName, "[^a-zA-Z0-9_]+", " ");

            request.AddParameter("q", query);

            var response = GetRestClient(host).Execute(request);

            return(response.StatusCode != HttpStatusCode.OK
                ? new List <TorzNabResult>()
                : ParseTorzNabXml(response.Content)
                   .Where(result => TitleParsingManager.TitleMatch(result.Title, issue, comic)).ToList());
        }