public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
        {
            var pageableRequests = new IndexerPageableRequestChain();

            pageableRequests.Add(GetRequest(string.Format("&artistname={0}", searchCriteria.ArtistQuery)));
            return(pageableRequests);
        }
Esempio n. 2
0
        public async Task <List <Artist> > Search(string criteria)
        {
            ArtistSearchCriteria searchCritiera = JsonConvert.DeserializeObject <ArtistSearchCriteria>(criteria);

            searchCritiera.Classifications = searchCritiera.Classifications ?? new List <SubjectClassification>();

            return(await _artistService.Search("0e54b6da-caef-492f-bc95-b0669a8957d5", searchCritiera));
        }
Esempio n. 3
0
        public virtual IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
        {
            var pageableRequests = new IndexerPageableRequestChain();

            pageableRequests.Add(GetPagedRequests("search", null, "{0}", searchCriteria.ArtistQuery));

            return(pageableRequests);
        }
Esempio n. 4
0
        public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
        {
            var pageableRequests = new IndexerPageableRequestChain();

            pageableRequests.Add(GetPagedRequests(MaxPages, string.Format("&q=artist:{0}", searchCriteria.ArtistQuery)));

            return(pageableRequests);
        }
Esempio n. 5
0
        public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
        {
            var pageableRequests = new IndexerPageableRequestChain();

            pageableRequests.Add(GetRequest("search-torrents", Settings.Categories, string.Format(" & type=name&query={0}", Uri.EscapeDataString(searchCriteria.ArtistQuery.Trim()))));

            return(pageableRequests);
        }
Esempio n. 6
0
        public override IList <ReleaseInfo> Fetch(ArtistSearchCriteria searchCriteria)
        {
            if (!SupportsSearch)
            {
                return(new List <ReleaseInfo>());
            }

            return(FetchReleases(g => g.GetSearchRequests(searchCriteria)));
        }
Esempio n. 7
0
        public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
        {
            var chain = new IndexerPageableRequestChain();

            chain.AddTier(GetRequests($"artist:\"{searchCriteria.ArtistQuery}\""));
            chain.AddTier(GetRequests(searchCriteria.ArtistQuery));

            return(chain);
        }
Esempio n. 8
0
        public virtual IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
        {
            var pageableRequests = new IndexerPageableRequestChain();

            pageableRequests.AddTier();

            pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "search",
                                                  NewsnabifyTitle($"&q={searchCriteria.ArtistQuery}")));

            return(pageableRequests);
        }
Esempio n. 9
0
        public ActionResult List()
        {
            var model = new ArtistManageModel();

            var defaultCriteria = new ArtistSearchCriteria(10);

            model.PagedArtists = GetPagedArtistModel(defaultCriteria);

            var professions = ArtistBussinessLogic.Instance.GetProfessions();

            model.Professions = ProfessionTranslator.Instance.Translate(professions).ToList();

            return(View(model));
        }
Esempio n. 10
0
        private PagedArtistModel GetPagedArtistModel(ArtistSearchCriteria criteria)
        {
            var artistItems  = new List <ArtistItem>();
            var pagedArtists = ArtistBussinessLogic.Instance.SearchArtists(criteria.NamePart, criteria.ProfessionId, criteria.PagingRequest);

            foreach (var item in pagedArtists)
            {
                var artist = ArtistItemTranslator.Instance.Translate(item);
                artist.CanUnPublish = Art.BussinessLogic.ArtistBussinessLogic.Instance.CanUnpublish(item);
                artistItems.Add(artist);
            }

            var model = new PagedArtistModel(artistItems, pagedArtists.PagingResult);

            return(model);
        }
        public void should_only_include_reports_for_requested_albums()
        {
            var artist = Builder <Artist> .CreateNew().Build();

            var albums = Builder <Album> .CreateListOfSize(2)
                         .All()
                         .With(v => v.ArtistId, artist.Id)
                         .With(v => v.Artist, new LazyLoaded <Artist>(artist))
                         .BuildList();

            var criteria = new ArtistSearchCriteria {
                Albums = albums.Take(1).ToList()
            };

            var reports = albums.Select(v =>
                                        new ReleaseInfo()
            {
                Title = string.Format("{0}-{1}[FLAC][2017][DRONE]", artist.Name, v.Title)
            }).ToList();

            Mocker.GetMock <IParsingService>()
            .Setup(v => v.Map(It.IsAny <ParsedAlbumInfo>(), It.IsAny <SearchCriteriaBase>()))
            .Returns <ParsedAlbumInfo, SearchCriteriaBase>((p, c) =>
                                                           new RemoteAlbum
            {
                DownloadAllowed = true,
                ParsedAlbumInfo = p,
                Artist          = artist,
                Albums          = albums.Where(v => v.Title == p.AlbumTitle).ToList()
            });

            Mocker.SetConstant <IEnumerable <IDecisionEngineSpecification> >(new List <IDecisionEngineSpecification>
            {
                Mocker.Resolve <NzbDrone.Core.DecisionEngine.Specifications.Search.AlbumRequestedSpecification>()
            });

            var decisions = Subject.GetSearchDecision(reports, criteria);

            var approvedDecisions = decisions.Where(v => v.Approved).ToList();

            approvedDecisions.Count.Should().Be(1);
        }
Esempio n. 12
0
        public virtual IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
        {
            var pageableRequests = new IndexerPageableRequestChain();

            if (SupportsAudioSearch)
            {
                AddAudioPageableRequests(pageableRequests, searchCriteria,
                                         NewsnabifyTitle($"&artist={searchCriteria.ArtistQuery}"));
            }

            if (SupportsSearch)
            {
                pageableRequests.AddTier();

                pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "search",
                                                      NewsnabifyTitle($"&q={searchCriteria.ArtistQuery}")));
            }

            return(pageableRequests);
        }
Esempio n. 13
0
        public async Task <List <Artist> > Search(string userId, ArtistSearchCriteria criteria)
        {
            DocumentClient client = await _documentClientFactory.GetClient();

            FeedOptions queryOptions = new FeedOptions {
                MaxItemCount = 20
            };

            StringBuilder builder = new StringBuilder();

            builder.Append("SELECT a.Id, a.Name FROM a ");
            for (int i = 0; i < criteria.Classifications.Count; i++)
            {
                builder.Append($"JOIN c{i} IN a.Classifications ");
            }
            builder.Append($"WHERE CONTAINS(UPPER(a.Name), UPPER('{criteria.Name}')) ");
            for (int i = 0; i < criteria.Classifications.Count; i++)
            {
                var classification = criteria.Classifications[i];
                builder.Append($"AND c{i}.ClassificationCategoryId = '{classification.ClassificationCategoryId}' ");
                if (!string.IsNullOrWhiteSpace(classification.ClassificationTagId))
                {
                    builder.Append($"AND c{i}.ClassificationTagId = '{classification.ClassificationTagId}' ");
                }
                if (classification.RangeValue.HasValue)
                {
                    builder.Append($"AND c{i}.RangeValue = {classification.RangeValue} ");
                }
            }
            builder.Append("ORDER BY a.Name");


            IQueryable <Artist> artistQuery = client.CreateDocumentQuery <Artist>(
                CreateDocumentCollectionUri(), builder.ToString(), queryOptions);

            return(artistQuery.ToList());
        }
Esempio n. 14
0
        public ActionResult List(ArtistSearchCriteria criteria)
        {
            var model = GetPagedArtistModel(criteria);

            return(PartialView("_List", model));
        }
Esempio n. 15
0
 public abstract IList <ReleaseInfo> Fetch(ArtistSearchCriteria searchCriteria);
 public virtual IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
 {
     throw new System.NotImplementedException();
 }