Пример #1
0
        public PartialFindResult <SongInListForApiContract> GetSongs(int listId,
                                                                     string query          = "",
                                                                     string songTypes      = null,
                                                                     PVServices?pvServices = null,
                                                                     [FromQuery(Name = "tagId[]")] int[] tagId       = null,
                                                                     [FromQuery(Name = "artistId[]")] int[] artistId = null,
                                                                     bool childVoicebanks = false,
                                                                     [FromQuery(Name = "advancedFilters")] AdvancedSearchFilterParams[] advancedFilters = null,
                                                                     int start                      = 0, int maxResults = DefaultMax, bool getTotalCount = false,
                                                                     SongSortRule?sort              = null,
                                                                     NameMatchMode nameMatchMode    = NameMatchMode.Auto,
                                                                     SongOptionalFields fields      = SongOptionalFields.None,
                                                                     ContentLanguagePreference lang = ContentLanguagePreference.Default)
        {
            maxResults = Math.Min(maxResults, AbsoluteMax);
            var types = EnumVal <SongType> .ParseMultiple(songTypes);

            return(_queries.GetSongsInList(
                       new SongInListQueryParams
            {
                TextQuery = SearchTextQuery.Create(query, nameMatchMode),
                ListId = listId,
                Paging = new PagingProperties(start, maxResults, getTotalCount),
                PVServices = pvServices,
                ArtistIds = artistId,
                ChildVoicebanks = childVoicebanks,
                TagIds = tagId,
                SortRule = sort,
                AdvancedFilters = advancedFilters?.Select(advancedFilter => advancedFilter.ToAdvancedSearchFilter()).ToArray(),
                SongTypes = types,
            },
                       songInList => new SongInListForApiContract(songInList, lang, fields)));
        }
Пример #2
0
        public PartialFindResult <ArtistForApiContract> GetList(
            string query                   = "",
            string artistTypes             = null,
            string tag                     = null,
            int?followedByUserId           = null,
            EntryStatus?status             = null,
            int start                      = 0, int maxResults = defaultMax, bool getTotalCount = false,
            ArtistSortRule sort            = ArtistSortRule.Name,
            bool preferAccurateMatches     = false,
            NameMatchMode nameMatchMode    = NameMatchMode.Exact,
            ArtistOptionalFields fields    = ArtistOptionalFields.None,
            ContentLanguagePreference lang = ContentLanguagePreference.Default)
        {
            var textQuery = ArtistSearchTextQuery.Create(query, nameMatchMode);
            var types     = EnumVal <ArtistType> .ParseMultiple(artistTypes);

            var param = new ArtistQueryParams(textQuery, types, start, Math.Min(maxResults, absoluteMax), false, getTotalCount, sort, preferAccurateMatches)
            {
                Tag            = tag,
                UserFollowerId = followedByUserId ?? 0
            };

            param.Common.EntryStatus = status;

            var ssl     = WebHelper.IsSSL(Request);
            var artists = service.FindArtists(s => new ArtistForApiContract(s, lang, thumbPersister, ssl, fields), param);

            return(artists);
        }
Пример #3
0
        public PartialFindResult <SongForApiContract> GetList(
            string query               = "",
            string songTypes           = null,
            [FromUri] string[] tagName = null,
            [FromUri] int[] tagId      = null,
            bool childTags             = false,
            [FromUri] int[] artistId   = null,
            ArtistAlbumParticipationStatus artistParticipationStatus = ArtistAlbumParticipationStatus.Everything,
            bool childVoicebanks            = false,
            bool includeMembers             = false,
            bool onlyWithPvs                = false,
            [FromUri] PVServices?pvServices = null,
            int?since            = null,
            int?minScore         = null,
            int?userCollectionId = null,
            int?releaseEventId   = null,
            EntryStatus?status   = null,
            [FromUri] AdvancedSearchFilter[] advancedFilters = null,
            int start                      = 0, int maxResults = defaultMax, bool getTotalCount = false,
            SongSortRule sort              = SongSortRule.Name,
            bool preferAccurateMatches     = false,
            NameMatchMode nameMatchMode    = NameMatchMode.Exact,
            SongOptionalFields fields      = SongOptionalFields.None,
            ContentLanguagePreference lang = ContentLanguagePreference.Default)
        {
            var textQuery = SearchTextQuery.Create(query, nameMatchMode);
            var types     = EnumVal <SongType> .ParseMultiple(songTypes);

            var param = new SongQueryParams(textQuery, types, start, Math.Min(maxResults, absoluteMax), getTotalCount, sort, false, preferAccurateMatches, null)
            {
                ArtistParticipation =
                {
                    ArtistIds       = artistId,
                    Participation   = artistParticipationStatus,
                    ChildVoicebanks = childVoicebanks,
                    IncludeMembers  = includeMembers
                },
                TagIds             = tagId,
                Tags               = tagName,
                ChildTags          = childTags,
                OnlyWithPVs        = onlyWithPvs,
                TimeFilter         = since.HasValue ? TimeSpan.FromHours(since.Value) : TimeSpan.Zero,
                MinScore           = minScore ?? 0,
                PVServices         = pvServices,
                UserCollectionId   = userCollectionId ?? 0,
                ReleaseEventId     = releaseEventId ?? 0,
                AdvancedFilters    = advancedFilters,
                LanguagePreference = lang
            };

            param.Common.EntryStatus = status;

            var artists = service.Find(s => new SongForApiContract(s, null, lang, fields), param);

            return(artists);
        }
Пример #4
0
        public PartialFindResult <SongForApiContract> GetList(
            string query     = "",
            string songTypes = null,
            string tag       = null,
            int?artistId     = null,
            ArtistAlbumParticipationStatus artistParticipationStatus = ArtistAlbumParticipationStatus.Everything,
            bool childVoicebanks            = false,
            bool onlyWithPvs                = false,
            [FromUri] PVServices?pvServices = null,
            int?since    = null,
            int?minScore = null,
            [FromUri] ContentLanguageSelections?lyrics = null,
            int?userCollectionId           = null,
            EntryStatus?status             = null,
            int start                      = 0, int maxResults = defaultMax, bool getTotalCount = false,
            SongSortRule sort              = SongSortRule.Name,
            bool preferAccurateMatches     = false,
            NameMatchMode nameMatchMode    = NameMatchMode.Exact,
            SongOptionalFields fields      = SongOptionalFields.None,
            ContentLanguagePreference lang = ContentLanguagePreference.Default)
        {
            var textQuery = SearchTextQuery.Create(query, nameMatchMode);
            var types     = EnumVal <SongType> .ParseMultiple(songTypes);

            var param = new SongQueryParams(textQuery, types, start, Math.Min(maxResults, absoluteMax), false, getTotalCount, sort, false, preferAccurateMatches, null)
            {
                Tag         = tag,
                OnlyWithPVs = onlyWithPvs,
                ArtistId    = artistId ?? 0,
                ArtistParticipationStatus = artistParticipationStatus,
                ChildVoicebanks           = childVoicebanks,
                TimeFilter      = since.HasValue ? TimeSpan.FromHours(since.Value) : TimeSpan.Zero,
                LyricsLanguages = lyrics != null?lyrics.Value.ToIndividualSelections().ToArray() : null,
                                      MinScore         = minScore ?? 0,
                                      PVServices       = pvServices,
                                      UserCollectionId = userCollectionId ?? 0
            };

            param.Common.EntryStatus = status;

            var artists = service.Find(s => new SongForApiContract(s, null, lang, fields), param);

            return(artists);
        }
Пример #5
0
        public PartialFindResult <ArtistForApiContract> GetList(
            string query             = "",
            string artistTypes       = null,
            bool allowBaseVoicebanks = true,
            [FromQuery(Name = "tagName[]")] string[] tagName = null,
            [FromQuery(Name = "tagId[]")] int[] tagId        = null,
            bool childTags       = false,
            int?followedByUserId = null,
            EntryStatus?status   = null,
            [FromQuery(Name = "advancedFilters")] AdvancedSearchFilterParams[] advancedFilters = null,
            int start                      = 0, int maxResults = DefaultMax, bool getTotalCount = false,
            ArtistSortRule sort            = ArtistSortRule.Name,
            bool preferAccurateMatches     = false,
            NameMatchMode nameMatchMode    = NameMatchMode.Exact,
            ArtistOptionalFields fields    = ArtistOptionalFields.None,
            ContentLanguagePreference lang = ContentLanguagePreference.Default)
        {
            var textQuery = ArtistSearchTextQuery.Create(query, nameMatchMode);
            var types     = EnumVal <ArtistType> .ParseMultiple(artistTypes);

            var param = new ArtistQueryParams(textQuery, types, start, Math.Min(maxResults, AbsoluteMax), getTotalCount, sort, preferAccurateMatches)
            {
                Tags                = tagName,
                TagIds              = tagId,
                ChildTags           = childTags,
                UserFollowerId      = followedByUserId ?? 0,
                AllowBaseVoicebanks = allowBaseVoicebanks,
                AdvancedFilters     = advancedFilters?.Select(advancedFilter => advancedFilter.ToAdvancedSearchFilter()).ToArray(),
            };

            param.Common.EntryStatus = status;

            var artists = _service.FindArtists(s => new ArtistForApiContract(s, lang, _thumbPersister, fields), param);

            return(artists);
        }